Changelog in Linux kernel 5.4.297

 
Linux: (powerpc/512) Fix possible `dma_unmap_single()` on uninitialized pointer [+ + +]
Author: Thomas Fourier <[email protected]>
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 <[email protected]>
    Reviewed-by: Christophe Leroy <[email protected]>
    Signed-off-by: Madhavan Srinivasan <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
ACPI: APEI: GHES: add TAINT_MACHINE_CHECK on GHES panic path [+ + +]
Author: Breno Leitao <[email protected]>
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 <[email protected]>
    Reviewed-by: Tony Luck <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ACPI: processor: fix acpi_object initialization [+ + +]
Author: Sebastian Ott <[email protected]>
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 <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ACPI: processor: idle: Check acpi_fetch_acpi_dev() return value [+ + +]
Author: Li Zhong <[email protected]>
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 <[email protected]>
    [ rjw: Subject and changelog edits, added empty line after if () ]
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    Signed-off-by: Teddy Astie <[email protected]>
    Signed-off-by: Yann Sionneau <[email protected]>
    Reported-by: Dillon C <[email protected]>
    Tested-by: Dillon C <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ACPI: processor: perflib: Fix initial _PPC limit application [+ + +]
Author: Jiayi Li <[email protected]>
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 <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    [ rjw: Consolidate pr-related checks in acpi_processor_ppc_init() ]
    [ rjw: Subject and changelog adjustments ]
    Cc: 5.4+ <[email protected]> # 5.4+: 2d8b39a62a5d ACPI: processor: Avoid NULL pointer dereferences at init time
    Cc: 5.4+ <[email protected]> # 5.4+: 3000ce3c52f8 cpufreq: Use per-policy frequency QoS
    Cc: 5.4+ <[email protected]> # 5.4+: a1bb46c36ce3 ACPI: processor: Add QoS requests for all CPUs
    Cc: 5.4+ <[email protected]> # 5.4+
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ACPI: processor: perflib: Move problematic pr->performance check [+ + +]
Author: Rafael J. Wysocki <[email protected]>
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 <[email protected]>
    Cc: 5.4+ <[email protected]> # 5.4+
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
act_mirred: use the backlog for nested calls to mirred ingress [+ + +]
Author: Davide Caratti <[email protected]>
Date:   Fri Jul 25 00:56:19 2025 +0530

    act_mirred: use the backlog for nested calls to mirred ingress
    
    [ Upstream commit ca22da2fbd693b54dc8e3b7b54ccc9f7e9ba3640 ]
    
    William reports kernel soft-lockups on some OVS topologies when TC mirred
    egress->ingress action is hit by local TCP traffic [1].
    The same can also be reproduced with SCTP (thanks Xin for verifying), when
    client and server reach themselves through mirred egress to ingress, and
    one of the two peers sends a "heartbeat" packet (from within a timer).
    
    Enqueueing to backlog proved to fix this soft lockup; however, as Cong
    noticed [2], we should preserve - when possible - the current mirred
    behavior that counts as "overlimits" any eventual packet drop subsequent to
    the mirred forwarding action [3]. A compromise solution might use the
    backlog only when tcf_mirred_act() has a nest level greater than one:
    change tcf_mirred_forward() accordingly.
    
    Also, add a kselftest that can reproduce the lockup and verifies TC mirred
    ability to account for further packet drops after TC mirred egress->ingress
    (when the nest level is 1).
    
     [1] https://lore.kernel.org/netdev/33dc43f587ec1388ba456b4915c75f02a8aae226.1663945716.git.dcaratti@redhat.com/
     [2] https://lore.kernel.org/netdev/Y0w%[email protected]/
     [3] such behavior is not guaranteed: for example, if RPS or skb RX
         timestamping is enabled on the mirred target device, the kernel
         can defer receiving the skb and return NET_RX_SUCCESS inside
         tcf_mirred_forward().
    
    Reported-by: William Zhao <[email protected]>
    CC: Xin Long <[email protected]>
    Signed-off-by: Davide Caratti <[email protected]>
    Reviewed-by: Marcelo Ricardo Leitner <[email protected]>
    Acked-by: Jamal Hadi Salim <[email protected]>
    Signed-off-by: Paolo Abeni <[email protected]>
    [ skulkarni: Adjusted patch for file 'tc_actions.sh' wrt the mainline commit ]
    Signed-off-by: Shubham Kulkarni <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
af_packet: fix soft lockup issue caused by tpacket_snd() [+ + +]
Author: Yun Lu <[email protected]>
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: [email protected]
    Suggested-by: LongJun Tang <[email protected]>
    Signed-off-by: Yun Lu <[email protected]>
    Reviewed-by: Willem de Bruijn <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

af_packet: fix the SO_SNDTIMEO constraint not effective on tpacked_snd() [+ + +]
Author: Yun Lu <[email protected]>
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: [email protected]
    Suggested-by: Eric Dumazet <[email protected]>
    Signed-off-by: Yun Lu <[email protected]>
    Reviewed-by: Eric Dumazet <[email protected]>
    Reviewed-by: Willem de Bruijn <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
alloc_fdtable(): change calling conventions. [+ + +]
Author: Al Viro <[email protected]>
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 <[email protected]>
    Signed-off-by: Al Viro <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ALSA: hda/ca0132: Fix buffer overflow in add_tuning_control [+ + +]
Author: Lucy Thrun <[email protected]>
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 <[email protected]>
    Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
    Signed-off-by: Lucy Thrun <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ALSA: hda: Add missing NVIDIA HDA codec IDs [+ + +]
Author: Daniel Dadap <[email protected]>
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 <[email protected]>
    Cc: <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    [ change patch_tegra234_hdmi function calls to patch_tegra_hdmi ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: intel8x0: Fix incorrect codec index usage in mixer for ICH4 [+ + +]
Author: Alok Tiwari <[email protected]>
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 <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ALSA: scarlett2: Add retry on -EPROTO from scarlett2_usb_tx() [+ + +]
Author: Geoffrey D. Bennett <[email protected]>
Date:   Wed Aug 13 10:44:47 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: [email protected]
    Signed-off-by: Geoffrey D. Bennett <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    [ Applied retry logic around snd_usb_ctl_msg() instead of scarlett2_usb_tx() ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: usb-audio: Avoid precedence issues in mixer_quirks macros [+ + +]
Author: Cristian Ciocaltea <[email protected]>
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 <[email protected]>
    Signed-off-by: Takashi Iwai <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

ALSA: usb-audio: Fix size validation in convert_chmap_v3() [+ + +]
Author: Dan Carpenter <[email protected]>
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 <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ALSA: usb-audio: Use correct sub-type for UAC3 feature unit validation [+ + +]
Author: Takashi Iwai <[email protected]>
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/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ALSA: usb-audio: Validate UAC3 cluster segment descriptors [+ + +]
Author: Takashi Iwai <[email protected]>
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 <[email protected]>
    Cc: <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: usb-audio: Validate UAC3 power domain descriptors, too [+ + +]
Author: Takashi Iwai <[email protected]>
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 <[email protected]>
    Cc: <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
arch: powerpc: defconfig: Drop obsolete CONFIG_NET_CLS_TCINDEX [+ + +]
Author: Johan Korsnes <[email protected]>
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 <[email protected]>
    Reviewed-by: Christophe Leroy <[email protected]>
    Signed-off-by: Madhavan Srinivasan <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
arm64: Handle KCOV __init vs inline mismatches [+ + +]
Author: Kees Cook <[email protected]>
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/[email protected]
    Signed-off-by: Kees Cook <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ARM: 9448/1: Use an absolute path to unified.h in KBUILD_AFLAGS [+ + +]
Author: Nathan Chancellor <[email protected]>
Date:   Mon Aug 11 16:51:46 2025 -0700

    ARM: 9448/1: Use an absolute path to unified.h in KBUILD_AFLAGS
    
    commit 87c4e1459e80bf65066f864c762ef4dc932fad4b upstream.
    
    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: [email protected]
    Fixes: d5c8d6e0fa61 ("kbuild: Update assembler calls to use proper flags and language target")
    Reported-by: KernelCI bot <[email protected]>
    Reviewed-by: Masahiro Yamada <[email protected]>
    Signed-off-by: Nathan Chancellor <[email protected]>
    Signed-off-by: Russell King (Oracle) <[email protected]>
    [nathan: Fix conflicts]
    Signed-off-by: Nathan Chancellor <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ARM: dts: imx6ul-kontron-bl-common: Fix RTS polarity for RS485 interface [+ + +]
Author: Annette Kobou <[email protected]>
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 <[email protected]>
    Signed-off-by: Frieder Schrempf <[email protected]>
    Fixes: 1ea4b76cdfde ("ARM: dts: imx6ul-kontron-n6310: Add Kontron i.MX6UL N6310 SoM and boards")
    Signed-off-by: Shawn Guo <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ARM: dts: vfxxx: Correctly use two tuples for timer address [+ + +]
Author: Krzysztof Kozlowski <[email protected]>
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 <[email protected]>
    Signed-off-by: Shawn Guo <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ARM: rockchip: fix kernel hang during smp initialization [+ + +]
Author: Alexander Kochetkov <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Heiko Stuebner <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ARM: tegra: Use I/O memcpy to write to IRAM [+ + +]
Author: Aaron Kling <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Thierry Reding <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ASoC: codecs: rt5640: Retry DEVICE_ID verification [+ + +]
Author: Xinxin Wan <[email protected]>
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 <[email protected]>
    Reviewed-by: Cezary Rojewski <[email protected]>
    Signed-off-by: Xinxin Wan <[email protected]>
    Signed-off-by: Cezary Rojewski <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ASoC: fsl_sai: Force a software reset when starting in consumer mode [+ + +]
Author: Arun Raghavan <[email protected]>
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 <[email protected]>
    Reported-by: Pieterjan Camerlynck <[email protected]>
    Fixes: 3e3f8bd56955 ("ASoC: fsl_sai: fix no frame clk in master mode")
    Cc: [email protected]
    Reviewed-by: Fabio Estevam <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ASoC: hdac_hdmi: Rate limit logging on connection and disconnection [+ + +]
Author: Mark Brown <[email protected]>
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 <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ASoC: Intel: fix SND_SOC_SOF dependencies [+ + +]
Author: Arnd Bergmann <[email protected]>
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 <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ASoC: ops: dynamically allocate struct snd_ctl_elem_value [+ + +]
Author: Arnd Bergmann <[email protected]>
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 <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ASoC: soc-dapm: set bias_level if snd_soc_dapm_set_bias_level() was successed [+ + +]
Author: Kuninori Morimoto <[email protected]>
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 <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ata: Fix SATA_MOBILE_LPM_POLICY description in Kconfig [+ + +]
Author: Damien Le Moal <[email protected]>
Date:   Thu Aug 21 14:26:54 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: [email protected]
    Signed-off-by: Damien Le Moal <[email protected]>
    Reviewed-by: Hannes Reinecke <[email protected]>
    Reviewed-by: Niklas Cassel <[email protected]>
    [ Adjust context ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ata: libata-scsi: Fix ata_to_sense_error() status handling [+ + +]
Author: Damien Le Moal <[email protected]>
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 <[email protected]>
    Reported-by: Brandon Schwartz <[email protected]>
    Fixes: 8ae720449fca ("libata: whitespace fixes in ata_to_sense_error()")
    Cc: [email protected]
    Signed-off-by: Damien Le Moal <[email protected]>
    Reviewed-by: Hannes Reinecke <[email protected]>
    Reviewed-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
be2net: Use correct byte order and format string for TCP seq and ack_seq [+ + +]
Author: Alok Tiwari <[email protected]>
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 <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
benet: fix BUG when creating VFs [+ + +]
Author: Michal Schmidt <[email protected]>
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 <[email protected]>
    Reviewed-by: Nikolay Aleksandrov <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
Bluetooth: Fix null-ptr-deref in l2cap_sock_resume_cb() [+ + +]
Author: Kuniyuki Iwashima <[email protected]>
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: [email protected]
    Closes: https://lore.kernel.org/all/[email protected]/
    Signed-off-by: Kuniyuki Iwashima <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: fix use-after-free in device_for_each_child() [+ + +]
Author: Dmitry Antipov <[email protected]>
Date:   Fri Nov 1 14:44:10 2024 +0300

    Bluetooth: fix use-after-free in device_for_each_child()
    
    commit 27aabf27fd014ae037cc179c61b0bee7cff55b3d upstream.
    
    Syzbot has reported the following KASAN splat:
    
    BUG: KASAN: slab-use-after-free in device_for_each_child+0x18f/0x1a0
    Read of size 8 at addr ffff88801f605308 by task kbnepd bnep0/4980
    
    CPU: 0 UID: 0 PID: 4980 Comm: kbnepd bnep0 Not tainted 6.12.0-rc4-00161-gae90f6a6170d #1
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-2.fc40 04/01/2014
    Call Trace:
     <TASK>
     dump_stack_lvl+0x100/0x190
     ? device_for_each_child+0x18f/0x1a0
     print_report+0x13a/0x4cb
     ? __virt_addr_valid+0x5e/0x590
     ? __phys_addr+0xc6/0x150
     ? device_for_each_child+0x18f/0x1a0
     kasan_report+0xda/0x110
     ? device_for_each_child+0x18f/0x1a0
     ? __pfx_dev_memalloc_noio+0x10/0x10
     device_for_each_child+0x18f/0x1a0
     ? __pfx_device_for_each_child+0x10/0x10
     pm_runtime_set_memalloc_noio+0xf2/0x180
     netdev_unregister_kobject+0x1ed/0x270
     unregister_netdevice_many_notify+0x123c/0x1d80
     ? __mutex_trylock_common+0xde/0x250
     ? __pfx_unregister_netdevice_many_notify+0x10/0x10
     ? trace_contention_end+0xe6/0x140
     ? __mutex_lock+0x4e7/0x8f0
     ? __pfx_lock_acquire.part.0+0x10/0x10
     ? rcu_is_watching+0x12/0xc0
     ? unregister_netdev+0x12/0x30
     unregister_netdevice_queue+0x30d/0x3f0
     ? __pfx_unregister_netdevice_queue+0x10/0x10
     ? __pfx_down_write+0x10/0x10
     unregister_netdev+0x1c/0x30
     bnep_session+0x1fb3/0x2ab0
     ? __pfx_bnep_session+0x10/0x10
     ? __pfx_lock_release+0x10/0x10
     ? __pfx_woken_wake_function+0x10/0x10
     ? __kthread_parkme+0x132/0x200
     ? __pfx_bnep_session+0x10/0x10
     ? kthread+0x13a/0x370
     ? __pfx_bnep_session+0x10/0x10
     kthread+0x2b7/0x370
     ? __pfx_kthread+0x10/0x10
     ret_from_fork+0x48/0x80
     ? __pfx_kthread+0x10/0x10
     ret_from_fork_asm+0x1a/0x30
     </TASK>
    
    Allocated by task 4974:
     kasan_save_stack+0x30/0x50
     kasan_save_track+0x14/0x30
     __kasan_kmalloc+0xaa/0xb0
     __kmalloc_noprof+0x1d1/0x440
     hci_alloc_dev_priv+0x1d/0x2820
     __vhci_create_device+0xef/0x7d0
     vhci_write+0x2c7/0x480
     vfs_write+0x6a0/0xfc0
     ksys_write+0x12f/0x260
     do_syscall_64+0xc7/0x250
     entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
    Freed by task 4979:
     kasan_save_stack+0x30/0x50
     kasan_save_track+0x14/0x30
     kasan_save_free_info+0x3b/0x60
     __kasan_slab_free+0x4f/0x70
     kfree+0x141/0x490
     hci_release_dev+0x4d9/0x600
     bt_host_release+0x6a/0xb0
     device_release+0xa4/0x240
     kobject_put+0x1ec/0x5a0
     put_device+0x1f/0x30
     vhci_release+0x81/0xf0
     __fput+0x3f6/0xb30
     task_work_run+0x151/0x250
     do_exit+0xa79/0x2c30
     do_group_exit+0xd5/0x2a0
     get_signal+0x1fcd/0x2210
     arch_do_signal_or_restart+0x93/0x780
     syscall_exit_to_user_mode+0x140/0x290
     do_syscall_64+0xd4/0x250
     entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
    In 'hci_conn_del_sysfs()', 'device_unregister()' may be called when
    an underlying (kobject) reference counter is greater than 1. This
    means that reparenting (happened when the device is actually freed)
    is delayed and, during that delay, parent controller device (hciX)
    may be deleted. Since the latter may create a dangling pointer to
    freed parent, avoid that scenario by reparenting to NULL explicitly.
    
    Reported-by: [email protected]
    Tested-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=6cf5652d3df49fae2e3f
    Fixes: a85fb91e3d72 ("Bluetooth: Fix double free in hci_conn_cleanup")
    Signed-off-by: Dmitry Antipov <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    [ chanho: Backported from v5.10.y to v5.4.y. device_find_any_child() is not
    supported in v5.4.y, so changed to use device_find_child() with __match_any ]
    Signed-off-by: Chanho Min <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

Bluetooth: L2CAP: Fix attempting to adjust outgoing MTU [+ + +]
Author: Luiz Augusto von Dentz <[email protected]>
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 <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: SMP: Fix using HCI_ERROR_REMOTE_USER_TERM on timeout [+ + +]
Author: Luiz Augusto von Dentz <[email protected]>
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 <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: SMP: If an unallowed command is received consider it a failure [+ + +]
Author: Luiz Augusto von Dentz <[email protected]>
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 <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
bpf, ktls: Fix data corruption when using bpf_msg_pop_data() in ktls [+ + +]
Author: Jiayuan Chen <[email protected]>
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 <[email protected]>
    Signed-off-by: Jiayuan Chen <[email protected]>
    Signed-off-by: Daniel Borkmann <[email protected]>
    Reviewed-by: John Fastabend <[email protected]>
    Acked-by: Jakub Kicinski <[email protected]>
    Link: https://lore.kernel.org/bpf/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
bpf: Check flow_dissector ctx accesses are aligned [+ + +]
Author: Paul Chaignon <[email protected]>
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: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=ccac90e482b2a81d74aa
    Signed-off-by: Paul Chaignon <[email protected]>
    Acked-by: Yonghong Song <[email protected]>
    Acked-by: Eduard Zingerman <[email protected]>
    Link: https://lore.kernel.org/r/cc1b036be484c99be45eddf48bd78cc6f72839b1.1754039605.git.paul.chaignon@gmail.com
    Signed-off-by: Alexei Starovoitov <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
bpftool: Fix memory leak in dump_xx_nlmsg on realloc failure [+ + +]
Author: Yuan Chen <[email protected]>
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 <[email protected]>
    Reviewed-by: Quentin Monnet <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Alexei Starovoitov <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
btrfs: fix log tree replay failure due to file with 0 links and extents [+ + +]
Author: Filipe Manana <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/linux-btrfs/[email protected]/
    Reported-by: burneddi <[email protected]>
    Link: https://lore.kernel.org/linux-btrfs/lh4W-Lwc0Mbk-QvBhhQyZxf6VbM3E8VtIvU3fPIQgweP_Q1n7wtlUZQc33sYlCKYd-o6rryJQfhHaNAOWWRKxpAXhM8NZPojzsJPyHMf2qY=@protonmail.com/#t
    Reported-by: Russell Haley <[email protected]>
    Link: https://lore.kernel.org/linux-btrfs/[email protected]/
    Fixes: f2d72f42d5fa ("Btrfs: fix warning when replaying log after fsync of a tmpfile")
    CC: [email protected] # 5.4+
    Reviewed-by: Boris Burkov <[email protected]>
    Signed-off-by: Filipe Manana <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

btrfs: populate otime when logging an inode item [+ + +]
Author: Qu Wenruo <[email protected]>
Date:   Tue Aug 19 10:57:54 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: [email protected]
    Reviewed-by: Filipe Manana <[email protected]>
    Signed-off-by: Qu Wenruo <[email protected]>
    Reviewed-by: David Sterba <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    [ adapted token-based API and timespec64 field structure ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
caif: reduce stack size, again [+ + +]
Author: Arnd Bergmann <[email protected]>
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 <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
can: kvaser_pciefd: Store device channel index [+ + +]
Author: Jimmy Assarsson <[email protected]>
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 <[email protected]>
    Signed-off-by: Jimmy Assarsson <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

can: kvaser_usb: Assign netdev.dev_port based on device channel index [+ + +]
Author: Jimmy Assarsson <[email protected]>
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 <[email protected]>
    Signed-off-by: Jimmy Assarsson <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
cdc-acm: fix race between initial clearing halt and open [+ + +]
Author: Oliver Neukum <[email protected]>
Date:   Mon Aug 18 19:13:58 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 <[email protected]>
    Signed-off-by: Oliver Neukum <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
cifs: Fix calling CIFSFindFirst() for root path without msearch [+ + +]
Author: Pali Rohár <[email protected]>
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 <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

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

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

 
clk: davinci: Add NULL check in davinci_lpsc_clk_register() [+ + +]
Author: Henry Martin <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: David Lechner <[email protected]>
    Signed-off-by: Stephen Boyd <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

clk: sunxi-ng: v3s: Fix de clock definition [+ + +]
Author: Paul Kocialkowski <[email protected]>
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 <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Chen-Yu Tsai <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
codel: remove sch->q.qlen check before qdisc_tree_reduce_backlog() [+ + +]
Author: Cong Wang <[email protected]>
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 <[email protected]>
    Fixes: 4b549a2ef4be ("fq_codel: Fair Queue Codel AQM")
    Fixes: 76e3cc126bb2 ("codel: Controlled Delay AQM")
    Signed-off-by: Cong Wang <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Acked-by: Jamal Hadi Salim <[email protected]>
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Siddh Raman Pant <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
comedi: aio_iiro_16: Fix bit shift out of bounds [+ + +]
Author: Ian Abbott <[email protected]>
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: [email protected] # 5.13+
    Signed-off-by: Ian Abbott <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

comedi: comedi_test: Fix possible deletion of uninitialized timers [+ + +]
Author: Ian Abbott <[email protected]>
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: [email protected] # 6.15+
    Signed-off-by: Ian Abbott <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    [ file location from drivers/comedi to drivers/staging/comedi and timer_delete_sync() to del_timer_sync(). ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

comedi: das16m1: Fix bit shift out of bounds [+ + +]
Author: Ian Abbott <[email protected]>
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: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=c52293513298e0fd9a94
    Fixes: 729988507680 ("staging: comedi: das16m1: tidy up the irq support in das16m1_attach()")
    Tested-by: [email protected]
    Suggested-by: "Enju, Kohei" <[email protected]>
    Cc: [email protected] # 5.13+
    Signed-off-by: Ian Abbott <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

comedi: das6402: Fix bit shift out of bounds [+ + +]
Author: Ian Abbott <[email protected]>
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: [email protected] # 5.13+
    Signed-off-by: Ian Abbott <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

comedi: Fail COMEDI_INSNLIST ioctl if n_insns is too large [+ + +]
Author: Ian Abbott <[email protected]>
Date:   Mon Jul 28 13:18:20 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: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=d6995b62e5ac7d79557a
    Fixes: ed9eccbe8970 ("Staging: add comedi core")
    Tested-by: Ian Abbott <[email protected]>
    Cc: [email protected] # 5.13+
    Signed-off-by: Ian Abbott <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    [ Reworked for before commit bac42fb21259 ("comedi: get rid of compat_alloc_user_space() mess in COMEDI_CMD{,TEST} compat") ]
    Signed-off-by: Ian Abbott <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

comedi: Fix initialization of data for instructions that write to subdevice [+ + +]
Author: Ian Abbott <[email protected]>
Date:   Mon Jul 28 13:21:56 2025 +0100

    comedi: Fix initialization of data for instructions that write to subdevice
    
    [ Upstream commit 46d8c744136ce2454aa4c35c138cc06817f92b8e ]
    
    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: [email protected] # 5.13+
    Signed-off-by: Ian Abbott <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    [ Reworked for before commit bac42fb21259 ("comedi: get rid of compat_alloc_user_space() mess in COMEDI_CMD{,TEST} compat") ]
    Signed-off-by: Ian Abbott <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

comedi: fix race between polling and detaching [+ + +]
Author: Ian Abbott <[email protected]>
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 <[email protected]>
    Fixes: 2f3fdcd7ce93 ("staging: comedi: add rw_semaphore to protect against device detachment")
    Link: https://lore.kernel.org/all/[email protected]/
    Reported-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=01523a0ae5600aef5895
    Co-developed-by: Jens Axboe <[email protected]>
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Ian Abbott <[email protected]>
    Tested-by: Jens Axboe <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

comedi: Fix some signed shift left operations [+ + +]
Author: Ian Abbott <[email protected]>
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: [email protected] # 5.13+
    Signed-off-by: Ian Abbott <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

comedi: Fix use of uninitialized data in insn_rw_emulate_bits() [+ + +]
Author: Ian Abbott <[email protected]>
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: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=cb96ec476fb4914445c9
    Fixes: ed9eccbe8970 ("Staging: add comedi core")
    Cc: [email protected] # 5.13+
    Signed-off-by: Ian Abbott <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

comedi: pcl812: Fix bit shift out of bounds [+ + +]
Author: Ian Abbott <[email protected]>
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: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=32de323b0addb9e114ff
    Fixes: fcdb427bc7cf ("Staging: comedi: add pcl821 driver")
    Cc: [email protected] # 5.13+
    Signed-off-by: Ian Abbott <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
cpufreq: armada-8k: Fix off by one in armada_8k_cpufreq_free_table() [+ + +]
Author: Dan Carpenter <[email protected]>
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: [email protected]
    Fixes: f525a670533d ("cpufreq: ap806: add cpufreq driver for Armada 8K")
    Signed-off-by: Dan Carpenter <[email protected]>
    Signed-off-by: Viresh Kumar <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

cpufreq: Exit governor when failed to start old governor [+ + +]
Author: Lifeng Zheng <[email protected]>
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 <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

cpufreq: Init policy->rwsem before it may be possibly used [+ + +]
Author: Lifeng Zheng <[email protected]>
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 <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
crypto: ccp - Fix crash when rebind ccp device for ccp.ko [+ + +]
Author: Mengbiao Xiong <[email protected]>
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 <[email protected]>
    Reviewed-by: Tom Lendacky <[email protected]>
    Signed-off-by: Herbert Xu <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

crypto: img-hash - Fix dma_unmap_sg() nents value [+ + +]
Author: Thomas Fourier <[email protected]>
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 <[email protected]>
    Signed-off-by: Herbert Xu <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

crypto: marvell/cesa - Fix engine load inaccuracy [+ + +]
Author: Herbert Xu <[email protected]>
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 <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

crypto: qat - fix seq_file position update in adf_ring_next() [+ + +]
Author: Giovanni Cabiddu <[email protected]>
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 <[email protected]>
    Reviewed-by: Ahsan Atta <[email protected]>
    Signed-off-by: Herbert Xu <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
dmaengine: mv_xor: Fix missing check after DMA map and missing unmap [+ + +]
Author: Thomas Fourier <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Vinod Koul <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

dmaengine: nbpfaxi: Add missing check after DMA map [+ + +]
Author: Thomas Fourier <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Vinod Koul <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

dmaengine: nbpfaxi: Fix memory corruption in probe() [+ + +]
Author: Dan Carpenter <[email protected]>
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: [email protected]
    Fixes: b45b262cefd5 ("dmaengine: add a driver for AMBA AXI NBPF DMAC IP cores")
    Signed-off-by: Dan Carpenter <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Vinod Koul <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
Documentation: ACPI: Fix parent device references [+ + +]
Author: Andy Shevchenko <[email protected]>
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 <[email protected]>
    Cc: All applicable <[email protected]>
    Signed-off-by: Andy Shevchenko <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drbd: add missing kref_get in handle_write_conflicts [+ + +]
Author: Sarah Newman <[email protected]>
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 <[email protected]>
    Signed-off-by: Lars Ellenberg <[email protected]>
    Signed-off-by: Christoph Böhmwalder <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/amd/display: Find first CRTC and its line time in dce110_fill_display_configs [+ + +]
Author: Timur Kristóf <[email protected]>
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 <[email protected]>
    Acked-by: Alex Deucher <[email protected]>
    Reviewed-by: Rodrigo Siqueira <[email protected]>
    Reviewed-by: Alex Hung <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    (cherry picked from commit 4ab09785f8d5d03df052827af073d5c508ff5f63)
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/amd/display: Fix fractional fb divider in set_pixel_clock_v3 [+ + +]
Author: Timur Kristóf <[email protected]>
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 <[email protected]>
    Acked-by: Alex Deucher <[email protected]>
    Reviewed-by: Rodrigo Siqueira <[email protected]>
    Reviewed-by: Alex Hung <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    (cherry picked from commit 027e7acc7e17802ebf28e1edb88a404836ad50d6)
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/amd/pm/powerplay/hwmgr/smu_helper: fix order of mask and value [+ + +]
Author: Fedor Pchelkin <[email protected]>
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 <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/amdgpu: fix incorrect vm flags to map bo [+ + +]
Author: Jack Xiao <[email protected]>
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 <[email protected]>
    Reviewed-by: Likun Gao <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    (cherry picked from commit b08425fa77ad2f305fe57a33dceb456be03b653f)
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/dp: Change AUX DPCD probe address from DPCD_REV to LANE0_1_STATUS [+ + +]
Author: Imre Deak <[email protected]>
Date:   Sat Aug 23 10:44:36 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: <[email protected]>
    Cc: Ville Syrjälä <[email protected]>
    Cc: Jani Nikula <[email protected]>
    Acked-by: Jani Nikula <[email protected]>
    Signed-off-by: Imre Deak <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    [ Call to drm_dp_dpcd_access() instead of drm_dp_dpcd_probe() ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/sched: Remove optimization that causes hang when killing dependent jobs [+ + +]
Author: Lin.Cao <[email protected]>
Date:   Tue Jul 29 13:14:55 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: [email protected] # v4.6+
    Signed-off-by: Lin.Cao <[email protected]>
    Reviewed-by: Christian König <[email protected]>
    Signed-off-by: Philipp Stanner <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    [ adjusted context ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
et131x: Add missing check after DMA map [+ + +]
Author: Thomas Fourier <[email protected]>
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 <[email protected]>
    Acked-by: Mark Einon <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ethernet: intel: fix building with large NR_CPUS [+ + +]
Author: Arnd Bergmann <[email protected]>
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 <[email protected]>
    Acked-by: David S. Miller <[email protected]>
    Reviewed-by: Aleksandr Loktionov <[email protected]>
    Reviewed-by: Alexander Lobakin <[email protected]>
    Tested-by: Sunitha Mekala <[email protected]> (A Contingent worker at Intel)
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ext4: check fast symlink for ea_inode correctly [+ + +]
Author: Andreas Dilger <[email protected]>
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: [email protected]
    Fixes: fc82228a5e38 ("ext4: support fast symlinks from ext3 file systems")
    Signed-off-by: Andreas Dilger <[email protected]>
    Reviewed-by: Li Dongyang <[email protected]>
    Reviewed-by: Alex Zhuravlev <[email protected]>
    Reviewed-by: Oleg Drokin <[email protected]>
    Reviewed-on: https://review.whamcloud.com/59879
    Lustre-bug-id: https://jira.whamcloud.com/browse/LU-19121
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ext4: do not BUG when INLINE_DATA_FL lacks system.data xattr [+ + +]
Author: Theodore Ts'o <[email protected]>
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: [email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ext4: fix fsmap end of range reporting with bigalloc [+ + +]
Author: Ojaswin Mujoo <[email protected]>
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: [email protected]
    Reported-by: Disha Goel <[email protected]>
    Fixes: 4a622e4d477b ("ext4: fix FS_IOC_GETFSMAP handling")
    Signed-off-by: Ojaswin Mujoo <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Link: https://patch.msgid.link/e7472c8535c9c5ec10f425f495366864ea12c9da.1754377641.git.ojaswin@linux.ibm.com
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ext4: fix reserved gdt blocks handling in fsmap [+ + +]
Author: Ojaswin Mujoo <[email protected]>
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: [email protected]
    Fixes: 0c9ec4beecac ("ext4: support GETFSMAP ioctls")
    Signed-off-by: Ojaswin Mujoo <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Link: https://patch.msgid.link/08781b796453a5770112aa96ad14c864fbf31935.1754377641.git.ojaswin@linux.ibm.com
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
f2fs: fix to avoid out-of-boundary access in devs.path [+ + +]
Author: Chao Yu <[email protected]>
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 <[email protected]>
    Signed-off-by: Jaegeuk Kim <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

f2fs: fix to avoid out-of-boundary access in dnode page [+ + +]
Author: Chao Yu <[email protected]>
Date:   Sat Aug 23 00:23:11 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: [email protected]
    Reported-by: Jiaming Zhang <[email protected]>
    Closes: https://groups.google.com/g/syzkaller/c/-ZnaaOOfO3M
    Signed-off-by: Chao Yu <[email protected]>
    Signed-off-by: Jaegeuk Kim <[email protected]>
    [ replaced f2fs_err_ratelimited() with f2fs_err() ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

f2fs: fix to avoid panic in f2fs_evict_inode [+ + +]
Author: Chao Yu <[email protected]>
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/[email protected]
    
    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 <[email protected]>
    Signed-off-by: Jaegeuk Kim <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

f2fs: fix to avoid UAF in f2fs_sync_inode_meta() [+ + +]
Author: Chao Yu <[email protected]>
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 <[email protected]>
    Signed-off-by: Jaegeuk Kim <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

f2fs: fix to do sanity check on ino and xnid [+ + +]
Author: Chao Yu <[email protected]>
Date:   Thu Jul 24 13:50:53 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: [email protected]
    Reported-by: [email protected]
    Closes: https://lore.kernel.org/linux-f2fs-devel/[email protected]
    Signed-off-by: Chao Yu <[email protected]>
    Signed-off-by: Jaegeuk Kim <[email protected]>
    [ add set_sbi_flag(sbi, SBI_NEED_FSCK) to match error handling pattern ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
fbdev: imxfb: Check fb_add_videomode to prevent null-ptr-deref [+ + +]
Author: Chenyuan Yang <[email protected]>
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 <[email protected]>
    Signed-off-by: Helge Deller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
fpga: zynq_fpga: Fix the wrong usage of dma_map_sgtable() [+ + +]
Author: Xu Yilun <[email protected]>
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 <[email protected]>
    Closes: https://lore.kernel.org/linux-fpga/[email protected]/
    Reviewed-by: Jason Gunthorpe <[email protected]>
    Reviewed-by: Marek Szyprowski <[email protected]>
    Signed-off-by: Xu Yilun <[email protected]>
    Tested-by: Pavel Pisa <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
fs/buffer: fix use-after-free when call bh_read() helper [+ + +]
Author: Ye Bin <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/[email protected]
    Reviewed-by: Matthew Wilcox (Oracle) <[email protected]>
    Signed-off-by: Christian Brauner <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
fs/orangefs: Allow 2 more characters in do_c_string() [+ + +]
Author: Dan Carpenter <[email protected]>
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 <[email protected]>
    Signed-off-by: Mike Marshall <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

fs/orangefs: use snprintf() instead of sprintf() [+ + +]
Author: Amir Mohammad Jahangirzad <[email protected]>
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 <[email protected]>
    Signed-off-by: Mike Marshall <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
fs: Prevent file descriptor table allocations exceeding INT_MAX [+ + +]
Author: Sasha Levin <[email protected]>
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: [email protected]
    Signed-off-by: Sasha Levin <[email protected]>
    Link: https://lore.kernel.org/[email protected]
    Signed-off-by: Christian Brauner <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ftrace: Also allocate and copy hash for reading of filter files [+ + +]
Author: Steven Rostedt <[email protected]>
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: [email protected]
    Cc: Masami Hiramatsu <[email protected]>
    Cc: Mathieu Desnoyers <[email protected]>
    Cc: Nathan Chancellor <[email protected]>
    Cc: Linus Torvalds <[email protected]>
    Link: https://lore.kernel.org/[email protected]
    Fixes: c20489dad156 ("ftrace: Assign iter->hash to filter or notrace hashes on seq read")
    Closes: https://lore.kernel.org/all/[email protected]/
    Closes: https://lore.kernel.org/all/20250822192437.GA458494@ax162/
    Reported-by: Tengda Wu <[email protected]>
    Tested-by: Tengda Wu <[email protected]>
    Tested-by: Nathan Chancellor <[email protected]>
    Signed-off-by: Steven Rostedt (Google) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
gpio: tps65912: check the return value of regmap_update_bits() [+ + +]
Author: Bartosz Golaszewski <[email protected]>
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 <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
hfs: fix not erasing deleted b-tree node issue [+ + +]
Author: Viacheslav Dubeyko <[email protected]>
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 <[email protected]>
    Reviewed-by: Johannes Thumshirn <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Viacheslav Dubeyko <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

hfs: fix slab-out-of-bounds in hfs_bnode_read() [+ + +]
Author: Viacheslav Dubeyko <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Viacheslav Dubeyko <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
hfsplus: don't use BUG_ON() in hfsplus_create_attributes_file() [+ + +]
Author: Tetsuo Handa <[email protected]>
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 <[email protected]>
    Closes: https://syzkaller.appspot.com/bug?extid=1107451c16b9eb9d29e6
    Signed-off-by: Tetsuo Handa <[email protected]>
    Reviewed-by: Viacheslav Dubeyko <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Viacheslav Dubeyko <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

hfsplus: fix slab-out-of-bounds in hfsplus_bnode_read() [+ + +]
Author: Viacheslav Dubeyko <[email protected]>
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 <[email protected]>
    Reported-by: Jiaji Qin <[email protected]>
    Reported-by: Shuoran Bai <[email protected]>
    Signed-off-by: Viacheslav Dubeyko <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Viacheslav Dubeyko <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

hfsplus: fix slab-out-of-bounds read in hfsplus_uni2asc() [+ + +]
Author: Viacheslav Dubeyko <[email protected]>
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 <[email protected]>
    Signed-off-by: Liu Shixin <[email protected]>
    Signed-off-by: Viacheslav Dubeyko <[email protected]>
    cc: John Paul Adrian Glaubitz <[email protected]>
    cc: Yangtao Li <[email protected]>
    cc: [email protected]
    Reviewed-by: Yangtao Li <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Viacheslav Dubeyko <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

hfsplus: remove mutex_lock check in hfsplus_free_extents [+ + +]
Author: Yangtao Li <[email protected]>
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: [email protected]
    Closes: https://lore.kernel.org/all/[email protected]/
    Signed-off-by: Yangtao Li <[email protected]>
    Reviewed-by: Viacheslav Dubeyko <[email protected]>
    Signed-off-by: Viacheslav Dubeyko <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Viacheslav Dubeyko <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
HID: core: do not bypass hid_hw_raw_request [+ + +]
Author: Benjamin Tissoires <[email protected]>
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 <[email protected]>
    Closes: https://lore.kernel.org/linux-input/[email protected]/
    Cc: [email protected]
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Benjamin Tissoires <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

HID: core: ensure __hid_request reserves the report ID as the first byte [+ + +]
Author: Benjamin Tissoires <[email protected]>
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 <[email protected]>
    Closes: https://lore.kernel.org/linux-input/[email protected]/
    Reported-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=8258d5439c49d4c35f43
    Tested-by: [email protected]
    Fixes: 4fa5a7f76cc7 ("HID: core: implement generic .request()")
    Cc: [email protected]
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Benjamin Tissoires <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

HID: core: ensure the allocated report buffer can contain the reserved report ID [+ + +]
Author: Benjamin Tissoires <[email protected]>
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 <[email protected]>
    Closes: https://lore.kernel.org/linux-input/[email protected]/
    Cc: [email protected]
    Suggested-by: Alan Stern <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Benjamin Tissoires <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
hwrng: mtk - handle devm_pm_runtime_enable errors [+ + +]
Author: Ovidiu Panait <[email protected]>
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 <[email protected]>
    Signed-off-by: Herbert Xu <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
i2c: qup: jump out of the loop in case of timeout [+ + +]
Author: Yang Xiwen <[email protected]>
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 <[email protected]>
    Cc: <[email protected]> # v4.17+
    Signed-off-by: Andi Shyti <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

i2c: stm32: fix the device used for the DMA map [+ + +]
Author: Clément Le Goffic <[email protected]>
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 <[email protected]>
    Cc: <[email protected]> # v4.18+
    Acked-by: Alain Volmat <[email protected]>
    Signed-off-by: Andi Shyti <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
i3c: add missing include to internal header [+ + +]
Author: Wolfram Sang <[email protected]>
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 <[email protected]>
    Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
    Signed-off-by: Wolfram Sang <[email protected]>
    Reviewed-by: Frank Li <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Alexandre Belloni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

i3c: don't fail if GETHDRCAP is unsupported [+ + +]
Author: Wolfram Sang <[email protected]>
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 <[email protected]>
    Reviewed-by: Frank Li <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Alexandre Belloni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ice: Fix a null pointer dereference in ice_copy_and_init_pkg() [+ + +]
Author: Haoxiang Li <[email protected]>
Date:   Tue Jul 29 15:31:23 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: [email protected]
    Signed-off-by: Haoxiang Li <[email protected]>
    Reviewed-by: Michal Swiatkowski <[email protected]>
    Reviewed-by: Aleksandr Loktionov <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Tested-by: Rinitha S <[email protected]> (A Contingent worker at Intel)
    Signed-off-by: Tony Nguyen <[email protected]>
    [ applied the patch to ice_flex_pipe.c instead of ice_ddp.c ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
iio: adc: max1363: Fix MAX1363_4X_CHANS/MAX1363_8X_CHANS[] [+ + +]
Author: Fabio Estevam <[email protected]>
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: [email protected]
    Suggested-by: Jonathan Cameron <[email protected]>
    Signed-off-by: Fabio Estevam <[email protected]>
    Acked-by: Matti Vaittinen <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jonathan Cameron <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

iio: adc: max1363: Reorder mode_list[] entries [+ + +]
Author: Fabio Estevam <[email protected]>
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: [email protected]
    Signed-off-by: Fabio Estevam <[email protected]>
    Acked-by: Matti Vaittinen <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jonathan Cameron <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

iio: adc: stm32-adc: Fix race in installing chained IRQ handler [+ + +]
Author: Chen Ni <[email protected]>
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 <[email protected]>
    Reviewed-by: Nuno Sá <[email protected]>
    Tested-by: Fabrice Gasnier <[email protected]>
    Reviewed-by: Fabrice Gasnier <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Cc: <[email protected]>
    Signed-off-by: Jonathan Cameron <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

iio: hid-sensor-prox: Fix incorrect OFFSET calculation [+ + +]
Author: Zhang Lixu <[email protected]>
Date:   Thu Jul 24 12:33:27 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: [email protected]
    Fixes: 39a3a0138f61 ("iio: hid-sensors: Added Proximity Sensor Driver")
    Signed-off-by: Zhang Lixu <[email protected]>
    Acked-by: Srinivas Pandruvada <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jonathan Cameron <[email protected]>
    [ adapted prox_attr array access to single structure member access ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

iio: proximity: isl29501: fix buffered read on big-endian systems [+ + +]
Author: David Lechner <[email protected]>
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 <[email protected]>
    Link: https://patch.msgid.link/20250722-iio-use-more-iio_declare_buffer_with_ts-7-v2-1-d3ebeb001ed3@baylibre.com
    Cc: <[email protected]>
    Signed-off-by: Jonathan Cameron <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
Input: xpad - set correct controller type for Acer NGR200 [+ + +]
Author: Nilton Perim Neto <[email protected]>
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 <[email protected]>
    Signed-off-by: Nilton Perim Neto <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Fixes: 22c69d786ef8 ("Input: xpad - support Acer NGR 200 Controller")
    Cc: [email protected]
    Signed-off-by: Dmitry Torokhov <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
io_uring: don't use int for ABI [+ + +]
Author: Pavel Begunkov <[email protected]>
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: [email protected]
    Fixes: 2b188cc1bb857 ("Add io_uring IO interface")
    Signed-off-by: Pavel Begunkov <[email protected]>
    Link: https://lore.kernel.org/r/47c666c4ee1df2018863af3a2028af18feef11ed.1751412511.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ipmi: Fix strcpy source and destination the same [+ + +]
Author: Corey Minyard <[email protected]>
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 <[email protected]>
    Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
    Signed-off-by: Corey Minyard <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ipmi: Use dev_warn_ratelimited() for incorrect message warnings [+ + +]
Author: Breno Leitao <[email protected]>
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 <[email protected]>
    Message-ID: <[email protected]>
    Signed-off-by: Corey Minyard <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ipv6: reject malicious packets in ipv6_gso_segment() [+ + +]
Author: Eric Dumazet <[email protected]>
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: [email protected]
    Closes: https://lore.kernel.org/netdev/[email protected]/T/#u
    Signed-off-by: Eric Dumazet <[email protected]>
    Reviewed-by: Dawid Osuchowski <[email protected]>
    Reviewed-by: Willem de Bruijn <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ipv6: sr: validate HMAC algorithm ID in seg6_hmac_info_add [+ + +]
Author: Minhong He <[email protected]>
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 <[email protected]>
    Reviewed-by: Kuniyuki Iwashima <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
isofs: Verify inode mode when loading from disk [+ + +]
Author: Jan Kara <[email protected]>
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: [email protected]
    CC: [email protected]
    Signed-off-by: Jan Kara <[email protected]>
    Link: https://lore.kernel.org/[email protected]
    Acked-by: Christian Brauner <[email protected]>
    Signed-off-by: Christian Brauner <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
iwlwifi: Add missing check for alloc_ordered_workqueue [+ + +]
Author: Jiasheng Jiang <[email protected]>
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 <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Miri Korenblit <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ixgbe: xsk: resolve the negative overflow of budget in ixgbe_xmit_zc [+ + +]
Author: Jason Xing <[email protected]>
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 <[email protected]>
    Reviewed-by: Larysa Zaremba <[email protected]>
    Reviewed-by: Paul Menzel <[email protected]>
    Reviewed-by: Aleksandr Loktionov <[email protected]>
    Tested-by: Priya Singh <[email protected]>
    Signed-off-by: Tony Nguyen <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
jbd2: prevent softlockup in jbd2_log_do_checkpoint() [+ + +]
Author: Baokun Li <[email protected]>
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: [email protected]
    Signed-off-by: Baokun Li <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
jfs: fix metapage reference count leak in dbAllocCtl [+ + +]
Author: Zheng Yu <[email protected]>
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 <[email protected]>
    Signed-off-by: Dave Kleikamp <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

jfs: Regular file corruption check [+ + +]
Author: Edward Adam Davis <[email protected]>
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: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=630f6d40b3ccabc8e96e
    Tested-by: [email protected]
    Signed-off-by: Edward Adam Davis <[email protected]>
    Signed-off-by: Dave Kleikamp <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

jfs: truncate good inode pages when hard link is 0 [+ + +]
Author: Lizhi Xu <[email protected]>
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: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=6e516bb515d93230bc7b
    Signed-off-by: Lizhi Xu <[email protected]>
    Signed-off-by: Dave Kleikamp <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

jfs: upper bound check of tree index in dbAllocAG [+ + +]
Author: Arnaud Lecomte <[email protected]>
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: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=cffd18309153948f3c3e
    Tested-by: [email protected]
    Signed-off-by: Arnaud Lecomte <[email protected]>
    Signed-off-by: Dave Kleikamp <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
kbuild: add $(CLANG_FLAGS) to KBUILD_CPPFLAGS [+ + +]
Author: Masahiro Yamada <[email protected]>
Date:   Mon Aug 11 16:51:50 2025 -0700

    kbuild: add $(CLANG_FLAGS) to KBUILD_CPPFLAGS
    
    commit feb843a469fb0ab00d2d23cfb9bcc379791011bb upstream.
    
    When preprocessing arch/*/kernel/vmlinux.lds.S, the target triple is
    not passed to $(CPP) because we add it only to KBUILD_{C,A}FLAGS.
    
    As a result, the linker script is preprocessed with predefined macros
    for the build host instead of the target.
    
    Assuming you use an x86 build machine, compare the following:
    
     $ clang -dM -E -x c /dev/null
     $ clang -dM -E -x c /dev/null -target aarch64-linux-gnu
    
    There is no actual problem presumably because our linker scripts do not
    rely on such predefined macros, but it is better to define correct ones.
    
    Move $(CLANG_FLAGS) to KBUILD_CPPFLAGS, so that all *.c, *.S, *.lds.S
    will be processed with the proper target triple.
    
    [Note]
    After the patch submission, we got an actual problem that needs this
    commit. (CBL issue 1859)
    
    Link: https://github.com/ClangBuiltLinux/linux/issues/1859
    Reported-by: Tom Rini <[email protected]>
    Signed-off-by: Masahiro Yamada <[email protected]>
    Reviewed-by: Nathan Chancellor <[email protected]>
    Tested-by: Nathan Chancellor <[email protected]>
    Signed-off-by: Nathan Chancellor <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

kbuild: Add CLANG_FLAGS to as-instr [+ + +]
Author: Nathan Chancellor <[email protected]>
Date:   Mon Aug 11 16:51:49 2025 -0700

    kbuild: Add CLANG_FLAGS to as-instr
    
    commit cff6e7f50bd315e5b39c4e46c704ac587ceb965f upstream.
    
    A future change will move CLANG_FLAGS from KBUILD_{A,C}FLAGS to
    KBUILD_CPPFLAGS so that '--target' is available while preprocessing.
    When that occurs, the following errors appear multiple times when
    building ARCH=powerpc powernv_defconfig:
    
      ld.lld: error: vmlinux.a(arch/powerpc/kernel/head_64.o):(.text+0x12d4): relocation R_PPC64_ADDR16_HI out of range: -4611686018409717520 is not in [-2147483648, 2147483647]; references '__start___soft_mask_table'
      ld.lld: error: vmlinux.a(arch/powerpc/kernel/head_64.o):(.text+0x12e8): relocation R_PPC64_ADDR16_HI out of range: -4611686018409717392 is not in [-2147483648, 2147483647]; references '__stop___soft_mask_table'
    
    Diffing the .o.cmd files reveals that -DHAVE_AS_ATHIGH=1 is not present
    anymore, because as-instr only uses KBUILD_AFLAGS, which will no longer
    contain '--target'.
    
    Mirror Kconfig's as-instr and add CLANG_FLAGS explicitly to the
    invocation to ensure the target information is always present.
    
    Signed-off-by: Nathan Chancellor <[email protected]>
    Signed-off-by: Masahiro Yamada <[email protected]>
    Signed-off-by: Nathan Chancellor <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

kbuild: Add KBUILD_CPPFLAGS to as-option invocation [+ + +]
Author: Nathan Chancellor <[email protected]>
Date:   Mon Aug 11 16:51:51 2025 -0700

    kbuild: Add KBUILD_CPPFLAGS to as-option invocation
    
    commit 43fc0a99906e04792786edf8534d8d58d1e9de0c upstream.
    
    After commit feb843a469fb ("kbuild: add $(CLANG_FLAGS) to
    KBUILD_CPPFLAGS"), there is an error while building certain PowerPC
    assembly files with clang:
    
      arch/powerpc/lib/copypage_power7.S: Assembler messages:
      arch/powerpc/lib/copypage_power7.S:34: Error: junk at end of line: `0b01000'
      arch/powerpc/lib/copypage_power7.S:35: Error: junk at end of line: `0b01010'
      arch/powerpc/lib/copypage_power7.S:37: Error: junk at end of line: `0b01000'
      arch/powerpc/lib/copypage_power7.S:38: Error: junk at end of line: `0b01010'
      arch/powerpc/lib/copypage_power7.S:40: Error: junk at end of line: `0b01010'
      clang: error: assembler command failed with exit code 1 (use -v to see invocation)
    
    as-option only uses KBUILD_AFLAGS, so after removing CLANG_FLAGS from
    KBUILD_AFLAGS, there is no more '--target=' or '--prefix=' flags. As a
    result of those missing flags, the host target
    will be tested during as-option calls and likely fail, meaning necessary
    flags may not get added when building assembly files, resulting in
    errors like seen above.
    
    Add KBUILD_CPPFLAGS to as-option invocations to clear up the errors.
    This should have been done in commit d5c8d6e0fa61 ("kbuild: Update
    assembler calls to use proper flags and language target"), which
    switched from using the assembler target to the assembler-with-cpp
    target, so flags that affect preprocessing are passed along in all
    relevant tests. as-option now mirrors cc-option.
    
    Fixes: feb843a469fb ("kbuild: add $(CLANG_FLAGS) to KBUILD_CPPFLAGS")
    Reported-by: Linux Kernel Functional Testing <[email protected]>
    Closes: https://lore.kernel.org/CA+G9fYs=koW9WardsTtora+nMgLR3raHz-LSLr58tgX4T5Mxag@mail.gmail.com/
    Signed-off-by: Nathan Chancellor <[email protected]>
    Tested-by: Naresh Kamboju <[email protected]>
    Signed-off-by: Masahiro Yamada <[email protected]>
    Signed-off-by: Nathan Chancellor <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

kbuild: Update assembler calls to use proper flags and language target [+ + +]
Author: Nick Desaulniers <[email protected]>
Date:   Mon Aug 11 16:51:47 2025 -0700

    kbuild: Update assembler calls to use proper flags and language target
    
    commit d5c8d6e0fa61401a729e9eb6a9c7077b2d3aebb0 upstream.
    
    as-instr uses KBUILD_AFLAGS, but as-option uses KBUILD_CFLAGS. This can
    cause as-option to fail unexpectedly when CONFIG_WERROR is set, because
    clang will emit -Werror,-Wunused-command-line-argument for various -m
    and -f flags in KBUILD_CFLAGS for assembler sources.
    
    Callers of as-option and as-instr should be adding flags to
    KBUILD_AFLAGS / aflags-y, not KBUILD_CFLAGS / cflags-y. Use
    KBUILD_AFLAGS in all macros to clear up the initial problem.
    
    Unfortunately, -Wunused-command-line-argument can still be triggered
    with clang by the presence of warning flags or macro definitions because
    '-x assembler' is used, instead of '-x assembler-with-cpp', which will
    consume these flags. Switch to '-x assembler-with-cpp' in places where
    '-x assembler' is used, as the compiler is always used as the driver for
    out of line assembler sources in the kernel.
    
    Finally, add -Werror to these macros so that they behave consistently
    whether or not CONFIG_WERROR is set.
    
    [nathan: Reworded and expanded on problems in commit message
             Use '-x assembler-with-cpp' in a couple more places]
    
    Link: https://github.com/ClangBuiltLinux/linux/issues/1699
    Suggested-by: Masahiro Yamada <[email protected]>
    Signed-off-by: Nick Desaulniers <[email protected]>
    Signed-off-by: Nathan Chancellor <[email protected]>
    Tested-by: Linux Kernel Functional Testing <[email protected]>
    Tested-by: Anders Roxell <[email protected]>
    Signed-off-by: Masahiro Yamada <[email protected]>
    Signed-off-by: Nathan Chancellor <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
kconfig: gconf: avoid hardcoding model2 in on_treeview2_cursor_changed() [+ + +]
Author: Masahiro Yamada <[email protected]>
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 <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

kconfig: gconf: fix potential memory leak in renderer_edited() [+ + +]
Author: Masahiro Yamada <[email protected]>
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 <[email protected]>
    Acked-by: Randy Dunlap <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

kconfig: lxdialog: fix 'space' to (de)select options [+ + +]
Author: Yann E. MORIN <[email protected]>
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 <[email protected]>
    Signed-off-by: Peter Korsgaard <[email protected]>
    Signed-off-by: Cherniaev Andrei <[email protected]>
    [masahiro: took from Buildroot, adjusted the commit subject]
    Signed-off-by: Masahiro Yamada <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

kconfig: lxdialog: replace strcpy() with strncpy() in inputbox.c [+ + +]
Author: Suchit Karunakaran <[email protected]>
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 <[email protected]>
    Reviewed-by: Nicolas Schier <[email protected]>
    Signed-off-by: Masahiro Yamada <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

kconfig: nconf: Ensure null termination where strncpy is used [+ + +]
Author: Shankari Anand <[email protected]>
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 <[email protected]>
    Signed-off-by: Masahiro Yamada <[email protected]>
    Acked-by: Randy Dunlap <[email protected]>
    Tested-by: Randy Dunlap <[email protected]>
    Tested-by: Nicolas Schier <[email protected]>
    Acked-by: Nicolas Schier <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ktest.pl: Prevent recursion of default variable options [+ + +]
Author: Steven Rostedt <[email protected]>
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" <[email protected]>
    Cc: Dhaval Giani <[email protected]>
    Cc: Greg KH <[email protected]>
    Link: https://lore.kernel.org/[email protected]
    Signed-off-by: Steven Rostedt <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
Linux: Linux 5.4.297 [+ + +]
Author: Greg Kroah-Hartman <[email protected]>
Date:   Thu Aug 28 16:21:37 2025 +0200

    Linux 5.4.297
    
    Link: https://lore.kernel.org/r/[email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Tested-by: Jon Hunter <[email protected]>
    Tested-by: Linux Kernel Functional Testing <[email protected]>
    Tested-by: Alok Tiwari <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
m68k: Don't unregister boot console needlessly [+ + +]
Author: Finn Thain <[email protected]>
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 <[email protected]>
    Fixes: 077b33b9e283 ("m68k: mvme147: Reinstate early console")
    Signed-off-by: Finn Thain <[email protected]>
    Reviewed-by: Geert Uytterhoeven <[email protected]>
    Link: https://lore.kernel.org/d1d4328e5aa9a87bd8352529ce62b767731c0530.1743467205.git.fthain@linux-m68k.org
    Signed-off-by: Geert Uytterhoeven <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

m68k: Fix lost column on framebuffer debug console [+ + +]
Author: Finn Thain <[email protected]>
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: [email protected]
    Signed-off-by: Finn Thain <[email protected]>
    Tested-by: Stan Johnson <[email protected]>
    Reviewed-by: Geert Uytterhoeven <[email protected]>
    Link: https://lore.kernel.org/9d4e8c68a456d5f2bc254ac6f87a472d066ebd5e.1743115195.git.fthain@linux-m68k.org
    Signed-off-by: Geert Uytterhoeven <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
media: dvb-frontends: dib7090p: fix null-ptr-deref in dib7090p_rw_on_apb() [+ + +]
Author: Alex Guo <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

media: dvb-frontends: w7090p: fix null-ptr-deref in w7090p_tuner_write_serpar and w7090p_tuner_read_serpar [+ + +]
Author: Alex Guo <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

media: gspca: Add bounds checking to firmware parser [+ + +]
Author: Dan Carpenter <[email protected]>
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: [email protected]
    Signed-off-by: Dan Carpenter <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: imx: fix a potential memory leak in imx_media_csc_scaler_device_init() [+ + +]
Author: Haoxiang Li <[email protected]>
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: [email protected]
    Signed-off-by: Haoxiang Li <[email protected]>
    Reviewed-by: Dan Carpenter <[email protected]>
    Signed-off-by: Nicolas Dufresne <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: ov2659: Fix memory leaks in ov2659_probe() [+ + +]
Author: Zhang Shurong <[email protected]>
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: [email protected]
    Signed-off-by: Zhang Shurong <[email protected]>
    Signed-off-by: Sakari Ailus <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: qcom: camss: cleanup media device allocated resource on error path [+ + +]
Author: Vladimir Zapolskiy <[email protected]>
Date:   Sat Aug 23 00:50:18 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: [email protected]
    Signed-off-by: Vladimir Zapolskiy <[email protected]>
    Reviewed-by: Bryan O'Donoghue <[email protected]>
    Signed-off-by: Bryan O'Donoghue <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    [ err_genpd_cleanup => err_cleanup ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: rainshadow-cec: fix TOCTOU race condition in rain_interrupt() [+ + +]
Author: Gui-Dong Han <[email protected]>
Date:   Fri Aug 22 21:45:18 2025 -0400

    media: rainshadow-cec: fix TOCTOU race condition in rain_interrupt()
    
    [ Upstream commit 7af160aea26c7dc9e6734d19306128cce156ec40 ]
    
    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: [email protected]
    Signed-off-by: Gui-Dong Han <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    [ drivers/media/cec/usb/rainshadow/ => drivers/media/usb/rainshadow-cec/ ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: tc358743: Check I2C succeeded during probe [+ + +]
Author: Dave Stevenson <[email protected]>
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 <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

media: tc358743: Increase FIFO trigger level to 374 [+ + +]
Author: Dave Stevenson <[email protected]>
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 <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

media: tc358743: Return an appropriate colorspace from tc358743_set_fmt [+ + +]
Author: Dave Stevenson <[email protected]>
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 <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

media: usb: hdpvr: disable zero-length read messages [+ + +]
Author: Wolfram Sang <[email protected]>
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 <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

media: usbtv: Lock resolution while streaming [+ + +]
Author: Ludwig Disterhof <[email protected]>
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: [email protected]
    Signed-off-by: Ludwig Disterhof <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    [hverkuil: call vb2_is_busy instead of vb2_is_streaming]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: uvcvideo: Do not mark valid metadata as invalid [+ + +]
Author: Ricardo Ribalda <[email protected]>
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: [email protected]
    Fixes: 088ead255245 ("media: uvcvideo: Add a metadata device node")
    Reviewed-by: Laurent Pinchart <[email protected]>
    Reviewed-by: Hans de Goede <[email protected]>
    Signed-off-by: Ricardo Ribalda <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Hans de Goede <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: uvcvideo: Fix 1-byte out-of-bounds read in uvc_parse_format() [+ + +]
Author: Youngjun Lee <[email protected]>
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 <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>
    Fixes: c0efd232929c ("V4L/DVB (8145a): USB Video Class driver")
    Cc: [email protected]
    Reviewed-by: Ricardo Ribalda <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Laurent Pinchart <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: uvcvideo: Fix bandwidth issue for Alcor camera [+ + +]
Author: chenchangcheng <[email protected]>
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 <[email protected]>
    Reviewed-by: Ricardo Ribalda <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Laurent Pinchart <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

media: v4l2-ctrls: always copy the controls on completion [+ + +]
Author: Hans Verkuil <[email protected]>
Date:   Fri Aug 22 21:59:11 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 <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Stable-dep-of: 5a0400aca5fa ("media: v4l2-ctrls: Don't reset handler's error in v4l2_ctrl_handler_free()")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: v4l2-ctrls: Don't reset handler's error in v4l2_ctrl_handler_free() [+ + +]
Author: Sakari Ailus <[email protected]>
Date:   Fri Aug 22 21:59:12 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: [email protected]
    Signed-off-by: Sakari Ailus <[email protected]>
    Reviewed-by: Hans Verkuil <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    [ v4l2-ctrls.c => v4l2-ctrls-core.c ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: venus: Add a check for packet size after reading from shared memory [+ + +]
Author: Vedang Nagar <[email protected]>
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: [email protected]
    Signed-off-by: Vedang Nagar <[email protected]>
    Co-developed-by: Dikshita Agarwal <[email protected]>
    Signed-off-by: Dikshita Agarwal <[email protected]>
    Reviewed-by: Bryan O'Donoghue <[email protected]>
    Signed-off-by: Bryan O'Donoghue <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: venus: hfi: explicitly release IRQ during teardown [+ + +]
Author: Jorge Ramirez-Ortiz <[email protected]>
Date:   Fri Aug 22 23:41:51 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: [email protected]
    Signed-off-by: Jorge Ramirez-Ortiz <[email protected]>
    Reviewed-by: Dikshita Agarwal <[email protected]>
    Tested-by: Dikshita Agarwal <[email protected]> # RB5
    Reviewed-by: Bryan O'Donoghue <[email protected]>
    Signed-off-by: Bryan O'Donoghue <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    [ Adjust context ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: venus: protect against spurious interrupts during probe [+ + +]
Author: Jorge Ramirez-Ortiz <[email protected]>
Date:   Sat Aug 23 00:50:14 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: [email protected]
    Signed-off-by: Jorge Ramirez-Ortiz <[email protected]>
    Reviewed-by: Bryan O'Donoghue <[email protected]>
    Reviewed-by: Vikash Garodia <[email protected]>
    Reviewed-by: Dikshita Agarwal <[email protected]>
    Tested-by: Dikshita Agarwal <[email protected]> # RB5
    Signed-off-by: Bryan O'Donoghue <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    [ kept hfi_isr_thread instead of venus_isr_thread ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: venus: vdec: Clamp param smaller than 1fps and bigger than 240. [+ + +]
Author: Ricardo Ribalda <[email protected]>
Date:   Sat Aug 23 08:54:54 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 <[email protected]>
    Closes: https://lore.kernel.org/linux-media/[email protected]/T/#m91cd962ac942834654f94c92206e2f85ff7d97f0
    Fixes: 7472c1c69138 ("[media] media: venus: vdec: add video decoder files")
    Cc: [email protected]
    Tested-by: Bryan O'Donoghue <[email protected]> # qrb5615-rb5
    Reviewed-by: Bryan O'Donoghue <[email protected]>
    Signed-off-by: Ricardo Ribalda <[email protected]>
    [bod: Change "parm" to "param"]
    Signed-off-by: Bryan O'Donoghue <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    [ Adjust context in header ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
memstick: core: Zero initialize id_reg in h_memstick_read_dev_id() [+ + +]
Author: Nathan Chancellor <[email protected]>
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: [email protected]
    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 <[email protected]>
    Link: https://lore.kernel.org/r/20250715-memstick-fix-uninit-const-pointer-v1-1-f6753829c27a@kernel.org
    Signed-off-by: Ulf Hansson <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

memstick: Fix deadlock by moving removing flag earlier [+ + +]
Author: Jiayi Li <[email protected]>
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 <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Ulf Hansson <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
MIPS: Don't crash in stack_top() for tasks without ABI or vDSO [+ + +]
Author: Thomas Weißschuh <[email protected]>
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 <[email protected]>
    Reviewed-by: David Gow <[email protected]>
    Reviewed-by: Huacai Chen <[email protected]>
    Signed-off-by: Thomas Bogendoerfer <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
mips: Include KBUILD_CPPFLAGS in CHECKFLAGS invocation [+ + +]
Author: Nathan Chancellor <[email protected]>
Date:   Mon Aug 11 16:51:48 2025 -0700

    mips: Include KBUILD_CPPFLAGS in CHECKFLAGS invocation
    
    commit 08f6554ff90ef189e6b8f0303e57005bddfdd6a7 upstream.
    
    A future change will move CLANG_FLAGS from KBUILD_{A,C}FLAGS to
    KBUILD_CPPFLAGS so that '--target' is available while preprocessing.
    When that occurs, the following error appears when building ARCH=mips
    with clang (tip of tree error shown):
    
      clang: error: unsupported option '-mabi=' for target 'x86_64-pc-linux-gnu'
    
    Add KBUILD_CPPFLAGS in the CHECKFLAGS invocation to keep everything
    working after the move.
    
    Signed-off-by: Nathan Chancellor <[email protected]>
    Signed-off-by: Masahiro Yamada <[email protected]>
    Signed-off-by: Nathan Chancellor <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
MIPS: mm: tlb-r4k: Uniquify TLB entries on init [+ + +]
Author: Jiaxun Yang <[email protected]>
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: [email protected]
    Signed-off-by: Jiaxun Yang <[email protected]>
    Signed-off-by: Thomas Bogendoerfer <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

MIPS: vpe-mt: add missing prototypes for vpe_{alloc,start,stop,free} [+ + +]
Author: Shiji Yang <[email protected]>
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 <[email protected]>
    Signed-off-by: Thomas Bogendoerfer <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
misc: rtsx: usb: Ensure mmc child device is active when card is present [+ + +]
Author: Ricky Wu <[email protected]>
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: [email protected]
    Signed-off-by: Ricky Wu <[email protected]>
    Reviewed-by: Ulf Hansson <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mm/hmm: move pmd_to_hmm_pfn_flags() to the respective #ifdeffery [+ + +]
Author: Andy Shevchenko <[email protected]>
Date:   Thu Aug 14 12:53:56 2025 -0400

    mm/hmm: move pmd_to_hmm_pfn_flags() to the respective #ifdeffery
    
    [ Upstream commit 188cb385bbf04d486df3e52f28c47b3961f5f0c0 ]
    
    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/[email protected]
    Fixes: 992de9a8b751 ("mm/hmm: allow to mirror vma of a file on a DAX backed filesystem")
    Signed-off-by: Andy Shevchenko <[email protected]>
    Reviewed-by: Leon Romanovsky <[email protected]>
    Reviewed-by: Alistair Popple <[email protected]>
    Cc: Andriy Shevchenko <[email protected]>
    Cc: Bill Wendling <[email protected]>
    Cc: Jerome Glisse <[email protected]>
    Cc: Justin Stitt <[email protected]>
    Cc: Nathan Chancellor <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    [ Minor context adjustment ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mm/kmemleak: avoid deadlock by moving pr_warn() outside kmemleak_lock [+ + +]
Author: Breno Leitao <[email protected]>
Date:   Tue Aug 19 11:26:13 2025 -0400

    mm/kmemleak: avoid deadlock by moving pr_warn() outside kmemleak_lock
    
    [ Upstream commit 47b0f6d8f0d2be4d311a49e13d2fd5f152f492b2 ]
    
    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/[email protected]
    Fixes: c5665868183f ("mm: kmemleak: use the memory pool for early allocations")
    Signed-off-by: Breno Leitao <[email protected]>
    Reported-by: Jakub Kicinski <[email protected]>
    Acked-by: Catalin Marinas <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

mm/kmemleak: avoid soft lockup in __kmemleak_do_cleanup() [+ + +]
Author: Waiman Long <[email protected]>
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/[email protected]
    Signed-off-by: Waiman Long <[email protected]>
    Acked-by: Catalin Marinas <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

mm/kmemleak: turn kmemleak_lock and object->lock to raw_spinlock_t [+ + +]
Author: He Zhe <[email protected]>
Date:   Tue Aug 19 11:26:12 2025 -0400

    mm/kmemleak: turn kmemleak_lock and object->lock to raw_spinlock_t
    
    [ Upstream commit 8c96f1bc6fc49c724c4cdd22d3e99260263b7384 ]
    
    kmemleak_lock as a rwlock on RT can possibly be acquired in atomic
    context which does work.
    
    Since the kmemleak operation is performed in atomic context make it a
    raw_spinlock_t so it can also be acquired on RT.  This is used for
    debugging and is not enabled by default in a production like environment
    (where performance/latency matters) so it makes sense to make it a
    raw_spinlock_t instead trying to get rid of the atomic context.  Turn
    also the kmemleak_object->lock into raw_spinlock_t which is acquired
    (nested) while the kmemleak_lock is held.
    
    The time spent in "echo scan > kmemleak" slightly improved on 64core box
    with this patch applied after boot.
    
    [[email protected]: redo the description, update comments. Merge the individual bits:  He Zhe did the kmemleak_lock, Liu Haitao the ->lock and Yongxin Liu forwarded Liu's patch.]
    Link: http://lkml.kernel.org/r/[email protected]
    Link: https://lkml.kernel.org/r/[email protected]
    Link: https://lkml.kernel.org/r/[email protected]
    Link: https://lkml.kernel.org/r/[email protected]
    Signed-off-by: He Zhe <[email protected]>
    Signed-off-by: Liu Haitao <[email protected]>
    Signed-off-by: Yongxin Liu <[email protected]>
    Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
    Acked-by: Catalin Marinas <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Stable-dep-of: 47b0f6d8f0d2 ("mm/kmemleak: avoid deadlock by moving pr_warn() outside kmemleak_lock")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mm/zsmalloc.c: convert to use kmem_cache_zalloc in cache_alloc_zspage() [+ + +]
Author: Miaohe Lin <[email protected]>
Date:   Tue Jul 29 11:13:25 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/[email protected]
    Signed-off-by: Miaohe Lin <[email protected]>
    Reviewed-by: Sergey Senozhatsky <[email protected]>
    Cc: Minchan Kim <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Stable-dep-of: 694d6b99923e ("mm/zsmalloc: do not pass __GFP_MOVABLE if CONFIG_COMPACTION=n")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mm/zsmalloc: do not pass __GFP_MOVABLE if CONFIG_COMPACTION=n [+ + +]
Author: Harry Yoo <[email protected]>
Date:   Tue Jul 29 11:13:26 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/[email protected]
    Fixes: 48b4800a1c6a ("zsmalloc: page migration support")
    Signed-off-by: Harry Yoo <[email protected]>
    Acked-by: David Hildenbrand <[email protected]>
    Reviewed-by: Sergey Senozhatsky <[email protected]>
    Cc: Minchan Kim <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mm: drop the assumption that VM_SHARED always implies writable [+ + +]
Author: Lorenzo Stoakes <[email protected]>
Date:   Tue Jul 29 17:58:06 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/[email protected]/
    [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/[email protected]
    Link: https://lkml.kernel.org/r/d978aefefa83ec42d18dfa964ad180dbcde34795.1697116581.git.lstoakes@gmail.com
    Signed-off-by: Lorenzo Stoakes <[email protected]>
    Suggested-by: Andy Lutomirski <[email protected]>
    Reviewed-by: Jan Kara <[email protected]>
    Cc: Alexander Viro <[email protected]>
    Cc: Christian Brauner <[email protected]>
    Cc: Hugh Dickins <[email protected]>
    Cc: Matthew Wilcox (Oracle) <[email protected]>
    Cc: Mike Kravetz <[email protected]>
    Cc: Muchun Song <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Cc: [email protected]
    Signed-off-by: Isaac J. Manjarres <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

mm: perform the mapping_map_writable() check after call_mmap() [+ + +]
Author: Lorenzo Stoakes <[email protected]>
Date:   Tue Jul 29 17:58:08 2025 -0700

    mm: perform the mapping_map_writable() check after call_mmap()
    
    [ Upstream commit 158978945f3173b8c1a88f8c5684a629736a57ac ]
    
    In order for a F_SEAL_WRITE sealed memfd mapping to have an opportunity to
    clear VM_MAYWRITE, we must be able to invoke the appropriate
    vm_ops->mmap() handler to do so.  We would otherwise fail the
    mapping_map_writable() check before we had the opportunity to avoid it.
    
    This patch moves this check after the call_mmap() invocation.  Only memfd
    actively denies write access causing a potential failure here (in
    memfd_add_seals()), so there should be no impact on non-memfd cases.
    
    This patch makes the userland-visible change that MAP_SHARED, PROT_READ
    mappings of an F_SEAL_WRITE sealed memfd mapping will now succeed.
    
    There is a delicate situation with cleanup paths assuming that a writable
    mapping must have occurred in circumstances where it may now not have.  In
    order to ensure we do not accidentally mark a writable file unwritable by
    mistake, we explicitly track whether we have a writable mapping and unmap
    only if we do.
    
    [[email protected]: do not set writable_file_mapping in inappropriate case]
      Link: https://lkml.kernel.org/r/[email protected]
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=217238
    Link: https://lkml.kernel.org/r/55e413d20678a1bb4c7cce889062bbb07b0df892.1697116581.git.lstoakes@gmail.com
    Signed-off-by: Lorenzo Stoakes <[email protected]>
    Reviewed-by: Jan Kara <[email protected]>
    Cc: Alexander Viro <[email protected]>
    Cc: Andy Lutomirski <[email protected]>
    Cc: Christian Brauner <[email protected]>
    Cc: Hugh Dickins <[email protected]>
    Cc: Matthew Wilcox (Oracle) <[email protected]>
    Cc: Mike Kravetz <[email protected]>
    Cc: Muchun Song <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Cc: [email protected]
    [isaacmanjarres: added error handling to cleanup the work done by the
    mmap() callback and removed unused label.]
    Signed-off-by: Isaac J. Manjarres <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

mm: update memfd seal write check to include F_SEAL_WRITE [+ + +]
Author: Lorenzo Stoakes <[email protected]>
Date:   Tue Jul 29 17:58:07 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 <[email protected]>
    Reviewed-by: Jan Kara <[email protected]>
    Cc: Alexander Viro <[email protected]>
    Cc: Andy Lutomirski <[email protected]>
    Cc: Christian Brauner <[email protected]>
    Cc: Hugh Dickins <[email protected]>
    Cc: Matthew Wilcox (Oracle) <[email protected]>
    Cc: Mike Kravetz <[email protected]>
    Cc: Muchun Song <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Cc: [email protected]
    Signed-off-by: Isaac J. Manjarres <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mmc: bcm2835: Fix dma_unmap_sg() nents value [+ + +]
Author: Thomas Fourier <[email protected]>
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 <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Ulf Hansson <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

mmc: rtsx_usb_sdmmc: Fix error-path in sd_set_power_mode() [+ + +]
Author: Ulf Hansson <[email protected]>
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 <[email protected]>
    Signed-off-by: Ulf Hansson <[email protected]>
    Acked-by: Ricky Wu <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

mmc: sdhci-pci: Quirk for broken command queuing on Intel GLK-based Positivo models [+ + +]
Author: Edson Juliano Drosdeck <[email protected]>
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 <[email protected]>
    Fixes: bedf9fc01ff1 ("mmc: sdhci: Workaround broken command queuing on Intel GLK")
    Cc: [email protected]
    Acked-by: Adrian Hunter <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Ulf Hansson <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

mmc: sdhci_am654: Workaround for Errata i2312 [+ + +]
Author: Judith Mendez <[email protected]>
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 <[email protected]>
    Acked-by: Adrian Hunter <[email protected]>
    Fixes: 41fd4caeb00b ("mmc: sdhci_am654: Add Initial Support for AM654 SDHCI driver")
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Ulf Hansson <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
module: Restore the moduleparam prefix length check [+ + +]
Author: Petr Pavlu <[email protected]>
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 <[email protected]>
    Reviewed-by: Daniel Gomez <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Daniel Gomez <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
move_mount: allow to add a mount into an existing group [+ + +]
Author: Pavel Tikhomirov <[email protected]>
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/[email protected]
    Cc: Eric W. Biederman <[email protected]>
    Cc: Alexander Viro <[email protected]>
    Cc: Christian Brauner <[email protected]>
    Cc: Mattias Nissler <[email protected]>
    Cc: Aleksa Sarai <[email protected]>
    Cc: Andrei Vagin <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Cc: lkml <[email protected]>
    Co-developed-by: Andrei Vagin <[email protected]>
    Acked-by: Christian Brauner <[email protected]>
    Signed-off-by: Pavel Tikhomirov <[email protected]>
    Signed-off-by: Andrei Vagin <[email protected]>
    Signed-off-by: Christian Brauner <[email protected]>
    Stable-dep-of: cffd0441872e ("use uniform permission checks for all mount propagation changes")
    Signed-off-by: Sasha Levin <[email protected]>

 
mtd: fix possible integer overflow in erase_xfer() [+ + +]
Author: Ivan Stepchenko <[email protected]>
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 <[email protected]>
    Signed-off-by: Miquel Raynal <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

mtd: rawnand: atmel: Fix dma_mapping_error() address [+ + +]
Author: Thomas Fourier <[email protected]>
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 <[email protected]>
    Rule: add
    Link: https://lore.kernel.org/stable/20250702064515.18145-2-fourier.thomas%40gmail.com
    Signed-off-by: Miquel Raynal <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

mtd: rawnand: atmel: set pmecc data setup time [+ + +]
Author: Balamanikandan Gunasundar <[email protected]>
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 <[email protected]>
    Closes: https://lore.kernel.org/all/[email protected]
    Suggested-by: Ada Couprie Diaz <[email protected]>
    Signed-off-by: Balamanikandan Gunasundar <[email protected]>
    Signed-off-by: Miquel Raynal <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

mtd: rawnand: fsmc: Add missing check after DMA map [+ + +]
Author: Thomas Fourier <[email protected]>
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: [email protected]
    Signed-off-by: Thomas Fourier <[email protected]>
    Rule: add
    Link: https://lore.kernel.org/stable/20250702065806.20983-2-fourier.thomas%40gmail.com
    Signed-off-by: Miquel Raynal <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mwl8k: Add missing check after DMA map [+ + +]
Author: Thomas Fourier <[email protected]>
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 <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
net/packet: fix a race in packet_set_ring() and packet_notifier() [+ + +]
Author: Quang Le <[email protected]>
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: [email protected]
    Signed-off-by: Quang Le <[email protected]>
    Signed-off-by: Willem de Bruijn <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
net/sched: act_mirred: better wording on protection against excessive stack growth [+ + +]
Author: Davide Caratti <[email protected]>
Date:   Fri Jul 25 00:56:18 2025 +0530

    net/sched: act_mirred: better wording on protection against excessive stack growth
    
    [ Upstream commit 78dcdffe0418ac8f3f057f26fe71ccf4d8ed851f ]
    
    with commit e2ca070f89ec ("net: sched: protect against stack overflow in
    TC act_mirred"), act_mirred protected itself against excessive stack growth
    using per_cpu counter of nested calls to tcf_mirred_act(), and capping it
    to MIRRED_RECURSION_LIMIT. However, such protection does not detect
    recursion/loops in case the packet is enqueued to the backlog (for example,
    when the mirred target device has RPS or skb timestamping enabled). Change
    the wording from "recursion" to "nesting" to make it more clear to readers.
    
    CC: Jamal Hadi Salim <[email protected]>
    Signed-off-by: Davide Caratti <[email protected]>
    Reviewed-by: Marcelo Ricardo Leitner <[email protected]>
    Acked-by: Jamal Hadi Salim <[email protected]>
    Signed-off-by: Paolo Abeni <[email protected]>
    [ skulkarni: Adjusted patch for file 'act_mirred.c' - hunk #4/4 wrt the mainline commit ]
    Stable-dep-of: ca22da2fbd69 ("act_mirred: use the backlog for nested calls to mirred ingress")
    Signed-off-by: Shubham Kulkarni <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net/sched: act_mirred: refactor the handle of xmit [+ + +]
Author: wenxu <[email protected]>
Date:   Fri Jul 25 00:56:17 2025 +0530

    net/sched: act_mirred: refactor the handle of xmit
    
    [ Upstream commit fa6d639930ee5cd3f932cc314f3407f07a06582d ]
    
    This one is prepare for the next patch.
    
    Signed-off-by: wenxu <[email protected]>
    Signed-off-by: Jakub Kicinski <[email protected]>
    [ skulkarni: Adjusted patch for file 'sch_generic.h' wrt the mainline commit ]
    Stable-dep-of: ca22da2fbd69 ("act_mirred: use the backlog for nested calls to mirred ingress")
    Signed-off-by: Shubham Kulkarni <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net/sched: Make cake_enqueue return NET_XMIT_CN when past buffer_limit [+ + +]
Author: William Liu <[email protected]>
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 <[email protected]>
    Reviewed-by: Savino Dicanosa <[email protected]>
    Acked-by: Toke Høiland-Jørgensen <[email protected]>
    Reviewed-by: Jamal Hadi Salim <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net/sched: Remove unnecessary WARNING condition for empty child qdisc in htb_activate [+ + +]
Author: William Liu <[email protected]>
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 <[email protected]>
    Reviewed-by: Savino Dicanosa <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net/sched: Restrict conditions for adding duplicating netems to qdisc tree [+ + +]
Author: William Liu <[email protected]>
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 <[email protected]>
    Reported-by: Savino Dicanosa <[email protected]>
    Signed-off-by: William Liu <[email protected]>
    Signed-off-by: Savino Dicanosa <[email protected]>
    Acked-by: Jamal Hadi Salim <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net/sched: Return NULL when htb_lookup_leaf encounters an empty rbtree [+ + +]
Author: William Liu <[email protected]>
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 <[email protected]>
    Signed-off-by: Savino Dicanosa <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net/sched: sch_qfq: Avoid triggering might_sleep in atomic context in qfq_delete_class [+ + +]
Author: Xiang Mei <[email protected]>
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 <[email protected]>
    Signed-off-by: Xiang Mei <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Reviewed-by: Cong Wang <[email protected]>
    Reviewed-by: Dan Carpenter <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net/sched: sch_qfq: Fix race condition on qfq_aggregate [+ + +]
Author: Xiang Mei <[email protected]>
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 <[email protected]>
    Reviewed-by: Cong Wang <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
net: ag71xx: Add missing check after DMA map [+ + +]
Author: Thomas Fourier <[email protected]>
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 <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: appletalk: fix kerneldoc warnings [+ + +]
Author: Andrew Lunn <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Stable-dep-of: 6c4a92d07b08 ("net: appletalk: Fix use-after-free in AARP proxy probe")
    Signed-off-by: Sasha Levin <[email protected]>

net: appletalk: Fix use-after-free in AARP proxy probe [+ + +]
Author: Kito Xu (veritas501) <[email protected]>
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) <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: dpaa: fix device leak when querying time stamp info [+ + +]
Author: Johan Hovold <[email protected]>
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: [email protected]      # 4.19
    Cc: Yangbo Lu <[email protected]>
    Signed-off-by: Johan Hovold <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: drop UFO packets in udp_rcv_segment() [+ + +]
Author: Wang Liang <[email protected]>
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/[email protected]/
    Link: https://lore.kernel.org/netdev/[email protected]/
    Fixes: cf329aa42b66 ("udp: cope with UDP GRO packet misdirection")
    Suggested-by: Willem de Bruijn <[email protected]>
    Signed-off-by: Wang Liang <[email protected]>
    Reviewed-by: Willem de Bruijn <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: dsa: b53: fix b53_imp_vlan_setup for BCM5325 [+ + +]
Author: Álvaro Fernández Rojas <[email protected]>
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 <[email protected]>
    Signed-off-by: Álvaro Fernández Rojas <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: dsa: b53: fix IP_MULTICAST_CTRL on BCM5325 [+ + +]
Author: Álvaro Fernández Rojas <[email protected]>
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 <[email protected]>
    Signed-off-by: Álvaro Fernández Rojas <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: dsa: b53: prevent SWITCH_CTRL access on BCM5325 [+ + +]
Author: Álvaro Fernández Rojas <[email protected]>
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 <[email protected]>
    Signed-off-by: Álvaro Fernández Rojas <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: emaclite: Fix missing pointer increment in aligned_read() [+ + +]
Author: Alok Tiwari <[email protected]>
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 <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: fec: allow disable coalescing [+ + +]
Author: Jonas Rebmann <[email protected]>
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 <[email protected]>
    Reviewed-by: Wei Fang <[email protected]>
    Link: https://patch.msgid.link/20250626-fec_deactivate_coalescing-v2-1-0b217f2e80da@pengutronix.de
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: gianfar: fix device leak when querying time stamp info [+ + +]
Author: Johan Hovold <[email protected]>
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: [email protected]      # 4.18
    Cc: Yangbo Lu <[email protected]>
    Signed-off-by: Johan Hovold <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: ipv4: fix incorrect MTU in broadcast routes [+ + +]
Author: Oscar Maes <[email protected]>
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 <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: ncsi: Fix buffer overflow in fetching version id [+ + +]
Author: Hari Kalavakunta <[email protected]>
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 <[email protected]>
    Reviewed-by: Paul Fertser <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: phy: smsc: add proper reset flags for LAN8710A [+ + +]
Author: Buday Csaba <[email protected]>
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 <[email protected]>
    Cc: Csókás Bence <[email protected]>
    Reviewed-by: Andrew Lunn <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: sched: don't expose action qstats to skb_tc_reinsert() [+ + +]
Author: Vlad Buslov <[email protected]>
Date:   Fri Jul 25 00:56:15 2025 +0530

    net: sched: don't expose action qstats to skb_tc_reinsert()
    
    [ Upstream commit ef816f3c49c1c404ababc50e10d4cbe5109da678 ]
    
    Previous commit introduced helper function for updating qstats and
    refactored set of actions to use the helpers, instead of modifying qstats
    directly. However, one of the affected action exposes its qstats to
    skb_tc_reinsert(), which then modifies it.
    
    Refactor skb_tc_reinsert() to return integer error code and don't increment
    overlimit qstats in case of error, and use the returned error code in
    tcf_mirred_act() to manually increment the overlimit counter with new
    helper function.
    
    Signed-off-by: Vlad Buslov <[email protected]>
    Acked-by: Jiri Pirko <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    [ skulkarni: Adjusted patch for file 'sch_generic.h' wrt the mainline commit ]
    Stable-dep-of: ca22da2fbd69 ("act_mirred: use the backlog for nested calls to mirred ingress")
    Signed-off-by: Shubham Kulkarni <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: sched: extract bstats update code into function [+ + +]
Author: Vlad Buslov <[email protected]>
Date:   Fri Jul 25 00:56:13 2025 +0530

    net: sched: extract bstats update code into function
    
    [ Upstream commit 5e1ad95b630e652d3467d1fd1f0b5e5ea2c441e2 ]
    
    Extract common code that increments cpu_bstats counter into standalone act
    API function. Change hardware offloaded actions that use percpu counter
    allocation to use the new function instead of incrementing cpu_bstats
    directly.
    
    This commit doesn't change functionality.
    
    Signed-off-by: Vlad Buslov <[email protected]>
    Acked-by: Jiri Pirko <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Stable-dep-of: ca22da2fbd69 ("act_mirred: use the backlog for nested calls to mirred ingress")
    Signed-off-by: Shubham Kulkarni <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: sched: extract common action counters update code into function [+ + +]
Author: Vlad Buslov <[email protected]>
Date:   Fri Jul 25 00:56:12 2025 +0530

    net: sched: extract common action counters update code into function
    
    [ Upstream commit c8ecebd04cbb6badb46d42fe54282e7883ed63cc ]
    
    Currently, all implementations of tc_action_ops->stats_update() callback
    have almost exactly the same implementation of counters update
    code (besides gact which also updates drop counter). In order to simplify
    support for using both percpu-allocated and regular action counters
    depending on run-time flag in following patches, extract action counters
    update code into standalone function in act API.
    
    This commit doesn't change functionality.
    
    Signed-off-by: Vlad Buslov <[email protected]>
    Acked-by: Jiri Pirko <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Stable-dep-of: ca22da2fbd69 ("act_mirred: use the backlog for nested calls to mirred ingress")
    Signed-off-by: Shubham Kulkarni <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: sched: extract qstats update code into functions [+ + +]
Author: Vlad Buslov <[email protected]>
Date:   Fri Jul 25 00:56:14 2025 +0530

    net: sched: extract qstats update code into functions
    
    [ Upstream commit 26b537a88ca5b7399c7ab0656e06dbd9da9513c1 ]
    
    Extract common code that increments cpu_qstats counters into standalone act
    API functions. Change hardware offloaded actions that use percpu counter
    allocation to use the new functions instead of accessing cpu_qstats
    directly.
    
    This commit doesn't change functionality.
    
    Signed-off-by: Vlad Buslov <[email protected]>
    Acked-by: Jiri Pirko <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Stable-dep-of: ca22da2fbd69 ("act_mirred: use the backlog for nested calls to mirred ingress")
    Signed-off-by: Shubham Kulkarni <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: thunderx: Fix format-truncation warning in bgx_acpi_match_id() [+ + +]
Author: Alok Tiwari <[email protected]>
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 <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: usbnet: Avoid potential RCU stall on LINK_CHANGE event [+ + +]
Author: John Ernberg <[email protected]>
Date:   Wed Jul 23 10:25:35 2025 +0000

    net: usbnet: Avoid potential RCU stall on LINK_CHANGE event
    
    commit 0d9cfc9b8cb17dbc29a98792d36ec39a1cf1395f upstream.
    
    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: [email protected]
    Signed-off-by: John Ernberg <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    [ adjust context in header ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: usbnet: Fix the wrong netif_carrier_on() call [+ + +]
Author: Ammar Faizi <[email protected]>
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: [email protected]
    Cc: Armando Budianto <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Suggested-by: Linus Torvalds <[email protected]>
    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/[email protected]
    Fixes: 0d9cfc9b8cb1 ("net: usbnet: Avoid potential RCU stall on LINK_CHANGE event")
    Signed-off-by: Ammar Faizi <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: vlan: fix VLAN 0 refcount imbalance of toggling filtering during runtime [+ + +]
Author: Dong Chenchen <[email protected]>
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: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=a8b046e462915c65b10b
    Suggested-by: Ido Schimmel <[email protected]>
    Signed-off-by: Dong Chenchen <[email protected]>
    Reviewed-by: Ido Schimmel <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: vlan: Replace BUG() with WARN_ON_ONCE() in vlan_dev_* stubs [+ + +]
Author: Gal Pressman <[email protected]>
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 <[email protected]>
    Reviewed-by: Dragos Tatulea <[email protected]>
    Signed-off-by: Gal Pressman <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
net_sched: sch_sfq: annotate data-races around q->perturb_period [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Thu Jul 17 05:45:51 2025 -0700

    net_sched: sch_sfq: annotate data-races around q->perturb_period
    
    [ Upstream commit a17ef9e6c2c1cf0fc6cd6ca6a9ce525c67d1da7f ]
    
    sfq_perturbation() reads q->perturb_period locklessly.
    Add annotations to fix potential issues.
    
    Signed-off-by: Eric Dumazet <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    [ Harshit: Backport to 5.4.y, conflicts resolved due to missing commit:
      d636fc5dd692 ("net: sched: add rcu annotations around
      qdisc->qdisc_sleeping")in 5.4.y ]
    Signed-off-by: Harshit Mogalapalli <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net_sched: sch_sfq: don't allow 1 packet limit [+ + +]
Author: Octavian Purdila <[email protected]>
Date:   Thu Jul 17 05:45:53 2025 -0700

    net_sched: sch_sfq: don't allow 1 packet limit
    
    [ Upstream commit 10685681bafce6febb39770f3387621bf5d67d0b ]
    
    The current implementation does not work correctly with a limit of
    1. iproute2 actually checks for this and this patch adds the check in
    kernel as well.
    
    This fixes the following syzkaller reported crash:
    
    UBSAN: array-index-out-of-bounds in net/sched/sch_sfq.c:210:6
    index 65535 is out of range for type 'struct sfq_head[128]'
    CPU: 0 PID: 2569 Comm: syz-executor101 Not tainted 5.10.0-smp-DEV #1
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
    Call Trace:
      __dump_stack lib/dump_stack.c:79 [inline]
      dump_stack+0x125/0x19f lib/dump_stack.c:120
      ubsan_epilogue lib/ubsan.c:148 [inline]
      __ubsan_handle_out_of_bounds+0xed/0x120 lib/ubsan.c:347
      sfq_link net/sched/sch_sfq.c:210 [inline]
      sfq_dec+0x528/0x600 net/sched/sch_sfq.c:238
      sfq_dequeue+0x39b/0x9d0 net/sched/sch_sfq.c:500
      sfq_reset+0x13/0x50 net/sched/sch_sfq.c:525
      qdisc_reset+0xfe/0x510 net/sched/sch_generic.c:1026
      tbf_reset+0x3d/0x100 net/sched/sch_tbf.c:319
      qdisc_reset+0xfe/0x510 net/sched/sch_generic.c:1026
      dev_reset_queue+0x8c/0x140 net/sched/sch_generic.c:1296
      netdev_for_each_tx_queue include/linux/netdevice.h:2350 [inline]
      dev_deactivate_many+0x6dc/0xc20 net/sched/sch_generic.c:1362
      __dev_close_many+0x214/0x350 net/core/dev.c:1468
      dev_close_many+0x207/0x510 net/core/dev.c:1506
      unregister_netdevice_many+0x40f/0x16b0 net/core/dev.c:10738
      unregister_netdevice_queue+0x2be/0x310 net/core/dev.c:10695
      unregister_netdevice include/linux/netdevice.h:2893 [inline]
      __tun_detach+0x6b6/0x1600 drivers/net/tun.c:689
      tun_detach drivers/net/tun.c:705 [inline]
      tun_chr_close+0x104/0x1b0 drivers/net/tun.c:3640
      __fput+0x203/0x840 fs/file_table.c:280
      task_work_run+0x129/0x1b0 kernel/task_work.c:185
      exit_task_work include/linux/task_work.h:33 [inline]
      do_exit+0x5ce/0x2200 kernel/exit.c:931
      do_group_exit+0x144/0x310 kernel/exit.c:1046
      __do_sys_exit_group kernel/exit.c:1057 [inline]
      __se_sys_exit_group kernel/exit.c:1055 [inline]
      __x64_sys_exit_group+0x3b/0x40 kernel/exit.c:1055
     do_syscall_64+0x6c/0xd0
     entry_SYSCALL_64_after_hwframe+0x61/0xcb
    RIP: 0033:0x7fe5e7b52479
    Code: Unable to access opcode bytes at RIP 0x7fe5e7b5244f.
    RSP: 002b:00007ffd3c800398 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
    RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fe5e7b52479
    RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000
    RBP: 00007fe5e7bcd2d0 R08: ffffffffffffffb8 R09: 0000000000000014
    R10: 0000000000000000 R11: 0000000000000246 R12: 00007fe5e7bcd2d0
    R13: 0000000000000000 R14: 00007fe5e7bcdd20 R15: 00007fe5e7b24270
    
    The crash can be also be reproduced with the following (with a tc
    recompiled to allow for sfq limits of 1):
    
    tc qdisc add dev dummy0 handle 1: root tbf rate 1Kbit burst 100b lat 1s
    ../iproute2-6.9.0/tc/tc qdisc add dev dummy0 handle 2: parent 1:10 sfq limit 1
    ifconfig dummy0 up
    ping -I dummy0 -f -c2 -W0.1 8.8.8.8
    sleep 1
    
    Scenario that triggers the crash:
    
    * the first packet is sent and queued in TBF and SFQ; qdisc qlen is 1
    
    * TBF dequeues: it peeks from SFQ which moves the packet to the
      gso_skb list and keeps qdisc qlen set to 1. TBF is out of tokens so
      it schedules itself for later.
    
    * the second packet is sent and TBF tries to queues it to SFQ. qdisc
      qlen is now 2 and because the SFQ limit is 1 the packet is dropped
      by SFQ. At this point qlen is 1, and all of the SFQ slots are empty,
      however q->tail is not NULL.
    
    At this point, assuming no more packets are queued, when sch_dequeue
    runs again it will decrement the qlen for the current empty slot
    causing an underflow and the subsequent out of bounds access.
    
    Reported-by: syzbot <[email protected]>
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Octavian Purdila <[email protected]>
    Reviewed-by: Eric Dumazet <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Harshit Mogalapalli <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net_sched: sch_sfq: handle bigger packets [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Thu Jul 17 05:45:52 2025 -0700

    net_sched: sch_sfq: handle bigger packets
    
    [ Upstream commit e4650d7ae4252f67e997a632adfae0dd74d3a99a ]
    
    SFQ has an assumption on dealing with packets smaller than 64KB.
    
    Even before BIG TCP, TCA_STAB can provide arbitrary big values
    in qdisc_pkt_len(skb)
    
    It is time to switch (struct sfq_slot)->allot to a 32bit field.
    
    sizeof(struct sfq_slot) is now 64 bytes, giving better cache locality.
    
    Signed-off-by: Eric Dumazet <[email protected]>
    Reviewed-by: Toke Høiland-Jørgensen <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Harshit Mogalapalli <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net_sched: sch_sfq: move the limit validation [+ + +]
Author: Octavian Purdila <[email protected]>
Date:   Thu Jul 17 05:45:55 2025 -0700

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

net_sched: sch_sfq: reject invalid perturb period [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Thu Jul 17 05:45:56 2025 -0700

    net_sched: sch_sfq: reject invalid perturb period
    
    [ Upstream commit 7ca52541c05c832d32b112274f81a985101f9ba8 ]
    
    Gerrard Tai reported that SFQ perturb_period has no range check yet,
    and this can be used to trigger a race condition fixed in a separate patch.
    
    We want to make sure ctl->perturb_period * HZ will not overflow
    and is positive.
    
    Tested:
    
    tc qd add dev lo root sfq perturb -10   # negative value : error
    Error: sch_sfq: invalid perturb period.
    
    tc qd add dev lo root sfq perturb 1000000000 # too big : error
    Error: sch_sfq: invalid perturb period.
    
    tc qd add dev lo root sfq perturb 2000000 # acceptable value
    tc -s -d qd sh dev lo
    qdisc sfq 8005: root refcnt 2 limit 127p quantum 64Kb depth 127 flows 128 divisor 1024 perturb 2000000sec
     Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
     backlog 0b 0p requeues 0
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: Gerrard Tai <[email protected]>
    Signed-off-by: Eric Dumazet <[email protected]>
    Cc: [email protected]
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Harshit Mogalapalli <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net_sched: sch_sfq: use a temporary work area for validating configuration [+ + +]
Author: Octavian Purdila <[email protected]>
Date:   Thu Jul 17 05:45:54 2025 -0700

    net_sched: sch_sfq: use a temporary work area for validating configuration
    
    [ Upstream commit 8c0cea59d40cf6dd13c2950437631dd614fbade6 ]
    
    Many configuration parameters have influence on others (e.g. divisor
    -> flows -> limit, depth -> limit) and so it is difficult to correctly
    do all of the validation before applying the configuration. And if a
    validation error is detected late it is difficult to roll back a
    partially applied configuration.
    
    To avoid these issues use a temporary work area to update and validate
    the configuration and only then apply the configuration to the
    internal state.
    
    Signed-off-by: Octavian Purdila <[email protected]>
    Acked-by: Cong Wang <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Harshit Mogalapalli <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
netfilter: ctnetlink: fix refcount leak on table dump [+ + +]
Author: Florian Westphal <[email protected]>
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 <[email protected]>
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

netfilter: nf_tables: adjust lockdep assertions handling [+ + +]
Author: Fedor Pchelkin <[email protected]>
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 <[email protected]>
    Signed-off-by: Fedor Pchelkin <[email protected]>
    Acked-by: Florian Westphal <[email protected]>
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

netfilter: xt_nfacct: don't assume acct name is null-terminated [+ + +]
Author: Florian Westphal <[email protected]>
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: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=4ff165b9251e4d295690
    Tested-by: [email protected]
    Fixes: ceb98d03eac5 ("netfilter: xtables: add nfacct match to support extended accounting")
    Signed-off-by: Florian Westphal <[email protected]>
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
netlink: avoid infinite retry looping in netlink_unicast() [+ + +]
Author: Fedor Pchelkin <[email protected]>
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: [email protected]
    Signed-off-by: Fedor Pchelkin <[email protected]>
    Reviewed-by: Kuniyuki Iwashima <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
netmem: fix skb_frag_address_safe with unreadable skbs [+ + +]
Author: Mina Almasry <[email protected]>
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: [email protected]
    
    Signed-off-by: Mina Almasry <[email protected]>
    Acked-by: Stanislav Fomichev <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
netpoll: prevent hanging NAPI when netcons gets enabled [+ + +]
Author: Jakub Kicinski <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/[email protected]
    Acked-by: Jason Wang <[email protected]>
    Reviewed-by: Xuan Zhuo <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
NFS: Fix filehandle bounds checking in nfs_fh_to_dentry() [+ + +]
Author: Trond Myklebust <[email protected]>
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 <[email protected]>
    Fixes: 20fa19027286 ("nfs: add export operations")
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

NFS: Fix the setting of capabilities when automounting a new filesystem [+ + +]
Author: Trond Myklebust <[email protected]>
Date:   Sat Aug 16 22:28:12 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: [email protected]
    Reviewed-by: Benjamin Coddington <[email protected]>
    Signed-off-by: Trond Myklebust <[email protected]>
    [ adapted to older fs_context-less API structures ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
nfs: fix UAF in direct writes [+ + +]
Author: Josef Bacik <[email protected]>
Date:   Fri Mar 1 11:49:57 2024 -0500

    nfs: fix UAF in direct writes
    
    commit 17f46b803d4f23c66cacce81db35fef3adb8f2af upstream.
    
    In production we have been hitting the following warning consistently
    
    ------------[ cut here ]------------
    refcount_t: underflow; use-after-free.
    WARNING: CPU: 17 PID: 1800359 at lib/refcount.c:28 refcount_warn_saturate+0x9c/0xe0
    Workqueue: nfsiod nfs_direct_write_schedule_work [nfs]
    RIP: 0010:refcount_warn_saturate+0x9c/0xe0
    PKRU: 55555554
    Call Trace:
     <TASK>
     ? __warn+0x9f/0x130
     ? refcount_warn_saturate+0x9c/0xe0
     ? report_bug+0xcc/0x150
     ? handle_bug+0x3d/0x70
     ? exc_invalid_op+0x16/0x40
     ? asm_exc_invalid_op+0x16/0x20
     ? refcount_warn_saturate+0x9c/0xe0
     nfs_direct_write_schedule_work+0x237/0x250 [nfs]
     process_one_work+0x12f/0x4a0
     worker_thread+0x14e/0x3b0
     ? ZSTD_getCParams_internal+0x220/0x220
     kthread+0xdc/0x120
     ? __btf_name_valid+0xa0/0xa0
     ret_from_fork+0x1f/0x30
    
    This is because we're completing the nfs_direct_request twice in a row.
    
    The source of this is when we have our commit requests to submit, we
    process them and send them off, and then in the completion path for the
    commit requests we have
    
    if (nfs_commit_end(cinfo.mds))
            nfs_direct_write_complete(dreq);
    
    However since we're submitting asynchronous requests we sometimes have
    one that completes before we submit the next one, so we end up calling
    complete on the nfs_direct_request twice.
    
    The only other place we use nfs_generic_commit_list() is in
    __nfs_commit_inode, which wraps this call in a
    
    nfs_commit_begin();
    nfs_commit_end();
    
    Which is a common pattern for this style of completion handling, one
    that is also repeated in the direct code with get_dreq()/put_dreq()
    calls around where we process events as well as in the completion paths.
    
    Fix this by using the same pattern for the commit requests.
    
    Before with my 200 node rocksdb stress running this warning would pop
    every 10ish minutes.  With my patch the stress test has been running for
    several hours without popping.
    
    Signed-off-by: Josef Bacik <[email protected]>
    Cc: [email protected]
    Signed-off-by: Trond Myklebust <[email protected]>
    [ chanho : Backports v5.4.y, commit 133a48abf6ec (NFS: Fix up commit deadlocks)
      is needed to use nfs_commit_end ]
    Signed-off-by: Chanho Min <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
NFS: Fix up commit deadlocks [+ + +]
Author: Trond Myklebust <[email protected]>
Date:   Mon Oct 4 15:37:42 2021 -0400

    NFS: Fix up commit deadlocks
    
    commit 133a48abf6ecc535d7eddc6da1c3e4c972445882 upstream.
    
    If O_DIRECT bumps the commit_info rpcs_out field, then that could lead
    to fsync() hangs. The fix is to ensure that O_DIRECT calls
    nfs_commit_end().
    
    Fixes: 723c921e7dfc ("sched/wait, fs/nfs: Convert wait_on_atomic_t() usage to the new wait_var_event() API")
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Chanho Min <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

NFS: Fix up handling of outstanding layoutcommit in nfs_update_inode() [+ + +]
Author: Trond Myklebust <[email protected]>
Date:   Sat Aug 16 22:28:11 2025 -0400

    NFS: Fix up handling of outstanding layoutcommit in nfs_update_inode()
    
    [ Upstream commit 709fa5769914b377af87962bbe4ff81ffb019b2d ]
    
    If there is an outstanding layoutcommit, then the list of attributes
    whose values are expected to change is not the full set. So let's
    be explicit about the full list.
    
    Signed-off-by: Trond Myklebust <[email protected]>
    Stable-dep-of: b01f21cacde9 ("NFS: Fix the setting of capabilities when automounting a new filesystem")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
NFSD: detect mismatch of file handle and delegation stateid in OPEN op [+ + +]
Author: Dai Ngo <[email protected]>
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 <[email protected]>
    Fixes: c44c5eeb2c02 ("[PATCH] nfsd4: add open state code for CLAIM_DELEGATE_CUR")
    Cc: [email protected]
    Signed-off-by: Dai Ngo <[email protected]>
    Reviewed-by: Jeff Layton <[email protected]>
    Signed-off-by: Chuck Lever <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
nfsd: handle get_client_locked() failure in nfsd4_setclientid_confirm() [+ + +]
Author: Jeff Layton <[email protected]>
Date:   Fri Aug 15 16:27:45 2025 -0400

    nfsd: handle get_client_locked() failure in nfsd4_setclientid_confirm()
    
    [ Upstream commit 908e4ead7f757504d8b345452730636e298cbf68 ]
    
    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 <[email protected]>
    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: [email protected]
    Signed-off-by: Jeff Layton <[email protected]>
    Signed-off-by: Chuck Lever <[email protected]>
    [ Adjust context ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
NFSv4: Fix nfs4_bitmap_copy_adjust() [+ + +]
Author: Trond Myklebust <[email protected]>
Date:   Sat Aug 16 22:28:10 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 <[email protected]>
    Stable-dep-of: b01f21cacde9 ("NFS: Fix the setting of capabilities when automounting a new filesystem")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
nilfs2: reject invalid file types when reading inodes [+ + +]
Author: Ryusuke Konishi <[email protected]>
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/[email protected]
    Fixes: 05fe58fdc10d ("nilfs2: inode operations")
    Signed-off-by: Ryusuke Konishi <[email protected]>
    Reported-by: [email protected]
    Link: https://syzkaller.appspot.com/bug?extid=895c23f6917da440ed0d
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
parisc: Makefile: fix a typo in palo.conf [+ + +]
Author: Randy Dunlap <[email protected]>
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 <[email protected]>
    Cc: Masahiro Yamada <[email protected]>
    Cc: "James E.J. Bottomley" <[email protected]>
    Cc: Helge Deller <[email protected]>
    Cc: [email protected]
    Signed-off-by: Helge Deller <[email protected]>
    Cc: [email protected] # v5.3+
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
pch_uart: Fix dma_sync_sg_for_device() nents value [+ + +]
Author: Thomas Fourier <[email protected]>
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 <[email protected]>
    Signed-off-by: Thomas Fourier <[email protected]>
    Reviewed-by: Andy Shevchenko <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
PCI/ACPI: Fix runtime PM ref imbalance on Hot-Plug Capable ports [+ + +]
Author: Lukas Wunner <[email protected]>
Date:   Sun Jul 13 16:31:01 2025 +0200

    PCI/ACPI: Fix runtime PM ref imbalance on Hot-Plug Capable ports
    
    commit 6cff20ce3b92ffbf2fc5eb9e5a030b3672aa414a upstream.
    
    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 <[email protected]>
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220216
    Reported-by: Mario Limonciello <[email protected]>
    Closes: https://lore.kernel.org/r/[email protected]/
    Link: https://lore.kernel.org/all/[email protected]/T/#u
    Signed-off-by: Lukas Wunner <[email protected]>
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Acked-by: Rafael J. Wysocki <[email protected]>
    Cc: [email protected] # v4.18+
    Link: https://patch.msgid.link/fe5dcc3b2e62ee1df7905d746bde161eb1b3291c.1752390101.git.lukas@wunner.de
    [ Adjust surrounding documentation changes ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
pci/hotplug/pnv-php: Improve error msg on power state change failure [+ + +]
Author: Frederic Barrat <[email protected]>
Date:   Thu Nov 21 14:49:14 2019 +0100

    pci/hotplug/pnv-php: Improve error msg on power state change failure
    
    [ Upstream commit 323c2a26ff43500a96799250330fab68903d776f ]
    
    When changing the slot state, if opal hits an error and tells as such
    in the asynchronous reply, the warning "Wrong msg" is logged, which is
    rather confusing. Instead we can reuse the better message which is
    already used when we couldn't submit the asynchronous opal request
    initially.
    
    Reviewed-by: Alastair D'Silva <[email protected]>
    Reviewed-by: Andrew Donnellan <[email protected]>
    Signed-off-by: Frederic Barrat <[email protected]>
    Signed-off-by: Michael Ellerman <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Stable-dep-of: 466861909255 ("PCI: pnv_php: Clean up allocated IRQs on unplug")
    Signed-off-by: Sasha Levin <[email protected]>

pci/hotplug/pnv-php: Wrap warnings in macro [+ + +]
Author: Frederic Barrat <[email protected]>
Date:   Thu Nov 21 14:49:17 2019 +0100

    pci/hotplug/pnv-php: Wrap warnings in macro
    
    [ Upstream commit 748ac391ab9acd8d7f3c93cbf3e63c773c0b2638 ]
    
    An opencapi slot doesn't have an associated bridge device. It's not
    needed for operation, but any warning is displayed through pci_warn()
    which uses the pci_dev struct of the assocated bridge device. So wrap
    those warning so that a different trace mechanism can be used if it's
    an opencapi slot.
    
    Reviewed-by: Alastair D'Silva <[email protected]>
    Reviewed-by: Andrew Donnellan <[email protected]>
    Signed-off-by: Frederic Barrat <[email protected]>
    Signed-off-by: Michael Ellerman <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Stable-dep-of: 466861909255 ("PCI: pnv_php: Clean up allocated IRQs on unplug")
    Signed-off-by: Sasha Levin <[email protected]>

 
PCI: endpoint: Fix configfs group list head handling [+ + +]
Author: Damien Le Moal <[email protected]>
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 <[email protected]>
    Signed-off-by: Manivannan Sadhasivam <[email protected]>
    Reviewed-by: Niklas Cassel <[email protected]>
    Cc: [email protected]
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

PCI: endpoint: Fix configfs group removal on driver teardown [+ + +]
Author: Damien Le Moal <[email protected]>
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 <[email protected]>
    Signed-off-by: Manivannan Sadhasivam <[email protected]>
    Reviewed-by: Niklas Cassel <[email protected]>
    Cc: [email protected]
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

PCI: pnv_php: Work around switches with broken presence detection [+ + +]
Author: Timothy Pearson <[email protected]>
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 <[email protected]>
    Signed-off-by: Timothy Pearson <[email protected]>
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Signed-off-by: Madhavan Srinivasan <[email protected]>
    Link: https://patch.msgid.link/505981576.1359853.1752615415117.JavaMail.zimbra@raptorengineeringinc.com
    Signed-off-by: Sasha Levin <[email protected]>

PCI: rockchip-host: Fix "Unexpected Completion" log message [+ + +]
Author: Hans Zhang <[email protected]>
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 <[email protected]>
    [mani: added fixes tag]
    Signed-off-by: Manivannan Sadhasivam <[email protected]>
    Reviewed-by: Manivannan Sadhasivam <[email protected]>
    Acked-by: Shawn Lin <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
perf tests bp_account: Fix leaked file descriptor [+ + +]
Author: Leo Yan <[email protected]>
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 <[email protected]>
    Signed-off-by: Leo Yan <[email protected]>
    Reviewed-by: Ian Rogers <[email protected]>
    Link: https://lore.kernel.org/r/20250711-perf_fix_breakpoint_accounting-v1-1-b314393023f9@arm.com
    Signed-off-by: Namhyung Kim <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
perf/core: Don't leak AUX buffer refcount on allocation failure [+ + +]
Author: Thomas Gleixner <[email protected]>
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 <[email protected]>
    Reviewed-by: Lorenzo Stoakes <[email protected]>
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

perf/core: Exit early on perf_mmap() fail [+ + +]
Author: Thomas Gleixner <[email protected]>
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 <[email protected]>
    Reviewed-by: Lorenzo Stoakes <[email protected]>Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

perf/core: Prevent VMA split of buffer mappings [+ + +]
Author: Thomas Gleixner <[email protected]>
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: [email protected] # ZDI-CAN-27504
    Signed-off-by: Thomas Gleixner <[email protected]>
    Reviewed-by: Lorenzo Stoakes <[email protected]>
    Acked-by: Arnaldo Carvalho de Melo <[email protected]>
    Acked-by: Vlastimil Babka <[email protected]>
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
phonet/pep: Move call to pn_skb_get_dst_sockaddr() earlier in pep_sock_accept() [+ + +]
Author: Nathan Chancellor <[email protected]>
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: [email protected]
    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 <[email protected]>
    Link: https://patch.msgid.link/20250715-net-phonet-fix-uninit-const-pointer-v1-1-8efd1bd188b3@kernel.org
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
pinctrl: stm32: Manage irq affinity settings [+ + +]
Author: Cheick Traore <[email protected]>
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 <[email protected]>
    Signed-off-by: Antonio Borneo <[email protected]>
    Link: https://lore.kernel.org/[email protected]
    Signed-off-by: Linus Walleij <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

pinctrl: sunxi: Fix memory leak on krealloc failure [+ + +]
Author: Yuan Chen <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/[email protected]
    Signed-off-by: Linus Walleij <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
platform/x86: thinkpad_acpi: Handle KCOV __init vs inline mismatches [+ + +]
Author: Kees Cook <[email protected]>
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/[email protected]/ [1]
    Signed-off-by: Kees Cook <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Ilpo Järvinen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
pm: cpupower: Fix the snapshot-order of tsc,mperf, clock in mperf_stop() [+ + +]
Author: Gautham R. Shenoy <[email protected]>
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/[email protected]
    Signed-off-by: Gautham R. Shenoy <[email protected]>
    Signed-off-by: Shuah Khan <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
PM: runtime: Clear power.needs_force_resume in pm_runtime_reinit() [+ + +]
Author: Rafael J. Wysocki <[email protected]>
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 <[email protected]>
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    Reviewed-by: Ulf Hansson <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

PM: sleep: console: Fix the black screen issue [+ + +]
Author: tuhaowen <[email protected]>
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 <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
pmdomain: governor: Consider CPU latency tolerance from pm_domain_cpu_gov [+ + +]
Author: Maulik Shah <[email protected]>
Date:   Tue Jul 22 09:48:27 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 <[email protected]>
    Fixes: e94999688e3a ("PM / Domains: Add genpd governor for CPUs")
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Ulf Hansson <[email protected]>
    [ replaced cpu_latency_qos_limit() with pm_qos_request(PM_QOS_CPU_DMA_LATENCY) ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
pNFS: Fix disk addr range check in block/scsi layout [+ + +]
Author: Sergey Bashirov <[email protected]>
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 <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

pNFS: Fix stripe mapping in block/scsi layout [+ + +]
Author: Sergey Bashirov <[email protected]>
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 <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

pNFS: Fix uninited ptr deref in block/scsi layout [+ + +]
Author: Sergey Bashirov <[email protected]>
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 <[email protected]>
    Signed-off-by: Konstantin Evtushenko <[email protected]>
    Signed-off-by: Sergey Bashirov <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

pNFS: Handle RPC size limit for layoutcommits [+ + +]
Author: Sergey Bashirov <[email protected]>
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 <[email protected]>
    Signed-off-by: Konstantin Evtushenko <[email protected]>
    Signed-off-by: Sergey Bashirov <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
power: supply: bq24190: Fix use after free bug in bq24190_remove due to race condition [+ + +]
Author: Zheng Wang <[email protected]>
Date:   Mon Jul 21 17:18:46 2025 +0530

    power: supply: bq24190: Fix use after free bug in bq24190_remove due to race condition
    
    [ Upstream commit 47c29d69212911f50bdcdd0564b5999a559010d4 ]
    
    In bq24190_probe, &bdi->input_current_limit_work is bound
    with bq24190_input_current_limit_work. When external power
    changed, it will call bq24190_charger_external_power_changed
     to start the work.
    
    If we remove the module which will call bq24190_remove to make
    cleanup, there may be a unfinished work. The possible
    sequence is as follows:
    
    CPU0                  CPUc1
    
                        |bq24190_input_current_limit_work
    bq24190_remove      |
    power_supply_unregister  |
    device_unregister   |
    power_supply_dev_release|
    kfree(psy)          |
                        |
                        | power_supply_get_property_from_supplier
                        |   //use
    
    Fix it by finishing the work before cleanup in the bq24190_remove
    
    Fixes: 97774672573a ("power_supply: Initialize changed_work before calling device_add")
    Signed-off-by: Zheng Wang <[email protected]>
    Signed-off-by: Sebastian Reichel <[email protected]>
    Signed-off-by: Shubham Kulkarni <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

power: supply: bq24190_charger: Fix runtime PM imbalance on error [+ + +]
Author: Dinghao Liu <[email protected]>
Date:   Mon Jul 21 17:18:44 2025 +0530

    power: supply: bq24190_charger: Fix runtime PM imbalance on error
    
    [ Upstream commit 1a37a039711610dd53ec03d8cab9e81875338225 ]
    
    pm_runtime_get_sync() increments the runtime PM usage counter even
    it returns an error code. Thus a pairing decrement is needed on
    the error handling path to keep the counter balanced.
    
    Signed-off-by: Dinghao Liu <[email protected]>
    Reviewed-by: Rafael J. Wysocki <[email protected]>
    Signed-off-by: Sebastian Reichel <[email protected]>
    Stable-dep-of: 47c29d692129 ("power: supply: bq24190: Fix use after free bug in bq24190_remove due to race condition")
    Signed-off-by: Shubham Kulkarni <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

power: supply: bq24190_charger: using pm_runtime_resume_and_get instead of pm_runtime_get_sync [+ + +]
Author: Minghao Chi <[email protected]>
Date:   Mon Jul 21 17:18:45 2025 +0530

    power: supply: bq24190_charger: using pm_runtime_resume_and_get instead of pm_runtime_get_sync
    
    [ Upstream commit d96a89407e5f682d1cb22569d91784506c784863 ]
    
    Using pm_runtime_resume_and_get is more appropriate
    for simplifing code
    
    Reported-by: Zeal Robot <[email protected]>
    Signed-off-by: Minghao Chi <[email protected]>
    Signed-off-by: Sebastian Reichel <[email protected]>
    [ skulkarni: Minor changes in hunk #3/12 wrt the mainline commit ]
    Stable-dep-of: 47c29d692129 ("power: supply: bq24190: Fix use after free bug in bq24190_remove due to race condition")
    Signed-off-by: Shubham Kulkarni <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

power: supply: max14577: Handle NULL pdata when CONFIG_OF is not set [+ + +]
Author: Charles Han <[email protected]>
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 <[email protected]>
    Reviewed-by: Krzysztof Kozlowski <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sebastian Reichel <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
pps: fix poll support [+ + +]
Author: Denis OSTERLAND-HEIM <[email protected]>
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 <[email protected]>
    Co-developed-by: Rodolfo Giometti <[email protected]>
    Signed-off-by: Rodolfo Giometti <[email protected]>
    Fixes: eae9d2ba0cfc ("LinuxPPS: core support")
    Link: https://lore.kernel.org/all/[email protected]/
    Acked-by: Rodolfo Giometti <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
pptp: ensure minimal skb length in pptp_xmit() [+ + +]
Author: Eric Dumazet <[email protected]>
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: [email protected]
    Closes: https://lore.kernel.org/netdev/[email protected]/T/#u
    Signed-off-by: Eric Dumazet <[email protected]>
    Reviewed-by: Dawid Osuchowski <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

pptp: fix pptp_xmit() error path [+ + +]
Author: Eric Dumazet <[email protected]>
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: [email protected]
    Closes: https://lore.kernel.org/netdev/[email protected]/
    Signed-off-by: Eric Dumazet <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
pwm: imx-tpm: Reset counter if CMOD is 0 [+ + +]
Author: Laurentiu Mihalcea <[email protected]>
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: [email protected]
    Signed-off-by: Laurentiu Mihalcea <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Uwe Kleine-König <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

pwm: mediatek: Fix duty and period setting [+ + +]
Author: Uwe Kleine-König <[email protected]>
Date:   Fri Aug 22 15:05:27 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 <[email protected]>
    Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
    Link: https://lore.kernel.org/r/6d1fa87a76f8020bfe3171529b8e19baffceab10.1753717973.git.u.kleine-koenig@baylibre.com
    Cc: [email protected]
    Signed-off-by: Uwe Kleine-König <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

pwm: mediatek: Handle hardware enable and clock enable separately [+ + +]
Author: Uwe Kleine-König <[email protected]>
Date:   Fri Aug 22 15:05:26 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 <[email protected]>
    Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
    Link: https://lore.kernel.org/r/55c94fe2917ece152ee1e998f4675642a7716f13.1753717973.git.u.kleine-koenig@baylibre.com
    Cc: [email protected]
    Signed-off-by: Uwe Kleine-König <[email protected]>
    Stable-dep-of: f21d136caf81 ("pwm: mediatek: Fix duty and period setting")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

pwm: mediatek: Implement .apply() callback [+ + +]
Author: Uwe Kleine-König <[email protected]>
Date:   Fri Aug 22 15:05:25 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 <[email protected]>
    Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
    Signed-off-by: Thierry Reding <[email protected]>
    Stable-dep-of: f21d136caf81 ("pwm: mediatek: Fix duty and period setting")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
rcu: Protect ->defer_qs_iw_pending from data race [+ + +]
Author: Paul E. McKenney <[email protected]>
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 <[email protected]>
    Reviewed-by: Frederic Weisbecker <[email protected]>
    Signed-off-by: Neeraj Upadhyay (AMD) <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
RDMA/core: Rate limit GID cache warning messages [+ + +]
Author: Maor Gottlieb <[email protected]>
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 <[email protected]>
    Signed-off-by: Leon Romanovsky <[email protected]>
    Signed-off-by: Jason Gunthorpe <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
RDMA: hfi1: fix possible divide-by-zero in find_hw_thread_mask() [+ + +]
Author: Yury Norov [NVIDIA] <[email protected]>
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] <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Leon Romanovsky <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
Reapply "wifi: mac80211: Update skb's control block key in ieee80211_tx_dequeue()" [+ + +]
Author: Remi Pommarel <[email protected]>
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 <[email protected]>
    Link: https://patch.msgid.link/66b8fc39fb0194fa06c9ca7eeb6ffe0118dcb3ec.1752765971.git.repk@triplefau.lt
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
regulator: core: fix NULL dereference on unbind due to stale coupling data [+ + +]
Author: Alessandro Carminati <[email protected]>
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 <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
Revert "vgacon: Add check for vc_origin address range in vgacon_scroll()" [+ + +]
Author: Helge Deller <[email protected]>
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 <[email protected]>
    Cc: [email protected]
    Cc: Yi Yang <[email protected]>
    Cc: GONG Ruiqi <[email protected]>
    Signed-off-by: Helge Deller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
Revert "vmci: Prevent the dispatching of uninitialized payloads" [+ + +]
Author: Greg Kroah-Hartman <[email protected]>
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 <[email protected]>
    Cc: Lizhi Xu <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
rtc: ds1307: fix incorrect maximum clock rate handling [+ + +]
Author: Brian Masney <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Alexandre Belloni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

rtc: ds1307: handle oscillator stop flag (OSF) for ds1341 [+ + +]
Author: Meagan Lloyd <[email protected]>
Date:   Wed Aug 20 16:06:04 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 <[email protected]>
    Reviewed-by: Tyler Hicks <[email protected]>
    Acked-by: Rodolfo Giometti <[email protected]>
    Link: https://lore.kernel.org/r/1749665656-30108-3-git-send-email-meaganlloyd@linux.microsoft.com
    Signed-off-by: Alexandre Belloni <[email protected]>
    
    [ Git was trying to insert the code above the ds_1388 case statement block (in
    each respective function) which don't exist in the v5.4.296 rtc-ds1307 driver,
    thus a manual fixup was required. ]
    Signed-off-by: Meagan Lloyd <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

rtc: ds1307: remove clear of oscillator stop flag (OSF) in probe [+ + +]
Author: Meagan Lloyd <[email protected]>
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 <[email protected]>
    Reviewed-by: Tyler Hicks <[email protected]>
    Acked-by: Rodolfo Giometti <[email protected]>
    Link: https://lore.kernel.org/r/1749665656-30108-2-git-send-email-meaganlloyd@linux.microsoft.com
    Signed-off-by: Alexandre Belloni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

rtc: hym8563: fix incorrect maximum clock rate handling [+ + +]
Author: Brian Masney <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Alexandre Belloni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

rtc: pcf8563: fix incorrect maximum clock rate handling [+ + +]
Author: Brian Masney <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Alexandre Belloni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
s390/hypfs: Avoid unnecessary ioctl registration in debugfs [+ + +]
Author: Peter Oberparleiter <[email protected]>
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 <[email protected]>
    Reviewed-by: Vasily Gorbik <[email protected]>
    Fixes: 5496197f9b08 ("debugfs: Restrict debugfs when the kernel is locked down")
    Signed-off-by: Peter Oberparleiter <[email protected]>
    Signed-off-by: Alexander Gordeev <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

s390/hypfs: Enable limited access during lockdown [+ + +]
Author: Peter Oberparleiter <[email protected]>
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 <[email protected]>
    Reviewed-by: Vasily Gorbik <[email protected]>
    Fixes: 5496197f9b08 ("debugfs: Restrict debugfs when the kernel is locked down")
    Signed-off-by: Peter Oberparleiter <[email protected]>
    Signed-off-by: Alexander Gordeev <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
s390/stp: Remove udelay from stp_sync_clock() [+ + +]
Author: Sven Schnelle <[email protected]>
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 <[email protected]>
    Signed-off-by: Sven Schnelle <[email protected]>
    Signed-off-by: Alexander Gordeev <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
s390/time: Use monotonic clock in get_cycles() [+ + +]
Author: Sven Schnelle <[email protected]>
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 <[email protected]>
    Reviewed-by: Heiko Carstens <[email protected]>
    Signed-off-by: Alexander Gordeev <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
samples: mei: Fix building on musl libc [+ + +]
Author: Brahmajit Das <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
sch_drr: make drr_qlen_notify() idempotent [+ + +]
Author: Cong Wang <[email protected]>
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 <[email protected]>
    Signed-off-by: Cong Wang <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Acked-by: Jamal Hadi Salim <[email protected]>
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Siddh Raman Pant <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
sch_hfsc: make hfsc_qlen_notify() idempotent [+ + +]
Author: Cong Wang <[email protected]>
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 <[email protected]>
    Signed-off-by: Cong Wang <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Acked-by: Jamal Hadi Salim <[email protected]>
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Siddh Raman Pant <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
sch_qfq: make qfq_qlen_notify() idempotent [+ + +]
Author: Cong Wang <[email protected]>
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 <[email protected]>
    Signed-off-by: Cong Wang <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Acked-by: Jamal Hadi Salim <[email protected]>
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Siddh Raman Pant <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
scsi: aacraid: Stop using PCI_IRQ_AFFINITY [+ + +]
Author: John Garry <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Closes: https://lore.kernel.org/linux-scsi/[email protected]/
    Reviewed-by: John Meneghini <[email protected]>
    Tested-by: John Meneghini <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: bfa: Double-free fix [+ + +]
Author: jackysliu <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: Fix sas_user_scan() to handle wildcard and multi-channel scans [+ + +]
Author: Ranjan Kumar <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: ibmvscsi_tgt: Fix dma_unmap_sg() nents value [+ + +]
Author: Thomas Fourier <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: isci: Fix dma_unmap_sg() nents value [+ + +]
Author: Thomas Fourier <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: libiscsi: Initialize iscsi_conn->dd_data only if memory is allocated [+ + +]
Author: Showrya M N <[email protected]>
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 <[email protected]>
    Signed-off-by: Potnuri Bharat Teja <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Chris Leech <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: lpfc: Check for hdwq null ptr when cleaning up lpfc_vport structure [+ + +]
Author: Justin Tee <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: lpfc: Remove redundant assignment to avoid memory leak [+ + +]
Author: Jiasheng Jiang <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Justin Tee <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: mpt3sas: Correctly handle ATA device errors [+ + +]
Author: Damien Le Moal <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Tested-by: Yafang Shao <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: mvsas: Fix dma_unmap_sg() nents value [+ + +]
Author: Thomas Fourier <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: qla4xxx: Prevent a potential error pointer dereference [+ + +]
Author: Dan Carpenter <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Chris Leech <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
sctp: linearize cloned gso packets in sctp_rcv [+ + +]
Author: Xin Long <[email protected]>
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: [email protected]
    Reported-by: [email protected]
    Signed-off-by: Xin Long <[email protected]>
    Reviewed-by: Marcelo Ricardo Leitner <[email protected]>
    Link: https://patch.msgid.link/dd7dc337b99876d4132d0961f776913719f7d225.1754595611.git.lucien.xin@gmail.com
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
securityfs: don't pin dentries twice, once is enough... [+ + +]
Author: Al Viro <[email protected]>
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 <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
selftests/futex: Define SYS_futex on 32-bit architectures with 64-bit time_t [+ + +]
Author: Cynthia Huang <[email protected]>
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 <[email protected]>
    Signed-off-by: Ben Zong-You Xie <[email protected]>
    Signed-off-by: Thomas Gleixner <[email protected]>
    Reviewed-by: Muhammad Usama Anjum <[email protected]>
    Link: https://lore.kernel.org/all/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
selftests: forwarding: tc_actions.sh: add matchall mirror test [+ + +]
Author: Jiri Pirko <[email protected]>
Date:   Fri Jul 25 00:56:16 2025 +0530

    selftests: forwarding: tc_actions.sh: add matchall mirror test
    
    [ Upstream commit 075c8aa79d541ea08c67a2e6d955f6457e98c21c ]
    
    Add test for matchall classifier with mirred egress mirror action.
    
    Signed-off-by: Jiri Pirko <[email protected]>
    Signed-off-by: Ido Schimmel <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Stable-dep-of: ca22da2fbd69 ("act_mirred: use the backlog for nested calls to mirred ingress")
    Signed-off-by: Shubham Kulkarni <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

selftests: rtnetlink.sh: remove esp4_offload after test [+ + +]
Author: Xiumei Mu <[email protected]>
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 <[email protected]>
    Reviewed-by: Shannon Nelson <[email protected]>
    Reviewed-by: Hangbin Liu <[email protected]>
    Link: https://patch.msgid.link/6d3a1d777c4de4eb0ca94ced9e77be8d48c5b12f.1753415428.git.xmu@redhat.com
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

selftests: tracing: Use mutex_unlock for testing glob filter [+ + +]
Author: Masami Hiramatsu (Google) <[email protected]>
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) <[email protected]>
    Acked-by: Steven Rostedt (Google) <[email protected]>
    Signed-off-by: Shuah Khan <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
serial: 8250: fix panic due to PSLVERR [+ + +]
Author: Yunhui Cui <[email protected]>
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/[email protected]/T/
    Signed-off-by: Yunhui Cui <[email protected]>
    Reviewed-by: John Ogness <[email protected]>
    Cc: stable <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    [ Applied fix to serial8250_do_startup() instead of serial8250_initialize() ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
smb: client: let recv_done() cleanup before notifying the callers. [+ + +]
Author: Stefan Metzmacher <[email protected]>
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 <[email protected]>
    Cc: Tom Talpey <[email protected]>
    Cc: Long Li <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Fixes: f198186aa9bb ("CIFS: SMBD: Establish SMB Direct connection")
    Signed-off-by: Stefan Metzmacher <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
soc/tegra: pmc: Ensure power-domains are in a known state [+ + +]
Author: Jon Hunter <[email protected]>
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 <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Ulf Hansson <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
soc: aspeed: lpc-snoop: Cleanup resources in stack-order [+ + +]
Author: Andrew Jeffery <[email protected]>
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: [email protected]
    Cc: Jean Delvare <[email protected]>
    Acked-by: Jean Delvare <[email protected]>
    Link: https://patch.msgid.link/20250616-aspeed-lpc-snoop-fixes-v2-1-3cdd59c934d3@codeconstruct.com.au
    Signed-off-by: Andrew Jeffery <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

soc: aspeed: lpc-snoop: Don't disable channels that aren't enabled [+ + +]
Author: Andrew Jeffery <[email protected]>
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: [email protected]
    Cc: Jean Delvare <[email protected]>
    Acked-by: Jean Delvare <[email protected]>
    Link: https://patch.msgid.link/20250616-aspeed-lpc-snoop-fixes-v2-2-3cdd59c934d3@codeconstruct.com.au
    Signed-off-by: Andrew Jeffery <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

soc: qcom: mdt_loader: Ensure we don't read past the ELF header [+ + +]
Author: Bjorn Andersson <[email protected]>
Date:   Fri Aug 22 14:49:39 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: [email protected]
    Reported-by: Doug Anderson <[email protected]>
    Signed-off-by: Bjorn Andersson <[email protected]>
    Reviewed-by: Dmitry Baryshkov <[email protected]>
    Link: https://lore.kernel.org/r/20250610-mdt-loader-validation-and-fixes-v2-1-f7073e9ab899@oss.qualcomm.com
    Signed-off-by: Bjorn Andersson <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
soundwire: stream: restore params when prepare ports fail [+ + +]
Author: Bard Liao <[email protected]>
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 <[email protected]>
    Reviewed-by: Péter Ujfalusi <[email protected]>
    Reviewed-by: Ranjani Sridharan <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Vinod Koul <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
squashfs: fix memory leak in squashfs_fill_super [+ + +]
Author: Phillip Lougher <[email protected]>
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/[email protected]
    Fixes: 734aa85390ea ("Squashfs: check return result of sb_min_blocksize")
    Signed-off-by: Phillip Lougher <[email protected]>
    Reported-by: Scott GUO <[email protected]>
    Closes: https://lore.kernel.org/all/[email protected]
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
staging: fbtft: fix potential memory leak in fbtft_framebuffer_alloc() [+ + +]
Author: Abdun Nihaal <[email protected]>
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 <[email protected]>
    Reviewed-by: Dan Carpenter <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

staging: nvec: Fix incorrect null termination of battery manufacturer [+ + +]
Author: Alok Tiwari <[email protected]>
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 <[email protected]>
    Reviewed-by: Dan Carpenter <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
sunvdc: Balance device refcount in vdc_port_mpgroup_check [+ + +]
Author: Ma Ke <[email protected]>
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: [email protected]
    Fixes: 3ee70591d6c4 ("sunvdc: prevent sunvdc panic when mpgroup disk added to guest domain")
    Signed-off-by: Ma Ke <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
tcp: fix tcp_ofo_queue() to avoid including too much DUP SACK range [+ + +]
Author: xin.guo <[email protected]>
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 <[email protected]>
    Signed-off-by: Eric Dumazet <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
thermal: sysfs: Return ENODATA instead of EAGAIN for reads [+ + +]
Author: Hsin-Te Yuan <[email protected]>
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 <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
thunderbolt: Fix copy+paste error in match_service_id() [+ + +]
Author: Eric Biggers <[email protected]>
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 <[email protected]>
    Signed-off-by: Eric Biggers <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
tracing: Add down_write(trace_event_sem) when adding trace event [+ + +]
Author: Steven Rostedt <[email protected]>
Date:   Tue Jul 22 10:13:20 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: [email protected]
    Cc: Mathieu Desnoyers <[email protected]>
    Acked-by: Masami Hiramatsu (Google) <[email protected]>
    Link: https://lore.kernel.org/[email protected]
    Reported-by: Fusheng Huang(黄富生)  <[email protected]>
    Closes: https://lore.kernel.org/all/[email protected]/
    Fixes: 110bf2b764eb6 ("tracing: add protection around module events unload")
    Signed-off-by: Steven Rostedt (Google) <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
uapi: in6: restore visibility of most IPv6 socket options [+ + +]
Author: Jakub Kicinski <[email protected]>
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/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
udf: Verify partition map count [+ + +]
Author: Jan Kara <[email protected]>
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: [email protected]
    Signed-off-by: Jan Kara <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
udp: also consider secpath when evaluating ipsec use for checksumming [+ + +]
Author: Sabrina Dubroca <[email protected]>
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 <[email protected]>
    Signed-off-by: Steffen Klassert <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
usb: atm: cxacru: Merge cxacru_upload_firmware() into cxacru_heavy_init() [+ + +]
Author: Nathan Chancellor <[email protected]>
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: [email protected]
    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 <[email protected]>
    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 <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
USB: cdc-acm: do not log successful probe on later errors [+ + +]
Author: Johan Hovold <[email protected]>
Date:   Mon Aug 18 19:13:57 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 <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Stable-dep-of: 64690a90cd7c ("cdc-acm: fix race between initial clearing halt and open")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
usb: chipidea: add USB PHY event [+ + +]
Author: Xu Yang <[email protected]>
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 <[email protected]>
    Acked-by: Peter Chen <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

usb: chipidea: introduce CI_HDRC_CONTROLLER_VBUS_EVENT glue layer use [+ + +]
Author: Peter Chen <[email protected]>
Date:   Thu Jan 23 14:00:26 2020 +0800

    usb: chipidea: introduce CI_HDRC_CONTROLLER_VBUS_EVENT glue layer use
    
    [ Upstream commit d755cdb1b9d7e1b645e176b97eb137194bbe8cf9 ]
    
    Some vendors glue layer need to handle some events for vbus, eg,
    some i.mx platforms (imx7d, imx8mm, imx8mn, etc) needs vbus event
    to handle charger detection, its charger detection is finished at
    glue layer code, but not at USB PHY driver.
    
    Signed-off-by: Peter Chen <[email protected]>
    Stable-dep-of: b7a62611fab7 ("usb: chipidea: add USB PHY event")
    Signed-off-by: Sasha Levin <[email protected]>

usb: chipidea: udc: add new API ci_hdrc_gadget_connect [+ + +]
Author: Peter Chen <[email protected]>
Date:   Tue Sep 10 10:54:52 2019 +0800

    usb: chipidea: udc: add new API ci_hdrc_gadget_connect
    
    [ Upstream commit d16ab536aad208421c5ed32cdcb01b5ab6aa1f19 ]
    
    This API is used enable device function, it is called at below
    situations:
    - VBUS is connected during boots up
    - Hot plug occurs during runtime
    
    Signed-off-by: Peter Chen <[email protected]>
    Signed-off-by: Jun Li <[email protected]>
    Stable-dep-of: b7a62611fab7 ("usb: chipidea: add USB PHY event")
    Signed-off-by: Sasha Levin <[email protected]>

usb: chipidea: udc: fix sleeping function called from invalid context [+ + +]
Author: Peter Chen <[email protected]>
Date:   Mon Mar 16 11:10:34 2020 +0800

    usb: chipidea: udc: fix sleeping function called from invalid context
    
    [ Upstream commit 7368760d1bcdabf515c41a502568b489de3da683 ]
    
    The code calls pm_runtime_get_sync with irq disabled, it causes below
    warning:
    
    BUG: sleeping function called from invalid context at
    wer/runtime.c:1075
    in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid:
    er/u8:1
    CPU: 1 PID: 37 Comm: kworker/u8:1 Not tainted
    20200304-00181-gbebfd2a5be98 #1588
    Hardware name: NVIDIA Tegra SoC (Flattened Device Tree)
    Workqueue: ci_otg ci_otg_work
    [<c010e8bd>] (unwind_backtrace) from [<c010a315>]
    1/0x14)
    [<c010a315>] (show_stack) from [<c0987d29>]
    5/0x94)
    [<c0987d29>] (dump_stack) from [<c013e77f>]
    +0xeb/0x118)
    [<c013e77f>] (___might_sleep) from [<c052fa1d>]
    esume+0x75/0x78)
    [<c052fa1d>] (__pm_runtime_resume) from [<c0627a33>]
    0x23/0x74)
    [<c0627a33>] (ci_udc_pullup) from [<c062fb93>]
    nect+0x2b/0xcc)
    [<c062fb93>] (usb_gadget_connect) from [<c062769d>]
    _connect+0x59/0x104)
    [<c062769d>] (ci_hdrc_gadget_connect) from [<c062778b>]
    ssion+0x43/0x48)
    [<c062778b>] (ci_udc_vbus_session) from [<c062f997>]
    s_connect+0x17/0x9c)
    [<c062f997>] (usb_gadget_vbus_connect) from [<c062634d>]
    bd/0x128)
    [<c062634d>] (ci_otg_work) from [<c0134719>]
    rk+0x149/0x404)
    [<c0134719>] (process_one_work) from [<c0134acb>]
    0xf7/0x3bc)
    [<c0134acb>] (worker_thread) from [<c0139433>]
    x118)
    [<c0139433>] (kthread) from [<c01010bd>]
    (ret_from_fork+0x11/0x34)
    
    Tested-by: Dmitry Osipenko <[email protected]>
    Cc: <[email protected]> #v5.5
    Fixes: 72dc8df7920f ("usb: chipidea: udc: protect usb interrupt enable")
    Reported-by: Dmitry Osipenko <[email protected]>
    Signed-off-by: Peter Chen <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

usb: chipidea: udc: protect usb interrupt enable [+ + +]
Author: Jun Li <[email protected]>
Date:   Tue Sep 10 14:54:57 2019 +0800

    usb: chipidea: udc: protect usb interrupt enable
    
    [ Upstream commit 72dc8df7920fc24eba0f586c56e900a1643ff2b3 ]
    
    We hit the problem with below sequence:
    - ci_udc_vbus_session() update vbus_active flag and ci->driver
    is valid,
    - before calling the ci_hdrc_gadget_connect(),
    usb_gadget_udc_stop() is called by application remove gadget
    driver,
    - ci_udc_vbus_session() will contine do ci_hdrc_gadget_connect() as
    gadget_ready is 1, so udc interrupt is enabled, but ci->driver is
    NULL.
    - USB connection irq generated but ci->driver is NULL.
    
    As udc irq only should be enabled when gadget driver is binded, so
    add spinlock to protect the usb irq enable for vbus session handling.
    
    Signed-off-by: Jun Li <[email protected]>
    Signed-off-by: Peter Chen <[email protected]>
    Stable-dep-of: b7a62611fab7 ("usb: chipidea: add USB PHY event")
    Signed-off-by: Sasha Levin <[email protected]>

usb: core: usb_submit_urb: downgrade type check [+ + +]
Author: Oliver Neukum <[email protected]>
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 <[email protected]>
    Acked-by: Alan Stern <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

usb: dwc3: Ignore late xferNotReady event to prevent halt timeout [+ + +]
Author: Kuen-Han Tsai <[email protected]>
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 <[email protected]>
    Signed-off-by: Kuen-Han Tsai <[email protected]>
    Acked-by: Thinh Nguyen <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: dwc3: meson-g12a: fix device leaks at unbind [+ + +]
Author: Johan Hovold <[email protected]>
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: [email protected]      # 5.2
    Cc: Neil Armstrong <[email protected]>
    Signed-off-by: Johan Hovold <[email protected]>
    Reviewed-by: Martin Blumenstingl <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: dwc3: qcom: Don't leave BCR asserted [+ + +]
Author: Krishna Kurapati <[email protected]>
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 <[email protected]>
    Fixes: a4333c3a6ba9 ("usb: dwc3: Add Qualcomm DWC3 glue driver")
    Acked-by: Thinh Nguyen <[email protected]>
    Reviewed-by: Konrad Dybcio <[email protected]>
    Signed-off-by: Krishna Kurapati <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    [ adapted to individual clock management API instead of bulk clock operations ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: early: xhci-dbc: Fix early_ioremap leak [+ + +]
Author: Lucas De Marchi <[email protected]>
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 <[email protected]>
    Fixes: aeb9dd1de98c ("usb/early: Add driver for xhci debug capability")
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

usb: gadget : fix use-after-free in composite_dev_cleanup() [+ + +]
Author: Tao Xue <[email protected]>
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 <[email protected]>
    Signed-off-by: Tao Xue <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: gadget: configfs: Fix OOB read on empty string write [+ + +]
Author: Xinyu Liu <[email protected]>
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 <[email protected]>
    Cc: stable <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: gadget: udc: renesas_usb3: fix device leak at unbind [+ + +]
Author: Johan Hovold <[email protected]>
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: [email protected]      # 4.19
    Cc: Yoshihiro Shimoda <[email protected]>
    Signed-off-by: Johan Hovold <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: hub: avoid warm port reset during USB3 disconnect [+ + +]
Author: Mathias Nyman <[email protected]>
Date:   Tue Jul 22 18:58:38 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 <[email protected]>
    Signed-off-by: Mathias Nyman <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Stable-dep-of: 2521106fc732 ("usb: hub: Don't try to recover devices lost during warm reset.")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: hub: Don't try to recover devices lost during warm reset. [+ + +]
Author: Mathias Nyman <[email protected]>
Date:   Tue Jul 22 18:58:39 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: [email protected]
    Fixes: 8bea2bd37df0 ("usb: Add support for root hub port status CAS")
    Tested-by: Łukasz Bartosik <[email protected]>
    Signed-off-by: Mathias Nyman <[email protected]>
    Acked-by: Alan Stern <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: hub: fix detection of high tier USB3 devices behind suspended hubs [+ + +]
Author: Mathias Nyman <[email protected]>
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 <[email protected]>
    Fixes: 2839f5bcfcfc ("USB: Turn on auto-suspend for USB 3.0 hubs.")
    Acked-by: Alan Stern <[email protected]>
    Signed-off-by: Mathias Nyman <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    [ replaced hub_get/hub_put wrapper functions with direct kref_get/kref_put calls ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: hub: Fix flushing and scheduling of delayed work that tunes runtime pm [+ + +]
Author: Mathias Nyman <[email protected]>
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 <[email protected]>
    Fixes: 8f5b7e2bec1c ("usb: hub: fix detection of high tier USB3 devices behind suspended hubs")
    Reported-by: Konrad Dybcio <[email protected]>
    Closes: https://lore.kernel.org/linux-usb/[email protected]
    Reported-by: Alan Stern <[email protected]>
    Closes: https://lore.kernel.org/linux-usb/[email protected]
    Signed-off-by: Mathias Nyman <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: musb: fix gadget state on disconnect [+ + +]
Author: Drew Hamilton <[email protected]>
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: [email protected]
    Co-authored-by: Yehowshua Immanuel <[email protected]>
    Signed-off-by: Yehowshua Immanuel <[email protected]>
    Signed-off-by: Drew Hamilton <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    [ replaced musb_set_state() call with direct otg state assignment ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: musb: omap2430: fix device leak at unbind [+ + +]
Author: Johan Hovold <[email protected]>
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: [email protected]      # 3.13
    Cc: Roger Quadros <[email protected]>
    Signed-off-by: Johan Hovold <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    [ Removed populate_irqs-related goto changes ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: net: sierra: check for no status endpoint [+ + +]
Author: Oliver Neukum <[email protected]>
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: [email protected]
    Closes: https://lore.kernel.org/linux-usb/[email protected]/
    Tested-by: [email protected]
    Fixes: eb4fd8cd355c8 ("net/usb: add sierra_net.c driver")
    Signed-off-by: Oliver Neukum <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

usb: phy: mxs: disconnect line when USB charger is attached [+ + +]
Author: Xu Yang <[email protected]>
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 <[email protected]>
    Acked-by: Peter Chen <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

usb: quirks: Add DELAY_INIT quick for another SanDisk 3.2Gen1 Flash Drive [+ + +]
Author: Miao Li <[email protected]>
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 <[email protected]>
    Cc: stable <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
USB: serial: ftdi_sio: add support for NDI EMGUIDE GEMINI [+ + +]
Author: Ryan Mann (NDI) <[email protected]>
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 <[email protected]>
    Cc: [email protected]
    Signed-off-by: Johan Hovold <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: serial: option: add Foxconn T99W640 [+ + +]
Author: Slark Xiao <[email protected]>
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 <[email protected]>
    Cc: [email protected]
    Signed-off-by: Johan Hovold <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: serial: option: add Foxconn T99W709 [+ + +]
Author: Slark Xiao <[email protected]>
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 <[email protected]>
    Cc: [email protected]
    Signed-off-by: Johan Hovold <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: serial: option: add Telit Cinterion FE910C04 (ECM) composition [+ + +]
Author: Fabio Porcedda <[email protected]>
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: [email protected]
    Signed-off-by: Fabio Porcedda <[email protected]>
    Signed-off-by: Johan Hovold <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
USB: storage: Add unusual-devs entry for Novatek NTK96550-based camera [+ + +]
Author: Mael GUERIN <[email protected]>
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 <[email protected]>
    Cc: stable <[email protected]>
    Acked-by: Alan Stern <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: storage: Ignore driver CD mode for Realtek multi-mode Wi-Fi dongles [+ + +]
Author: Zenm Chen <[email protected]>
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 <[email protected]>
    Signed-off-by: Zenm Chen <[email protected]>
    Acked-by: Alan Stern <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
usb: storage: realtek_cr: Use correct byte order for bcs->Residue [+ + +]
Author: Thorsten Blum <[email protected]>
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 <[email protected]>
    Fixes: 50a6cb932d5c ("USB: usb_storage: add ums-realtek driver")
    Suggested-by: Alan Stern <[email protected]>
    Acked-by: Alan Stern <[email protected]>
    Signed-off-by: Thorsten Blum <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: typec: fusb302: cache PD RX state [+ + +]
Author: Sebastian Reichel <[email protected]>
Date:   Mon Aug 18 19:08:42 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 <[email protected]>
    Signed-off-by: Sebastian Reichel <[email protected]>
    Reviewed-by: Heikki Krogerus <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    [ replaced str_on_off(on) with ternary operator ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: xhci: Avoid showing errors during surprise removal [+ + +]
Author: Mario Limonciello <[email protected]>
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 <[email protected]>
    Signed-off-by: Mathias Nyman <[email protected]>
    Acked-by: Mathias Nyman <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

usb: xhci: Avoid showing warnings for dying controller [+ + +]
Author: Mario Limonciello <[email protected]>
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 <[email protected]>
    Signed-off-by: Mathias Nyman <[email protected]>
    Acked-by: Mathias Nyman <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

usb: xhci: Fix slot_id resource race conflict [+ + +]
Author: Weitao Wang <[email protected]>
Date:   Tue Aug 19 15:58:43 2025 +0300

    usb: xhci: Fix slot_id resource race conflict
    
    commit 2eb03376151bb8585caa23ed2673583107bb5193 upstream.
    
    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: [email protected]
    Fixes: 7faac1953ed1 ("xhci: avoid race between disable slot command and host runtime suspend")
    Signed-off-by: Weitao Wang <[email protected]>
    Signed-off-by: Mathias Nyman <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: xhci: print xhci->xhc_state when queue_command failed [+ + +]
Author: Su Hui <[email protected]>
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 <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

usb: xhci: Set avg_trb_len = 8 for EP0 during Address Device Command [+ + +]
Author: Jay Chen <[email protected]>
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 <[email protected]>
    Signed-off-by: Mathias Nyman <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
Linux: use uniform permission checks for all mount propagation changes [+ + +]
Author: Al Viro <[email protected]>
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 <[email protected]>
    Reviewed-by: Pavel Tikhomirov <[email protected]>
    Tested-by: Pavel Tikhomirov <[email protected]>
    Reviewed-by: Christian Brauner <[email protected]>
    Signed-off-by: Al Viro <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
vhost: fail early when __vhost_add_used() fails [+ + +]
Author: Jason Wang <[email protected]>
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 <[email protected]>
    Signed-off-by: Jason Wang <[email protected]>
    Message-Id: <[email protected]>
    Signed-off-by: Michael S. Tsirkin <[email protected]>
    Tested-by: Lei Yang <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
virtio-net: ensure the received length does not exceed allocated size [+ + +]
Author: Bui Quang Minh <[email protected]>
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: <[email protected]>
    Fixes: 4941d472bf95 ("virtio-net: do not reset during XDP set")
    Signed-off-by: Bui Quang Minh <[email protected]>
    Acked-by: Jason Wang <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    [ adapted virtqueue_get_buf() to virtqueue_get_buf_ctx() ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
vmci: Prevent the dispatching of uninitialized payloads [+ + +]
Author: Lizhi Xu <[email protected]>
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: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=9b9124ae9b12d5af5d95
    Tested-by: [email protected]
    Signed-off-by: Lizhi Xu <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
vrf: Drop existing dst reference in vrf_ip6_input_dst [+ + +]
Author: Stanislav Fomichev <[email protected]>
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 <[email protected]>
    Reviewed-by: Ido Schimmel <[email protected]>
    Fixes: 9ff74384600a ("net: vrf: Handle ipv6 multicast and link-local addresses")
    Signed-off-by: Stanislav Fomichev <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
vsock: Do not allow binding to VMADDR_PORT_ANY [+ + +]
Author: Budimir Markovic <[email protected]>
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 <[email protected]>
    Signed-off-by: Budimir Markovic <[email protected]>
    Reviewed-by: Stefano Garzarella <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
vt: defkeymap: Map keycodes above 127 to K_HOLE [+ + +]
Author: Myrrh Periwinkle <[email protected]>
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 <[email protected]>
    Cc: stable <[email protected]>
    Reviewed-by: Jiri Slaby <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

vt: keyboard: Don't process Unicode characters in K_OFF mode [+ + +]
Author: Myrrh Periwinkle <[email protected]>
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 <[email protected]>
    Cc: stable <[email protected]>
    Reviewed-by: Jiri Slaby <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
watchdog: dw_wdt: Fix default timeout [+ + +]
Author: Sebastian Reichel <[email protected]>
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 <[email protected]>
    Reviewed-by: Guenter Roeck <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Wim Van Sebroeck <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

watchdog: ziirave_wdt: check record length in ziirave_firm_verify() [+ + +]
Author: Dan Carpenter <[email protected]>
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 <[email protected]>
    Reviewed-by: Guenter Roeck <[email protected]>
    Link: https://lore.kernel.org/r/3b58b453f0faa8b968c90523f52c11908b56c346.1748463049.git.dan.carpenter@linaro.org
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Wim Van Sebroeck <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
wifi: brcmfmac: fix P2P discovery failure in P2P peer due to missing P2P IE [+ + +]
Author: Gokul Sivakumar <[email protected]>
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 <[email protected]>
    Acked-by: Arend van Spriel <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

wifi: brcmsmac: Remove const from tbl_ptr parameter in wlc_lcnphy_common_read_table() [+ + +]
Author: Nathan Chancellor <[email protected]>
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: [email protected]
    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 <[email protected]>
    Acked-by: Arend van Spriel <[email protected]>>
    Link: https://patch.msgid.link/20250715-brcmsmac-fix-uninit-const-pointer-v1-1-16e6a51a8ef4@kernel.org
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

wifi: cfg80211: Fix interface type validation [+ + +]
Author: Ilan Peer <[email protected]>
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 <[email protected]>
    Signed-off-by: Miri Korenblit <[email protected]>
    Link: https://patch.msgid.link/20250709233537.7ad199ca5939.I0ac1ff74798bf59a87a57f2e18f2153c308b119b@changeid
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

wifi: cfg80211: reject HTC bit for management frames [+ + +]
Author: Johannes Berg <[email protected]>
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 <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

wifi: iwlegacy: Check rate_idx range after addition [+ + +]
Author: Stanislaw Gruszka <[email protected]>
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 <[email protected]>
    Reported-by: Alexei Safin <[email protected]>
    Signed-off-by: Stanislaw Gruszka <[email protected]>
    Reviewed-by: Fedor Pchelkin <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

wifi: iwlwifi: dvm: fix potential overflow in rs_fill_link_cmd() [+ + +]
Author: Rand Deeb <[email protected]>
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 <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Miri Korenblit <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

wifi: iwlwifi: Fix memory leak in iwl_mvm_init() [+ + +]
Author: Xiu Jianfeng <[email protected]>
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 <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Miri Korenblit <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

wifi: iwlwifi: fw: Fix possible memory leak in iwl_fw_dbg_collect [+ + +]
Author: Pagadala Yesu Anjaneyulu <[email protected]>
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 <[email protected]>
    Signed-off-by: Miri Korenblit <[email protected]>
    Link: https://patch.msgid.link/20250611222325.8158d15ec866.Ifa3e422c302397111f20a16da7509e6574bc19e3@changeid
    Signed-off-by: Sasha Levin <[email protected]>

wifi: iwlwifi: mvm: fix scan request validation [+ + +]
Author: Avraham Stern <[email protected]>
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 <[email protected]>
    Reviewed-by: Ilan Peer <[email protected]>
    Signed-off-by: Miri Korenblit <[email protected]>
    Link: https://patch.msgid.link/20250709230308.3fbc1f27871b.I7a8ee91f463c1a2d9d8561c8232e196885d02c43@changeid
    Signed-off-by: Sasha Levin <[email protected]>

wifi: rtl818x: Kill URBs before clearing tx status queue [+ + +]
Author: Daniil Dulov <[email protected]>
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 <[email protected]>
    Reviewed-by: Ping-Ke Shih <[email protected]>
    Signed-off-by: Ping-Ke Shih <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

wifi: rtl8xxxu: Fix RX skb size for aggregation disabled [+ + +]
Author: Martin Kaistra <[email protected]>
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 <[email protected]>
    Reviewed-by: Ping-Ke Shih <[email protected]>
    Signed-off-by: Ping-Ke Shih <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

wifi: rtlwifi: fix possible skb memory leak in `_rtl_pci_rx_interrupt()`. [+ + +]
Author: Thomas Fourier <[email protected]>
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 <[email protected]>
    Acked-by: Ping-Ke Shih <[email protected]>
    Signed-off-by: Ping-Ke Shih <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
x86/fpu: Delay instruction pointer fixup until after warning [+ + +]
Author: Dave Hansen <[email protected]>
Date:   Wed Aug 13 12:42:19 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 <[email protected]>
    Reviewed-by: Chao Gao <[email protected]>
    Acked-by: Alison Schofield <[email protected]>
    Acked-by: Peter Zijlstra (Intel) <[email protected]>
    Cc:[email protected]
    Link: https://lore.kernel.org/all/20250624210148.97126F9E%40davehans-spike.ostc.intel.com
    [ adapted ex_handler_default() call ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
x86/mce/amd: Add default names for MCA banks and blocks [+ + +]
Author: Yazen Ghannam <[email protected]>
Date:   Wed Jul 23 00:24:51 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 <[email protected]>
    Signed-off-by: Borislav Petkov (AMD) <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
xhci: Disable stream for xHC controller with XHCI_BROKEN_STREAMS [+ + +]
Author: Hongyu Xie <[email protected]>
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 <[email protected]>
    Signed-off-by: Hongyu Xie <[email protected]>
    Signed-off-by: Mathias Nyman <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    [ removed xhci_get_usb3_hcd() call ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
zynq_fpga: use sgtable-based scatterlist wrappers [+ + +]
Author: Marek Szyprowski <[email protected]>
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: [email protected]
    Fixes: 425902f5c8e3 ("fpga zynq: Use the scatterlist interface")
    Signed-off-by: Marek Szyprowski <[email protected]>
    Reviewed-by: Jason Gunthorpe <[email protected]>
    Reviewed-by: Xu Yilun <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Xu Yilun <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>