Changelog in Linux kernel 6.12.93

 
accel/ivpu: prevent uninitialized data bug in debugfs [+ + +]
Author: Dan Carpenter <error27@gmail.com>
Date:   Mon May 25 10:14:42 2026 +0300

    accel/ivpu: prevent uninitialized data bug in debugfs
    
    [ Upstream commit 44e151be23deb788d9f6124de93823faf6e04e99 ]
    
    The simple_write_to_buffer() will only initialize data starting from
    the *pos offset so if it's non-zero then the first part of the buffer
    uninitialized.  Really, if *pos is non-zero then this code won't work
    so just check for that at the start of the function.
    
    Fixes: 320323d2e545 ("accel/ivpu: Add debugfs interface for setting HWS priority bands")
    Signed-off-by: Dan Carpenter <error27@gmail.com>
    Reviewed-by: Karol Wachowski <karol.wachowski@linux.intel.com>
    Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com>
    Link: https://patch.msgid.link/ahP24m6Mii9EDL7Q@stanley.mountain
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ALSA: firewire-motu: Protect register DSP event queue positions [+ + +]
Author: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Date:   Thu Jun 4 20:59:03 2026 -0400

    ALSA: firewire-motu: Protect register DSP event queue positions
    
    [ Upstream commit 98fb1c1bb11e29eb609b7200a25e136e05aa4498 ]
    
    The register DSP event queue is updated under parser->lock, but
    snd_motu_register_dsp_message_parser_count_event() reads pull_pos and
    push_pos without the lock.
    snd_motu_register_dsp_message_parser_copy_event() also reads both queue
    positions before taking the lock.
    
    Protect these accesses with parser->lock as well. This keeps the hwdep
    poll/read path consistent with the producer side and with the cached
    meter/parameter accessors.
    
    Fixes: 634ec0b2906e ("ALSA: firewire-motu: notify event for parameter change in register DSP model")
    Cc: stable@vger.kernel.org
    Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
    Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Link: https://patch.msgid.link/20260521-alsa-firewire-motu-event-locking-v1-1-708e1c2b5e56@gmail.com
    [ converted copy_event() from manual spin_lock_irqsave/spin_unlock_irqrestore to guard(spinlock_irqsave) ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: pcm: oss: Fix setup list UAF on proc write error [+ + +]
Author: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Date:   Fri May 22 22:09:40 2026 -0300

    ALSA: pcm: oss: Fix setup list UAF on proc write error
    
    [ Upstream commit 4cc54bdd54b337e77115be5b55577d1c58608eae ]
    
    snd_pcm_oss_proc_write() links a newly allocated setup entry into the
    OSS setup list before duplicating the task name. If the task-name
    allocation fails, the error path frees the already linked entry and
    leaves setup_list pointing at freed memory.
    
    A later OSS device open can then walk the stale list entry in
    snd_pcm_oss_look_for_setup() and dereference freed memory.
    
    Allocate the task name and initialize the setup entry before publishing
    the entry on setup_list. Also fetch the initial proc read iterator only
    after taking setup_mutex, so all setup_list traversal follows the same
    list lifetime rules.
    
    Reported-by: syzbot+8e498074a794999eb41c@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/all/6a1062b7.170a0220.35b2b7.0003.GAE@google.com
    Closes: https://syzkaller.appspot.com/bug?extid=8e498074a794999eb41c
    Fixes: 060d77b9c04a ("[ALSA] Fix / clean up PCM-OSS setup hooks")
    Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
    Link: https://patch.msgid.link/20260522-alsa-pcm-oss-setup-uaf-v1-1-40bdcc4d17e8@gmail.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ALSA: scarlett2: Allow flash writes ending at segment boundary [+ + +]
Author: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Date:   Fri May 29 13:25:00 2026 -0400

    ALSA: scarlett2: Allow flash writes ending at segment boundary
    
    [ Upstream commit a69b677e47a80319ce148d61cc29a2b57006e78d ]
    
    scarlett2_hwdep_write() rejects writes when offset + count is greater than
    or equal to the selected flash segment size. That incorrectly treats a
    write ending exactly at the end of the segment as out of space, although
    the last byte written is still within the segment.
    
    Split invalid argument checks from the segment-space check, keep
    zero-length writes as no-ops, and compare count against the remaining
    segment size. This permits exact-end writes and avoids relying on
    offset + count before deciding whether the request is in bounds.
    
    Fixes: 1abfbd3c9527 ("ALSA: scarlett2: Add support for uploading new firmware")
    Cc: stable@vger.kernel.org
    Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
    Link: https://patch.msgid.link/20260519-alsa-scarlett2-flash-write-boundary-v1-1-b550480e92da@gmail.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: scarlett2: Fix 2i2 Gen 4 direct monitor gain on firmware 2417 [+ + +]
Author: Geoffrey D. Bennett <g@b4.vu>
Date:   Sun May 24 06:34:14 2026 +0930

    ALSA: scarlett2: Fix 2i2 Gen 4 direct monitor gain on firmware 2417
    
    commit db37cf47b67e38ade40de5cd74a4d4d772ff1416 upstream.
    
    Firmware 2417 for the Scarlett 4th Gen 2i2 moved the direct monitor
    gain parameter by 4 bytes, from offset 0x2a0 to 0x2a4, breaking the
    "Direct Monitor X Mix Y" controls.
    
    Special-case the offset in the get/set config helpers when the
    running firmware is 2417 or later.
    
    Fixes: 4e809a299677 ("ALSA: scarlett2: Add support for Solo, 2i2, and 4i4 Gen 4")
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
    Link: https://patch.msgid.link/ahIWTueUlWA5xiV+@m.b4.vu
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: scarlett2: Return ENOSPC for out-of-bounds flash writes [+ + +]
Author: Geoffrey D. Bennett <g@b4.vu>
Date:   Fri May 29 13:24:59 2026 -0400

    ALSA: scarlett2: Return ENOSPC for out-of-bounds flash writes
    
    [ Upstream commit 74641bfcbf4e698b770b1b62a74e73934843e90e ]
    
    When writing to flash, return ENOSPC instead of EINVAL if the requested
    write would exceed the size of the flash segment.
    
    Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Link: https://patch.msgid.link/3a4af07b0329bed5ffb6994594e4f7bd202aad0f.1727971672.git.g@b4.vu
    Stable-dep-of: a69b677e47a8 ("ALSA: scarlett2: Allow flash writes ending at segment boundary")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
arm64: debug: always unmask interrupts in el0_softstp() [+ + +]
Author: Ada Couprie Diaz <ada.coupriediaz@arm.com>
Date:   Mon Jun 1 12:25:54 2026 +0200

    arm64: debug: always unmask interrupts in el0_softstp()
    
    [ Upstream commit ea0d55ae4b3207c33691a73da3443b1fd379f1d2 ]
    
    We intend that EL0 exception handlers unmask all DAIF exceptions
    before calling exit_to_user_mode().
    
    When completing single-step of a suspended breakpoint, we do not call
    local_daif_restore(DAIF_PROCCTX) before calling exit_to_user_mode(),
    leaving all DAIF exceptions masked.
    
    When pseudo-NMIs are not in use this is benign.
    
    When pseudo-NMIs are in use, this is unsound. At this point interrupts
    are masked by both DAIF.IF and PMR_EL1, and subsequent irq flag
    manipulation may not work correctly. For example, a subsequent
    local_irq_enable() within exit_to_user_mode_loop() will only unmask
    interrupts via PMR_EL1 (leaving those masked via DAIF.IF), and
    anything depending on interrupts being unmasked (e.g. delivery of
    signals) will not work correctly.
    
    This was detected by CONFIG_ARM64_DEBUG_PRIORITY_MASKING.
    
    Move the call to `try_step_suspended_breakpoints()` outside of the check
    so that interrupts can be unmasked even if we don't call the step handler.
    
    Fixes: 0ac7584c08ce ("arm64: debug: split single stepping exception entry")
    Cc: <stable@vger.kernel.org> # 6.17
    Signed-off-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Acked-by: Mark Rutland <mark.rutland@arm.com>
    [catalin.marinas@arm.com: added Mark's rewritten commit log and some whitespace]
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Reviewed-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

arm64: debug: call software breakpoint handlers statically [+ + +]
Author: Ada Couprie Diaz <ada.coupriediaz@arm.com>
Date:   Mon Jun 1 12:25:43 2026 +0200

    arm64: debug: call software breakpoint handlers statically
    
    [ Upstream commit 6adfdc5e2ef9c71a76d8d127a2eb54f0fbe9be5e ]
    
    Software breakpoints pass an immediate value in ESR ("comment") that can
    be used to call a specialized handler (KGDB, KASAN...).
    We do so in two different ways :
     - During early boot, `early_brk64` statically checks against known
       immediates and calls the corresponding handler,
     - During init, handlers are dynamically registered into a list. When
       called, the generic software breakpoint handler will iterate over
       the list to find the appropriate handler.
    
    The dynamic registration does not provide any benefit here as it is not
    exported and all its uses are within the arm64 tree. It also depends on an
    RCU list, whose safe access currently relies on the non-preemptible state
    of `do_debug_exception`.
    
    Replace the list iteration logic in `call_break_hooks` to call
    the breakpoint handlers statically if they are enabled, like in
    `early_brk64`.
    Expose the handlers in their respective headers to be reachable from
    `arch/arm64/kernel/debug-monitors.c` at link time.
    
    Unify the naming of the software breakpoint handlers to XXX_brk_handler(),
    making it clear they are related and to differentiate from the
    hardware breakpoints.
    
    Signed-off-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Tested-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
    Reviewed-by: Will Deacon <will@kernel.org>
    Acked-by: Mark Rutland <mark.rutland@arm.com>
    Link: https://lore.kernel.org/r/20250707114109.35672-4-ada.coupriediaz@arm.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Reviewed-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

arm64: debug: call step handlers statically [+ + +]
Author: Ada Couprie Diaz <ada.coupriediaz@arm.com>
Date:   Mon Jun 1 12:25:44 2026 +0200

    arm64: debug: call step handlers statically
    
    [ Upstream commit 403b48aad5b3e857b8c2576ce6a421f3d23dd6a6 ]
    
    Software stepping checks for the correct handler by iterating over a list
    of dynamically registered handlers and calling all of them until one
    handles the exception.
    
    This is the only generic way to handle software stepping handlers in arm64
    as the exception does not provide an immediate that could be checked,
    contrary to software breakpoints.
    
    However, the registration mechanism is not exported and has only
    two current users : the KGDB stepping handler, and the uprobe single step
    handler.
    Given that one comes from user mode and the other from kernel mode, call
    the appropriate one by checking the source EL of the exception.
    Add a stand-in that returns DBG_HOOK_ERROR when the configuration
    options are not enabled.
    
    Remove `arch_init_uprobes()` as it is not useful anymore and is
    specific to arm64.
    
    Unify the naming of the handler to XXX_single_step_handler(), making it
    clear they are related.
    
    Signed-off-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Tested-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
    Reviewed-by: Will Deacon <will@kernel.org>
    Acked-by: Mark Rutland <mark.rutland@arm.com>
    Link: https://lore.kernel.org/r/20250707114109.35672-5-ada.coupriediaz@arm.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Reviewed-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

arm64: debug: clean up single_step_handler logic [+ + +]
Author: Ada Couprie Diaz <ada.coupriediaz@arm.com>
Date:   Mon Jun 1 12:25:41 2026 +0200

    arm64: debug: clean up single_step_handler logic
    
    [ Upstream commit ad8b22648b7d0bc6f84230508436b1aafc2e2516 ]
    
    Remove the unnecessary boolean which always checks if the handler was found
    and return early instead.
    
    Signed-off-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Tested-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
    Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
    Acked-by: Mark Rutland <mark.rutland@arm.com>
    Reviewed-by: Will Deacon <will@kernel.org>
    Link: https://lore.kernel.org/r/20250707114109.35672-2-ada.coupriediaz@arm.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Reviewed-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

arm64: debug: refactor reinstall_suspended_bps() [+ + +]
Author: Ada Couprie Diaz <ada.coupriediaz@arm.com>
Date:   Mon Jun 1 12:25:48 2026 +0200

    arm64: debug: refactor reinstall_suspended_bps()
    
    [ Upstream commit 80691d35523de3292b64c2ffa444aab3d55e51ba ]
    
    `reinstall_suspended_bps()` plays a key part in the stepping process
    when we have hardware breakpoints and watchpoints enabled.
    It checks if we need to step one, will re-enable it if it has
    been handled and will return whether or not we need to proceed with
    a single-step.
    
    However, the current naming and return values make it harder to understand
    the logic and goal of the function.
    
    Rename it `try_step_suspended_breakpoints()` and change the return value
    to a boolean, aligning it with similar functions used in
    `do_el0_undef()` like `try_emulate_mrs()`, and making its behaviour
    more obvious.
    
    Signed-off-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Tested-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
    Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
    Reviewed-by: Will Deacon <will@kernel.org>
    Acked-by: Mark Rutland <mark.rutland@arm.com>
    Link: https://lore.kernel.org/r/20250707114109.35672-9-ada.coupriediaz@arm.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Reviewed-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

arm64: debug: remove break/step handler registration infrastructure [+ + +]
Author: Ada Couprie Diaz <ada.coupriediaz@arm.com>
Date:   Mon Jun 1 12:25:45 2026 +0200

    arm64: debug: remove break/step handler registration infrastructure
    
    [ Upstream commit d4e0b12620946a4011ad695490211fc38bf5cb42 ]
    
    Remove all infrastructure for the dynamic registration previously used by
    software breakpoints and stepping handlers.
    
    Signed-off-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Tested-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
    Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
    Reviewed-by: Will Deacon <will@kernel.org>
    Acked-by: Mark Rutland <mark.rutland@arm.com>
    Link: https://lore.kernel.org/r/20250707114109.35672-6-ada.coupriediaz@arm.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Reviewed-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

arm64: debug: remove debug exception registration infrastructure [+ + +]
Author: Ada Couprie Diaz <ada.coupriediaz@arm.com>
Date:   Mon Jun 1 12:25:53 2026 +0200

    arm64: debug: remove debug exception registration infrastructure
    
    [ Upstream commit a8b8cce9d96d65dfe3d89abf02033151f8b7d670 ]
    
    Now that debug exceptions are handled individually and without the need
    for dynamic registration, remove the unused registration infrastructure.
    
    This removes the external caller for `debug_exception_enter()` and
    `debug_exception_exit()`.
    Make them static again and remove them from the header.
    
    Remove `early_brk64()` as it has been made redundant by
    (arm64: debug: split brk64 exception entry) and is not used anymore.
    Note : in `early_brk64()` `bug_brk_handler()` is called unconditionally
    as a fall-through, but now `call_break_hook()` only calls it if the
    immediate matches.
    This does not change the behaviour in early boot, as if
    `bug_brk_handler()` was called on a non-BUG immediate it would return
    DBG_HOOK_ERROR anyway, which `call_break_hook()` will do if no immediate
    matches.
    
    Remove `trap_init()`, as it would be empty and a weak definition already
    exists in `init/main.c`.
    
    Signed-off-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Tested-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
    Reviewed-by: Will Deacon <will@kernel.org>
    Acked-by: Mark Rutland <mark.rutland@arm.com>
    Link: https://lore.kernel.org/r/20250707114109.35672-14-ada.coupriediaz@arm.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Reviewed-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

arm64: debug: split bkpt32 exception entry [+ + +]
Author: Ada Couprie Diaz <ada.coupriediaz@arm.com>
Date:   Mon Jun 1 12:25:52 2026 +0200

    arm64: debug: split bkpt32 exception entry
    
    [ Upstream commit fc5e5d0477c532054ce8692fd16fdaab2cb8946f ]
    
    Currently all debug exceptions share common entry code and are routed
    to `do_debug_exception()`, which calls dynamically-registered
    handlers for each specific debug exception. This is unfortunate as
    different debug exceptions have different entry handling requirements,
    and it would be better to handle these distinct requirements earlier.
    
    The BKPT32 exception can only be triggered by a BKPT instruction. Thus,
    we know that the PC is a legitimate address and isn't being used to train
    a branch predictor with a bogus address : we don't need to call
    `arm64_apply_bp_hardening()`.
    
    The handler for this exception only pends a signal and doesn't depend
    on any per-CPU state : we don't need to inhibit preemption, nor do we
    need to keep the DAIF exceptions masked, so we can unmask them earlier.
    
    Split the BKPT32 exception entry and adjust function signatures and its
    behaviour to match its relaxed constraints compared to other
    debug exceptions.
    We can also remove `NOKRPOBE_SYMBOL`, as this cannot lead to a kprobe
    recursion.
    
    This replaces the last usage of `el0_dbg()`, so remove it.
    
    Signed-off-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Tested-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
    Reviewed-by: Will Deacon <will@kernel.org>
    Acked-by: Mark Rutland <mark.rutland@arm.com>
    Link: https://lore.kernel.org/r/20250707114109.35672-13-ada.coupriediaz@arm.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Reviewed-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

arm64: debug: split brk64 exception entry [+ + +]
Author: Ada Couprie Diaz <ada.coupriediaz@arm.com>
Date:   Mon Jun 1 12:25:51 2026 +0200

    arm64: debug: split brk64 exception entry
    
    [ Upstream commit 31575e11ecf7e44face72d1e624cb147a9283733 ]
    
    Currently all debug exceptions share common entry code and are routed
    to `do_debug_exception()`, which calls dynamically-registered
    handlers for each specific debug exception. This is unfortunate as
    different debug exceptions have different entry handling requirements,
    and it would be better to handle these distinct requirements earlier.
    
    The BRK64 instruction can only be triggered by a BRK instruction. Thus,
    we know that the PC is a legitimate address and isn't being used to train
    a branch predictor with a bogus address : we don't need to call
    `arm64_apply_bp_hardening()`.
    
    We do not need to handle the Cortex-A76 erratum #1463225 either, as it
    only relevant for single stepping at EL1.
    BRK64 does not write FAR_EL1 either, as only hardware watchpoints do so.
    
    Split the BRK64 exception entry, adjust the function signature, and its
    behaviour to match the lack of needed mitigations.
    Further, as the EL0 and EL1 code paths are cleanly separated, we can split
    `do_brk64()` into `do_el0_brk64()` and `do_el1_brk64()`, and call them
    directly from the relevant entry paths.
    Use `die()` directly for the EL1 error path, as in `do_el1_bti()` and
    `do_el1_undef()`.
    We can also remove `NOKRPOBE_SYMBOL` for the EL0 path, as it cannot
    lead to a kprobe recursion.
    
    When taking a BRK64 exception from EL0, the exception handling is safely
    preemptible : the only possible handler is `uprobe_brk_handler()`.
    It only operates on task-local data and properly checks its validity,
    then raises a Thread Information Flag, processed before returning
    to userspace in `do_notify_resume()`, which is already preemptible.
    Thus we can safely unmask interrupts and enable preemption before
    handling the break itself, fixing a PREEMPT_RT issue where the handler
    could call a sleeping function with preemption disabled.
    
    Given that the break hook registration is handled statically in
    `call_break_hook` since
    (arm64: debug: call software break handlers statically)
    and that we now bypass the exception handler registration, this change
    renders `early_brk64` redundant : its functionality is now handled through
    the post-init path.
    
    This also removes the last usage of `el1_dbg()`.
    
    This also removes the last usage of `el0_dbg()` without `CONFIG_COMPAT`.
    Mark it `__maybe_unused`, to prevent a warning when building this patch
    without `CONFIG_COMPAT`, as the following patch removes `el0_dbg()`.
    
    Signed-off-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Tested-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
    Reviewed-by: Will Deacon <will@kernel.org>
    Acked-by: Mark Rutland <mark.rutland@arm.com>
    Link: https://lore.kernel.org/r/20250707114109.35672-12-ada.coupriediaz@arm.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Reviewed-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

arm64: debug: split hardware breakpoint exception entry [+ + +]
Author: Ada Couprie Diaz <ada.coupriediaz@arm.com>
Date:   Mon Jun 1 12:25:47 2026 +0200

    arm64: debug: split hardware breakpoint exception entry
    
    [ Upstream commit 43e2ae77fcab8a01101a2e5da528b5222b338e5f ]
    
    Currently all debug exceptions share common entry code and are routed
    to `do_debug_exception()`, which calls dynamically-registered
    handlers for each specific debug exception. This is unfortunate as
    different debug exceptions have different entry handling requirements,
    and it would be better to handle these distinct requirements earlier.
    
    Hardware breakpoints exceptions are generated by the hardware after user
    configuration. As such, they can be exploited when training branch
    predictors outside of the userspace VA range: they still need to call
    `arm64_apply_bp_hardening()` if needed to mitigate against this attack.
    
    However, they do not need to handle the Cortex-A76 erratum #1463225 as
    it only applies to single stepping exceptions.
    It does not set an address in FAR_EL1 either, only the hardware
    watchpoint does.
    
    As the hardware breakpoint handler only returns 0 and never triggers
    the call to `arm64_notify_die()`, we can call it directly from
    `entry-common.c`.
    Split the hardware breakpoint exception entry, adjust
    the function signature, and handling of the Cortex-A76 erratum to fit
    the behaviour of the exception.
    
    Move the call to `arm64_apply_bp_hardening()` to `entry-common.c` so that
    we can do it as early as possible, and only for the exceptions coming
    from EL0, where it is needed.
    This is safe to do as it is `noinstr`, as are all the functions it
    may call. `el0_ia()` and `el0_pc()` already call it this way.
    
    Signed-off-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Tested-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
    Reviewed-by: Will Deacon <will@kernel.org>
    Acked-by: Mark Rutland <mark.rutland@arm.com>
    Link: https://lore.kernel.org/r/20250707114109.35672-8-ada.coupriediaz@arm.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Reviewed-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

arm64: debug: split hardware watchpoint exception entry [+ + +]
Author: Ada Couprie Diaz <ada.coupriediaz@arm.com>
Date:   Mon Jun 1 12:25:50 2026 +0200

    arm64: debug: split hardware watchpoint exception entry
    
    [ Upstream commit 413f0bba005dacf2484bb8ecce212fab9be79d81 ]
    
    Currently all debug exceptions share common entry code and are routed
    to `do_debug_exception()`, which calls dynamically-registered
    handlers for each specific debug exception. This is unfortunate as
    different debug exceptions have different entry handling requirements,
    and it would be better to handle these distinct requirements earlier.
    
    Hardware watchpoints are the only debug exceptions that will write
    FAR_EL1, so we need to preserve it and pass it down.
    However, they cannot be used to maliciously train branch predictors, so
    we can omit calling `arm64_bp_hardening()`, nor do they need to handle
    the Cortex-A76 erratum #1463225, as it only applies to single stepping
    exceptions.
    
    As the hardware watchpoint handler only returns 0 and never triggers
    the call to `arm64_notify_die()`, we can call it directly from
    `entry-common.c`.
    Split the hardware watchpoint exception entry and adjust the behaviour
    to match the lack of needed mitigations.
    
    Signed-off-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Tested-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
    Reviewed-by: Will Deacon <will@kernel.org>
    Acked-by: Mark Rutland <mark.rutland@arm.com>
    Link: https://lore.kernel.org/r/20250707114109.35672-11-ada.coupriediaz@arm.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Reviewed-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

arm64: debug: split single stepping exception entry [+ + +]
Author: Ada Couprie Diaz <ada.coupriediaz@arm.com>
Date:   Mon Jun 1 12:25:49 2026 +0200

    arm64: debug: split single stepping exception entry
    
    [ Upstream commit 0ac7584c08ceff13fc1e3082a0104548688d6b00 ]
    
    Currently all debug exceptions share common entry code and are routed
    to `do_debug_exception()`, which calls dynamically-registered
    handlers for each specific debug exception. This is unfortunate as
    different debug exceptions have different entry handling requirements,
    and it would be better to handle these distinct requirements earlier.
    
    The single stepping exception has the most constraints : it can be
    exploited to train branch predictors and it needs special handling at EL1
    for the Cortex-A76 erratum #1463225. We need to conserve all those
    mitigations.
    However, it does not write an address at FAR_EL1, as only hardware
    watchpoints do so.
    
    The single-step handler does its own signaling if it needs to and only
    returns 0, so we can call it directly from `entry-common.c`.
    
    Split the single stepping exception entry, adjust the function signature,
    keep the security mitigation and erratum handling.
    Further, as the EL0 and EL1 code paths are cleanly separated, we can split
    `do_softstep()` into `do_el0_softstep()` and `do_el1_softstep()` and
    call them directly from the relevant entry paths.
    We can also remove `NOKPROBE_SYMBOL` for the EL0 path, as it cannot
    lead to a kprobe recursion.
    
    Move the call to `arm64_apply_bp_hardening()` to `entry-common.c` so that
    we can do it as early as possible, and only for the exceptions coming
    from EL0, where it is needed.
    This is safe to do as it is `noinstr`, as are all the functions it
    may call. `el0_ia()` and `el0_pc()` already call it this way.
    
    When taking a soft-step exception from EL0, most of the single stepping
    handling is safely preemptible : the only possible handler is
    `uprobe_single_step_handler()`. It only operates on task-local data and
    properly checks its validity, then raises a Thread Information Flag,
    processed before returning to userspace in `do_notify_resume()`, which
    is already preemptible.
    However, the soft-step handler first calls `reinstall_suspended_bps()`
    to check if there is any hardware breakpoint or watchpoint pending
    or already stepped through.
    This cannot be preempted as it manipulates the hardware breakpoint and
    watchpoint registers.
    
    Move the call to `try_step_suspended_breakpoints()` to `entry-common.c`
    and adjust the relevant comments.
    We can now safely unmask interrupts before handling the step itself,
    fixing a PREEMPT_RT issue where the handler could call a sleeping function
    with preemption disabled.
    
    Signed-off-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Closes: https://lore.kernel.org/linux-arm-kernel/Z6YW_Kx4S2tmj2BP@uudg.org/
    Tested-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
    Reviewed-by: Will Deacon <will@kernel.org>
    Acked-by: Mark Rutland <mark.rutland@arm.com>
    Link: https://lore.kernel.org/r/20250707114109.35672-10-ada.coupriediaz@arm.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Reviewed-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

arm64: entry: Add entry and exit functions for debug exceptions [+ + +]
Author: Ada Couprie Diaz <ada.coupriediaz@arm.com>
Date:   Mon Jun 1 12:25:46 2026 +0200

    arm64: entry: Add entry and exit functions for debug exceptions
    
    [ Upstream commit eaff68b3286116d499a3d4e513a36d772faba587 ]
    
    Move the `debug_exception_enter()` and `debug_exception_exit()`
    functions from mm/fault.c, as they are needed to split
    the debug exceptions entry paths from the current unified one.
    
    Make them externally visible in include/asm/exception.h until
    the caller in mm/fault.c is cleaned up.
    
    Signed-off-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Tested-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
    Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
    Reviewed-by: Will Deacon <will@kernel.org>
    Acked-by: Mark Rutland <mark.rutland@arm.com>
    Link: https://lore.kernel.org/r/20250707114109.35672-7-ada.coupriediaz@arm.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Reviewed-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

arm64: Introduce esr_is_ubsan_brk() [+ + +]
Author: Mostafa Saleh <smostafa@google.com>
Date:   Mon Jun 1 12:25:40 2026 +0200

    arm64: Introduce esr_is_ubsan_brk()
    
    [ Upstream commit dc1fd37a7f501731e488c1c6f86b2f591632a4ad ]
    
    Soon, KVM is going to use this logic for hypervisor panics,
    so add it in a wrapper that can be used by the hypervisor exit
    handler to decode hyp panics.
    
    Signed-off-by: Mostafa Saleh <smostafa@google.com>
    Reviewed-by: Kees Cook <kees@kernel.org>
    Link: https://lore.kernel.org/r/20250430162713.1997569-2-smostafa@google.com
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Reviewed-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

arm64: io: Extract user memory type in ioremap_prot() [+ + +]
Author: Will Deacon <will@kernel.org>
Date:   Wed Jun 3 09:23:14 2026 +0800

    arm64: io: Extract user memory type in ioremap_prot()
    
    [ Upstream commit 8f098037139b294050053123ab2bc0f819d08932 ]
    
    The only caller of ioremap_prot() outside of the generic ioremap()
    implementation is generic_access_phys(), which passes a 'pgprot_t' value
    determined from the user mapping of the target 'pfn' being accessed by
    the kernel. On arm64, the 'pgprot_t' contains all of the non-address
    bits from the pte, including the permission controls, and so we end up
    returning a new user mapping from ioremap_prot() which faults when
    accessed from the kernel on systems with PAN:
    
      | Unable to handle kernel read from unreadable memory at virtual address ffff80008ea89000
      | ...
      | Call trace:
      |   __memcpy_fromio+0x80/0xf8
      |   generic_access_phys+0x20c/0x2b8
      |   __access_remote_vm+0x46c/0x5b8
      |   access_remote_vm+0x18/0x30
      |   environ_read+0x238/0x3e8
      |   vfs_read+0xe4/0x2b0
      |   ksys_read+0xcc/0x178
      |   __arm64_sys_read+0x4c/0x68
    
    Extract only the memory type from the user 'pgprot_t' in ioremap_prot()
    and assert that we're being passed a user mapping, to protect us against
    any changes in future that may require additional handling. To avoid
    falsely flagging users of ioremap(), provide our own ioremap() macro
    which simply wraps __ioremap_prot().
    
    Cc: Zeng Heng <zengheng4@huawei.com>
    Cc: Jinjiang Tu <tujinjiang@huawei.com>
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Fixes: 893dea9ccd08 ("arm64: Add HAVE_IOREMAP_PROT support")
    Reported-by: Jinjiang Tu <tujinjiang@huawei.com>
    Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Will Deacon <will@kernel.org>
    [ Modified ioremap_prot() parameter, using "unsigned long user_prot" instead of
    "pgprot_t user_prot" to fix conflict with generic header ]
    Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

arm64: io: Rename ioremap_prot() to __ioremap_prot() [+ + +]
Author: Will Deacon <will@kernel.org>
Date:   Wed Jun 3 09:23:13 2026 +0800

    arm64: io: Rename ioremap_prot() to __ioremap_prot()
    
    commit f6bf47ab32e0863df50f5501d207dcdddb7fc507 upstream.
    
    Rename our ioremap_prot() implementation to __ioremap_prot() and convert
    all arch-internal callers over to the new function.
    
    ioremap_prot() remains as a #define to __ioremap_prot() for
    generic_access_phys() and will be subsequently extended to handle user
    permissions in 'prot'.
    
    Cc: Zeng Heng <zengheng4@huawei.com>
    Cc: Jinjiang Tu <tujinjiang@huawei.com>
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

arm64: refactor aarch32_break_handler() [+ + +]
Author: Ada Couprie Diaz <ada.coupriediaz@arm.com>
Date:   Mon Jun 1 12:25:42 2026 +0200

    arm64: refactor aarch32_break_handler()
    
    [ Upstream commit b1e2d95524e4d0f5b643394c739212869e95cf6a ]
    
    `aarch32_break_handler()` is called in `do_el0_undef()` when we
    are trying to handle an exception whose Exception Syndrome is unknown.
    It checks if the instruction hit might be a 32-bit arm break (be it
    A32 or T2), and sends a SIGTRAP to userspace if it is so that it can
    be handled.
    
    However, this is badly represented in the naming of the function, and
    is not consistent with the other functions called with the same logic
    in `do_el0_undef()`.
    
    Rename it `try_handle_aarch32_break()` and change the return value to
    a boolean to align with the logic of the other tentative handlers in
    `do_el0_undef()`, the previous error code being ignored anyway.
    
    Signed-off-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Tested-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
    Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
    Acked-by: Mark Rutland <mark.rutland@arm.com>
    Reviewed-by: Will Deacon <will@kernel.org>
    Link: https://lore.kernel.org/r/20250707114109.35672-3-ada.coupriediaz@arm.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Reviewed-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

arm64: tlb: Flush walk cache when unsharing PMD tables [+ + +]
Author: Zeng Heng <zengheng4@huawei.com>
Date:   Sun May 31 20:44:17 2026 -0400

    arm64: tlb: Flush walk cache when unsharing PMD tables
    
    [ Upstream commit c2ff4764e03e7a8d758352f4aceb8fe1be6ac971 ]
    
    When huge_pmd_unshare() is called to unshare a PMD table, the
    tlb_unshare_pmd_ptdesc() function sets tlb->unshared_tables=true
    but the aarch64 tlb_flush() only checked tlb->freed_tables to
    determine whether to use TLBF_NONE (vae1is, invalidates walk
    cache) or TLBF_NOWALKCACHE (vale1is, leaf-only).
    
    This caused the stale PMD page table entry to remain in the walk cache
    after unshare, potentially leading to incorrect page table walks.
    
    Fix by including unshared_tables in the check, so that when
    unsharing tables, TLBF_NONE is used and the walk cache is properly
    invalidated.
    
    Here is the detailed distinction between vae1is and vale1is:
    
    | Instruction Combination  | Actual Invalidation Scope                         |
    | ------------------------ | --------------------------------------------------|
    | `VAE1IS`  + TTL=`0`      | All entries at all levels (full invalidation)     |
    | `VAE1IS`  + TTL=`2` (L2) | Non-leaf at Level 0/1 + leaf at Level 2           |
    | `VALE1IS` + TTL=`0`      | Leaf entries at all levels (non-leaf not cleared) |
    | `VALE1IS` + TTL=`2` (L2) | Leaf entry at Level 2 only                        |
    
    Signed-off-by: Zeng Heng <zengheng4@huawei.com>
    Fixes: 8ce720d5bd91 ("mm/hugetlb: fix excessive IPI broadcasts when unsharing PMD tables using mmu_gather")
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ASoC: codecs: simple-mux: Fix enum control bounds check [+ + +]
Author: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Date:   Wed May 27 09:24:00 2026 -0300

    ASoC: codecs: simple-mux: Fix enum control bounds check
    
    [ Upstream commit f63ad68e18d774a5d15cd7e405ead63f6b322679 ]
    
    simple_mux_control_put() rejects values greater than e->items, but
    enum control values are zero based. For the two-entry mux used by this
    driver, valid values are 0 and 1, so value 2 must be rejected as well.
    
    Accepting e->items can store an invalid mux state, pass it to the GPIO
    setter, and pass it on to the DAPM mux update path where it is used as
    an index into the enum text array.
    
    Use the same >= e->items check used by the ASoC enum helpers.
    
    Fixes: 342fbb7578d1 ("ASoC: add simple-mux")
    Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
    Link: https://patch.msgid.link/20260527-asoc-simple-mux-enum-bounds-v1-1-3f805b9fc671@gmail.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: Intel: bytcht_es8316: Fix MCLK leak on init errors [+ + +]
Author: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Date:   Tue May 19 13:51:47 2026 -0300

    ASoC: Intel: bytcht_es8316: Fix MCLK leak on init errors
    
    [ Upstream commit afb2a3a9d8369d18122a0d7cd294eba9a98259c6 ]
    
    byt_cht_es8316_init() enables MCLK before configuring the codec sysclk
    and creating the headset jack. If either of those later steps fails, the
    function returns without disabling MCLK, leaving the clock enabled after
    card registration fails.
    
    Track whether this driver enabled MCLK and disable it on the init error
    paths. Add the matching DAI link exit callback so the same clock enable
    is also balanced when ASoC cleans up a successfully initialized link.
    
    Fixes: a03bdaa565cb ("ASoC: Intel: add machine driver for BYT/CHT + ES8316")
    Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
    Link: https://patch.msgid.link/20260519-asoc-bytcht-es8316-mclk-leak-v1-1-b4a11cdc2afd@gmail.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: qcom: q6asm-dai: close stream only when running [+ + +]
Author: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Date:   Mon May 18 09:23:44 2026 +0000

    ASoC: qcom: q6asm-dai: close stream only when running
    
    commit 048c540ee76ded666bda74f9dae1ca3254e0633c upstream.
    
    q6asm_dai_close() and q6asm_dai_compr_free() currently issue CMD_CLOSE
    whenever prtd->state is non-zero.
    
    After prepare() closes an existing stream, the state is updated to
    Q6ASM_STREAM_STOPPED. Since this state is also non-zero, the close and
    free paths can send CMD_CLOSE again for a stream that has already been
    closed.
    
    Restrict CMD_CLOSE to the Q6ASM_STREAM_RUNNING state so the command is
    sent only when the ASM stream is still active.
    
    Fixes: 2a9e92d371db ("ASoC: qdsp6: q6asm: Add q6asm dai driver")
    Cc: Stable@vger.kernel.org
    Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
    Link: https://patch.msgid.link/20260518092347.3446946-3-srinivas.kandagatla@oss.qualcomm.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ASoC: qcom: q6asm-dai: do not set stream state in event and trigger callbacks [+ + +]
Author: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Date:   Mon May 18 09:23:43 2026 +0000

    ASoC: qcom: q6asm-dai: do not set stream state in event and trigger callbacks
    
    commit cee3e63e7106c3c81b2053371fdf14240bfba2fc upstream.
    
    The q6asm-dai stream state is used by prepare() to decide whether an
    existing stream setup needs to be closed before opening/configuring a new
    one. Updating the state from trigger or asynchronous DSP callbacks can make
    that state stale or incorrect relative to the actual setup lifetime.
    
    In particular, setting Q6ASM_STREAM_STOPPED on STOP or EOS completion can
    make prepare() believe there is no active setup to close, which can result
    in opening/configuring the same stream more than once.
    
    Keep stream state updates tied to prepare(), where the stream is actually
    closed and reopened, and stop changing it from trigger and EOS callbacks.
    
    Fixes: bfbb12dfa144 ("ASoC: qcom: q6asm-dai: perform correct state check before closing")
    Cc: Stable@vger.kernel.org
    Closes: https://lore.kernel.org/all/afS7rTHdc9TyIeLx@rdacayan/
    Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
    Link: https://patch.msgid.link/20260518092347.3446946-2-srinivas.kandagatla@oss.qualcomm.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ASoC: qcom: q6asm-dai: fix error handling in prepare and set_params [+ + +]
Author: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Date:   Mon May 18 09:23:45 2026 +0000

    ASoC: qcom: q6asm-dai: fix error handling in prepare and set_params
    
    commit 4b4db09f283df65d780bc7cee66cb4a7e9bf4770 upstream.
    
    Fix error handling in q6asm_dai_compr_set_params() and q6asm_dai_prepare()
    for both CMD_CLOSE and q6asm_unmap_memory_regions().
    
    In both the functions, we are doing q6asm_audio_client_free in failure
    cases, which means if prepare or set_params fail, we can never recover.
    Now open and close are done in respective dai_open/close functions.
    
    Fixes: 2a9e92d371db ("ASoC: qdsp6: q6asm: Add q6asm dai driver")
    Cc: Stable@vger.kernel.org
    Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
    Link: https://patch.msgid.link/20260518092347.3446946-4-srinivas.kandagatla@oss.qualcomm.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
auxdisplay: line-display: fix OOB read on zero-length message_store() [+ + +]
Author: Stepan Ionichev <sozdayvek@gmail.com>
Date:   Thu May 14 22:43:42 2026 +0500

    auxdisplay: line-display: fix OOB read on zero-length message_store()
    
    commit a7511dcd9dd4bc55d123f9b800c8a4ed2662e5c6 upstream.
    
    linedisp_display() unconditionally reads msg[count - 1] before
    checking whether count is zero, so a write of zero bytes to the
    message sysfs attribute hits msg[-1]:
    
            write(fd, "", 0);
    
            -> message_store(..., buf, count=0)
               -> linedisp_display(linedisp, buf, count=0)
                  -> msg[count - 1] == '\n'  ; OOB read
    
    The kernfs write buffer for that store is a 1-byte allocation
    (kernfs_fop_write_iter() does kmalloc(len + 1) with len == 0),
    so msg[-1] is a 1-byte read before the slab object. On a
    KASAN-enabled kernel this trips an out-of-bounds report and
    panics; on stock kernels it silently reads adjacent slab data
    and, if that byte happens to be '\n', the following count--
    wraps ssize_t 0 to -1 and is then passed to kmemdup_nul().
    
    linedisp_display() is reached from the message_store() sysfs
    callback (drivers/auxdisplay/line-display.c message attribute,
    mode 0644) and from the in-tree initial-message setup with
    count == -1, so the OOB path is only userspace-triggerable via
    zero-byte writes; vfs_write() does not short-circuit on
    count == 0 and kernfs_fop_write_iter() dispatches the store
    callback regardless.
    
    Guard the trailing-newline trim with a count check. The
    existing if (!count) block then takes the clear-display path
    unchanged.
    
    Affects every auxdisplay driver that registers via
    linedisp_register() / linedisp_attach(): ht16k33, max6959,
    img-ascii-lcd, seg-led-gpio.
    
    Fixes: 7e76aece6f03 ("auxdisplay: Extract character line display core support")
    Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
batman-adv: bla: avoid double decrement of bla.num_requests [+ + +]
Author: Sven Eckelmann <sven@narfation.org>
Date:   Fri May 29 20:10:42 2026 +0200

    batman-adv: bla: avoid double decrement of bla.num_requests
    
    commit 83ab69bd12b80f6ea169c8bea6977701b53a043d upstream.
    
    The bla.num_requests is increased when no request_sent was in progress. And
    it is decremented in various places (announcement was received, backbone is
    purged, periodic work). But the check if the request_sent is actually set
    to a specific state and the atomic_dec/_inc are not safe because they are
    not atomic (TOCTOU) and multiple such code portions can run concurrently.
    
    At the same time, it is necessary to modify request_sent (state) and
    bla.num_requests atomically. Otherwise batadv_bla_send_request() might set
    request_sent to 1 and is interrupted.  batadv_handle_announce() can then
    set request_sent back to 0 and decrement num_requests before
    batadv_bla_send_request() incremented it.
    
    The two operations must therefore be locked. And since state (request_sent)
    and wait_periods are only accessed inside this lock, they can be converted
    to simpler datatypes. And to avoid that the bla.num_requests is touched by
    a parallel running context with a valid backbone_gw reference after
    batadv_bla_purge_backbone_gw() ran, a third state "stopped" is required to
    correctly signal that a backbone_gw is in the state of being cleaned up.
    
    Cc: stable@kernel.org
    Fixes: 23721387c409 ("batman-adv: add basic bridge loop avoidance code")
    Signed-off-by: Sven Eckelmann <sven@narfation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

batman-adv: bla: avoid NULL-ptr deref for claim via dropped interface [+ + +]
Author: Sven Eckelmann <sven@narfation.org>
Date:   Fri May 29 20:11:25 2026 +0200

    batman-adv: bla: avoid NULL-ptr deref for claim via dropped interface
    
    commit f80d3d98d2ff78d9e2fe5d68b1f45948c4f7bd24 upstream.
    
    Without rtnl_lock held, a hardif might be retrieved as primary interface of
    a meshif, but then (while operating on this interface) getting decoupled
    from the mesh interface. In this case, the meshif still exists but the
    pointer from the primary hardif to the meshif is set to NULL.
    
    The mesh_iface must be checked first to be non-NULL before continuing to
    send an ARP request using meshif.
    
    Cc: stable@kernel.org
    Fixes: 23721387c409 ("batman-adv: add basic bridge loop avoidance code")
    Reported-by: Ido Schimmel <idosch@nvidia.com>
    Reported-by: syzbot+9fdcc9f05a98a540b816@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=9fdcc9f05a98a540b816
    [ switch to old "mesh_iface" name "soft_iface" ]
    Signed-off-by: Sven Eckelmann <sven@narfation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

batman-adv: iv: recover OGM scheduling after forward packet error [+ + +]
Author: Sven Eckelmann <sven@narfation.org>
Date:   Fri May 29 20:10:00 2026 +0200

    batman-adv: iv: recover OGM scheduling after forward packet error
    
    commit aa3153bd139a6c48667dcd02608d3b2c80bff02c upstream.
    
    When batadv_iv_ogm_schedule_buff() fails to allocate and queue a forward
    packet for OGM transmission, the work item that drives periodic OGM
    scheduling is never re-armed. This silently halts transmission of the
    node's own OGMs on the affected interface — only OGMs from other peers
    continue to be aggregated and forwarded.
    
    Fix this by tracking whether batadv_iv_ogm_queue_add() (and transitively
    batadv_iv_ogm_aggregate_new()) successfully scheduled a forward packet.
    When scheduling fails, batadv_iv_ogm_schedule_buff() falls back to queuing
    a dedicated recovery work item (reschedule_work) that fires after one
    originator interval and calls batadv_iv_ogm_schedule() again.
    
    Cc: stable@kernel.org
    Fixes: c6c8fea29769 ("net: Add batman-adv meshing protocol")
    Signed-off-by: Sven Eckelmann <sven@narfation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

batman-adv: tp_meter: avoid role confusion in tp_list [+ + +]
Author: Sven Eckelmann <sven@narfation.org>
Date:   Fri May 29 20:09:05 2026 +0200

    batman-adv: tp_meter: avoid role confusion in tp_list
    
    commit ff24f2ecfd94c07a2b89bac497433e3b23271cac upstream.
    
    Session lookups in tp_list matched only on destination address (and
    optionally session ID), leaving role validation to the caller. If two
    sessions with the same other_end coexisted (one as sender, one as receiver)
    a lookup could silently return the wrong one, causing the caller's role to
    bail out early, potentially skipping necessary cleanup.
    
    Move the role check into the lookup functions themselves so the correct
    entry is always returned, or none at all. Since batadv_tp_start()
    legitimately needs to detect any active session to a destination regardless
    of role, introduce a dedicated helper for that case rather than bending the
    existing lookup semantics.
    
    Cc: stable@kernel.org
    Fixes: 33a3bb4a3345 ("batman-adv: throughput meter implementation")
    Signed-off-by: Sven Eckelmann <sven@narfation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

batman-adv: tp_meter: directly shut down timer on cleanup [+ + +]
Author: Sven Eckelmann <sven@narfation.org>
Date:   Thu May 28 22:21:35 2026 +0200

    batman-adv: tp_meter: directly shut down timer on cleanup
    
    commit d5487249a81ea658717614009c8f46acc5b7101a upstream.
    
    batadv_tp_sender_cleanup() was calling timer_delete_sync() followed by
    timer_delete() to guard against the timer handler re-arming itself between
    the two calls. This double-deletion hack relied on the sending status being
    set to 0 to suppress re-arming.
    
    Replace both calls with a single timer_shutdown_sync(). This function both
    waits for any running timer callback to complete (like timer_delete_sync())
    and permanently disarms the timer so it cannot be re-armed afterwards,
    making re-arming prevention unconditional and self-documenting.
    
    The re-arming property is also required because otherwise:
    
    1. context 0 (batadv_tp_recv_ack()) checks in
       batadv_tp_reset_sender_timer() if sending is still 1 -> it is
    2. context 1 changes in batadv_tp_sender_shutdown() sending to 0 and in
       this process forces the kthread to stop timer in
       batadv_tp_sender_cleanup()
    3. context 0 continues in batadv_tp_reset_sender_timer() and rearms the
       timer -> but the reference for it is already gone
    
    Cc: stable@kernel.org
    Fixes: 33a3bb4a3345 ("batman-adv: throughput meter implementation")
    [ adapt pre-hunk to old del_timer* names ]
    Signed-off-by: Sven Eckelmann <sven@narfation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

batman-adv: tt: avoid empty VLAN responses [+ + +]
Author: Sven Eckelmann <sven@narfation.org>
Date:   Fri May 29 20:04:50 2026 +0200

    batman-adv: tt: avoid empty VLAN responses
    
    commit fa1bd704940b5bcbc32c0b28db9167405c8ee5e0 upstream.
    
    The commit 16116dac2339 ("batman-adv: prevent TT request storms by not
    sending inconsistent TT TLVLs") added checks to the local (direct) TT
    response code. But the response can also be done indirectly by another node
    using the global TT state. To avoid such inconsistency states reported in
    the original fix, also avoid sending empty VLANs for replies from the
    global TT state.
    
    Cc: stable@kernel.org
    Fixes: 7ea7b4a14275 ("batman-adv: make the TT CRC logic VLAN specific")
    [ Context, drop flex array dependency ]
    Signed-off-by: Sven Eckelmann <sven@narfation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

batman-adv: tt: fix TOCTOU race for reported vlans [+ + +]
Author: Sven Eckelmann <sven@narfation.org>
Date:   Thu May 28 22:57:44 2026 +0200

    batman-adv: tt: fix TOCTOU race for reported vlans
    
    commit 94d27005016be15ffc638b2ecbc4d58805ad7b48 upstream.
    
    The local TT based TVLV is generated by first checking the number of VLANs
    which have at least one TT entry. A new buffer with the correct size for
    the VLANs is then allocated. Only then, the list of VLANs s used to fill
    the VLAN entries in the buffer. During this time, the meshif_vlan_list_lock
    is held. But the actual number of TT entries of each VLAN can still
    increase during this time - just not the number of VLANs in the list.
    
    But the prefilter used in the buffer size calculation might still cause an
    increase of the number of VLANs which need to be stored. Simply because a
    VLAN might now suddenly have at least one entry when it had none in the
    pre-alloc check - and then needs to occupy space which was not allocated.
    
    It is better to overestimate the buffer size at the beginning and then fill
    the buffer only with the VLANs which are not empty.
    
    Cc: stable@kernel.org
    Fixes: 16116dac2339 ("batman-adv: prevent TT request storms by not sending inconsistent TT TLVLs")
    [ Context, drop flex array dependency ]
    Signed-off-by: Sven Eckelmann <sven@narfation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

batman-adv: tt: prevent TVLV entry number overflow [+ + +]
Author: Sven Eckelmann <sven@narfation.org>
Date:   Fri May 29 20:06:18 2026 +0200

    batman-adv: tt: prevent TVLV entry number overflow
    
    commit 99d9958fa10fb684b2a8e2c48a8d704122721420 upstream.
    
    The helpers to prepare the buffers for the local and global TT based
    replies are trying to sum up all TT entries which can be found for each
    VLAN. In theory, this sum can be too big for an u16 and therefore overflow.
    A too small buffer would then be allocated for the TVLV.
    
    The too small buffer will be handled gracefully by
    batadv_tt_tvlv_generate() and is not causing a buffer overflow - just a
    truncated reply. But this overflow shouldn't have happened in the first and
    the too small buffer should never have been allocated when an overflow was
    detected.
    
    Cc: stable@kernel.org
    Fixes: 7ea7b4a14275 ("batman-adv: make the TT CRC logic VLAN specific")
    Signed-off-by: Sven Eckelmann <sven@narfation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

batman-adv: tt: reject oversized local TVLV buffers [+ + +]
Author: Sven Eckelmann <sven@narfation.org>
Date:   Fri May 29 20:03:00 2026 +0200

    batman-adv: tt: reject oversized local TVLV buffers
    
    commit 1e9fab756f8395096d5bba7be0c373c4c8f5d165 upstream.
    
    The commit 3a359bf5c61d ("batman-adv: reject oversized global TT response
    buffers") added a check to ensure that a global return buffer size can be
    stored in an u16. The same buffer handling also exists for the local data
    buffer but was not touched.
    
    A similar check should be also be in place for the local TVLV buffer. It
    doesn't have the similar attack surface because it is only generated from
    locally discovered MAC addresses but the dynamic nature could still cause
    temporarily to large buffers.
    
    Cc: stable@kernel.org
    Fixes: 7ea7b4a14275 ("batman-adv: make the TT CRC logic VLAN specific")
    [ Context ]
    Signed-off-by: Sven Eckelmann <sven@narfation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

batman-adv: tvlv: abort OGM send on tvlv append failure [+ + +]
Author: Sven Eckelmann <sven@narfation.org>
Date:   Thu May 28 21:46:02 2026 +0200

    batman-adv: tvlv: abort OGM send on tvlv append failure
    
    commit 501368506563e151b322c8c3f228b796e615b90d upstream.
    
    batadv_tvlv_container_ogm_append() could fail in two ways: a memory
    allocation failure when resizing the packet buffer, or the tvlv data
    exceeding U16_MAX bytes. In both cases the function previously returned the
    old (now stale) tvlv_value_len rather than signalling an error, causing the
    OGM/OGM2 send path to transmit a packet whose TVLV length field no longer
    matched the actual buffer contents. And because it also didn't fill in the
    new TVLV data, sending either uninitialized or corrupted data on the wire.
    
    All errors in batadv_tvlv_container_ogm_append() must be forwarded to the
    caller. And the caller must abort the send of the OGM2. For B.A.T.M.A.N.
    IV, it is currently not allowed to abort the send. The non-TVLV part of the
    OGM must be queued up instead.
    
    Cc: stable@kernel.org
    Fixes: ef26157747d4 ("batman-adv: tvlv - basic infrastructure")
    [ Context ]
    Signed-off-by: Sven Eckelmann <sven@narfation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

batman-adv: tvlv: reject oversized TVLV packets [+ + +]
Author: Sven Eckelmann <sven@narfation.org>
Date:   Fri May 29 20:08:04 2026 +0200

    batman-adv: tvlv: reject oversized TVLV packets
    
    commit f50487e3566358b2b982b7801945e858c78ad9ab upstream.
    
    batadv_tvlv_container_ogm_append() builds a TVLV packet section from
    the tvlv.container_list. The total size of this section is computed by
    batadv_tvlv_container_list_size(), which sums the sizes of all registered
    containers.
    
    The return type and accumulator in batadv_tvlv_container_list_size() were
    u16. If the accumulated size exceeds U16_MAX, the value wraps around,
    causing the subsequent allocation in batadv_tvlv_container_ogm_append()
    to be undersized. The memcpy-style copy that follows would then write
    beyond the end of the allocated buffer, corrupting kernel memory.
    
    Fix this by widening the return type of batadv_tvlv_container_list_size()
    to size_t. In batadv_tvlv_container_ogm_append(), check the computed length
    against U16_MAX before proceeding, and bail out as if the allocation had
    failed when the limit is exceeded.
    
    Cc: stable@kernel.org
    Fixes: ef26157747d4 ("batman-adv: tvlv - basic infrastructure")
    Reported-by: Yuan Tan <yuantan098@gmail.com>
    Reported-by: Yifan Wu <yifanwucs@gmail.com>
    Reported-by: Juefei Pu <tomapufckgml@gmail.com>
    Reported-by: Xin Liu <bird@lzu.edu.cn>
    Reviewed-by: Yuan Tan <yuantan098@gmail.com>
    Signed-off-by: Sven Eckelmann <sven@narfation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

batman-adv: v: stop OGMv2 on disabled interface [+ + +]
Author: Sven Eckelmann <sven@narfation.org>
Date:   Thu May 28 21:27:33 2026 +0200

    batman-adv: v: stop OGMv2 on disabled interface
    
    commit f8ce8b8331a1bc44ad4905886a482214d428b253 upstream.
    
    When a batadv_hard_iface is disabled, its mesh_iface pointer is set to
    NULL. However, batadv_v_ogm_send_meshif() may still dispatch OGMs via
    batadv_v_ogm_queue_on_if() for interfaces that have since lost their
    mesh_iface association. This results in a NULL pointer dereference when
    batadv_v_ogm_queue_on_if() unconditionally calls netdev_priv() on the
    now NULL hard_iface->mesh_iface to retrieve the batadv_priv.
    
    It is necessary to ensure that the batadv_v_ogm_queue_on_if() checks that
    it is using the same mesh_iface for which batadv_v_ogm_send_meshif() was
    called.
    
    Cc: stable@kernel.org
    Fixes: 0da0035942d4 ("batman-adv: OGMv2 - add basic infrastructure")
    Reported-by: Yuan Tan <yuantan098@gmail.com>
    Reported-by: Yifan Wu <yifanwucs@gmail.com>
    Reported-by: Juefei Pu <tomapufckgml@gmail.com>
    Reported-by: Xin Liu <bird@lzu.edu.cn>
    Reviewed-by: Yuan Tan <yuantan098@gmail.com>
    [ switch to old "mesh_iface" name "soft_iface" ]
    Signed-off-by: Sven Eckelmann <sven@narfation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
bcache: fix uninitialized closure object [+ + +]
Author: Mingzhe Zou <mingzhe.zou@easystack.cn>
Date:   Fri Apr 3 12:21:35 2026 +0800

    bcache: fix uninitialized closure object
    
    [ Upstream commit 20a8e451ec1c7e99060b1bbaaad03ce88c39ddb8 ]
    
    In the previous patch ("bcache: fix cached_dev.sb_bio use-after-free and
    crash"), we adopted a simple modification suggestion from AI to fix the
    use-after-free.
    
    But in actual testing, we found an extreme case where the device is
    stopped before calling bch_write_bdev_super().
    
    At this point, struct closure sb_write has not been initialized yet.
    For this patch, we ensure that sb_bio has been completed via
    sb_write_mutex.
    
    Signed-off-by: Mingzhe Zou <mingzhe.zou@easystack.cn>
    Signed-off-by: Coly Li <colyli@fnnas.com>
    Link: https://patch.msgid.link/20260403042135.2221247-1-colyli@fnnas.com
    Fixes: fec114a98b87 ("bcache: fix cached_dev.sb_bio use-after-free and crash")
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
Bluetooth: 6lowpan: check skb_clone() return value in send_mcast_pkt() [+ + +]
Author: Zhao Dongdong <zhaodongdong@kylinos.cn>
Date:   Tue May 26 11:21:39 2026 +0800

    Bluetooth: 6lowpan: check skb_clone() return value in send_mcast_pkt()
    
    [ Upstream commit 3c40d381ce04f9575a5d8b542898183c3b4b38dc ]
    
    The skb_clone() function can return NULL if memory allocation fails.
    send_mcast_pkt() calls skb_clone() without checking the return value, which
    can lead to a NULL pointer dereference in send_pkt() when it dereferences
    skb->data.
    Add a NULL check after skb_clone() and skip the peer if the clone fails.
    
    Fixes: 18722c247023 ("Bluetooth: Enable 6LoWPAN support for BT LE devices")
    Signed-off-by: Zhao Dongdong <zhaodongdong@kylinos.cn>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: btusb: Allow firmware re-download when version matches [+ + +]
Author: Shuai Zhang <shuai.zhang@oss.qualcomm.com>
Date:   Thu May 21 13:25:47 2026 +0800

    Bluetooth: btusb: Allow firmware re-download when version matches
    
    commit 82855073c1081732656734b74d7d1d5e4cfd0da7 upstream.
    
    The Bluetooth host decides whether to download firmware by reading the
    controller firmware download completion flag and firmware version
    information.
    
    If a USB error occurs during the firmware download process (for example
    due to a USB disconnect), the download is aborted immediately. An
    incomplete firmware transfer does not cause the controller to set the
    download completion flag, but the firmware version information may be
    updated at an early stage of the download process.
    
    In this case, after USB reconnection, the host attempts to re-download
    the firmware because the download completion flag is not set. However,
    since the controller reports the same firmware version as the target
    firmware, the download is skipped. This ultimately results in the
    firmware not being properly updated on the controller.
    
    This change removes the restriction that skips firmware download when
    the versions are equal. It covers scenarios where the USB connection
    can be disconnected at any time and ensures that firmware download can
    be retriggered after USB reconnection, allowing the Bluetooth firmware
    to be correctly and completely updated.
    
    Fixes: 3267c884cefa ("Bluetooth: btusb: Add support for QCA ROME chipset family")
    Cc: stable@vger.kernel.org
    Signed-off-by: Shuai Zhang <shuai.zhang@oss.qualcomm.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: hci_qca: Convert timeout from jiffies to ms [+ + +]
Author: Shuai Zhang <shuai.zhang@oss.qualcomm.com>
Date:   Fri May 29 15:27:56 2026 -0400

    Bluetooth: hci_qca: Convert timeout from jiffies to ms
    
    [ Upstream commit 375ba7484132662a4a8c7547d088fb6275c00282 ]
    
    Since the timer uses jiffies as its unit rather than ms, the timeout value
    must be converted from ms to jiffies when configuring the timer. Otherwise,
    the intended 8s timeout is incorrectly set to approximately 33s.
    
    To improve readability, embed msecs_to_jiffies() directly in the macro
    definitions and drop the _MS suffix from macros that now yield jiffies
    values: MEMDUMP_TIMEOUT, FW_DOWNLOAD_TIMEOUT, IBS_DISABLE_SSR_TIMEOUT,
    CMD_TRANS_TIMEOUT, and IBS_BTSOC_TX_IDLE_TIMEOUT.
    
    IBS_WAKE_RETRANS_TIMEOUT_MS and IBS_HOST_TX_IDLE_TIMEOUT_MS are
    intentionally left unchanged. Their values are stored in the struct fields
    wake_retrans and tx_idle_delay, which hold ms values at runtime and can be
    modified via debugfs. The msecs_to_jiffies() conversion happens at each
    call site against the field value, so it cannot be embedded in the macro.
    
    Wake timer depends on commit c347ca17d62a
    
    Cc: stable@vger.kernel.org
    Fixes: d841502c79e3 ("Bluetooth: hci_qca: Collect controller memory dump during SSR")
    Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
    Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Signed-off-by: Shuai Zhang <shuai.zhang@oss.qualcomm.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: hci_qca: Migrate to serdev specific shutdown function [+ + +]
Author: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Date:   Fri May 29 15:27:55 2026 -0400

    Bluetooth: hci_qca: Migrate to serdev specific shutdown function
    
    [ Upstream commit 12a6a5726c515455935982429ac35dee2307233d ]
    
    This saves a cast in the driver. The motivation is stop using the callback
    .shutdown in qca_serdev_driver.driver to make it possible to drop that.
    
    Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
    Link: https://patch.msgid.link/261a3384e25c4837d4efee87958805f15d7d4e3c.1765526117.git.u.kleine-koenig@baylibre.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: 375ba7484132 ("Bluetooth: hci_qca: Convert timeout from jiffies to ms")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: hci_sync: fix UAF in hci_le_create_cis_sync [+ + +]
Author: Doruk Tan Ozturk <doruk@0sec.ai>
Date:   Mon May 25 18:24:38 2026 +0200

    Bluetooth: hci_sync: fix UAF in hci_le_create_cis_sync
    
    commit bfea6091e0fffb270c20e74384b660910277eb6c upstream.
    
    hci_le_create_cis_sync() dereferences conn->conn_timeout after releasing
    both rcu_read_lock() and hci_dev_lock(hdev).  The conn pointer was
    obtained from an RCU-protected iteration over hdev->conn_hash.list and
    is not valid once these locks are dropped.  A concurrent disconnect can
    free the hci_conn between the unlock and the dereference, causing a
    use-after-free read.
    
    The cancellation mechanism in hci_conn_del() cannot prevent this because
    hci_le_create_cis_pending() queues hci_create_cis_sync with data=NULL:
    
        hci_cmd_sync_queue(hdev, hci_create_cis_sync, NULL, NULL);
    
    While hci_conn_del() dequeues with data=conn:
    
        hci_cmd_sync_dequeue(hdev, NULL, conn, NULL);
    
    Since NULL != conn, the lookup in _hci_cmd_sync_lookup_entry() never
    matches, and the pending work item is not cancelled.
    
    Fix this by saving conn->conn_timeout into a local variable while the
    locks are still held, so the stale conn pointer is never dereferenced
    after unlock.
    
    This is the same class of bug as the one fixed by commit 035c25007c9e
    ("Bluetooth: hci_sync: Fix UAF on le_read_features_complete") which
    addressed the identical pattern in a different function.
    
    This vulnerability was identified using 0sec.ai, an open-source
    automated security auditing platform (https://github.com/0sec-labs).
    
    Fixes: c09b80be6ffc ("Bluetooth: hci_conn: Fix not waiting for HCI_EVT_LE_CIS_ESTABLISHED")
    Cc: stable@vger.kernel.org
    Reported-by: Doruk Tan Ozturk <doruk@0sec.ai>
    Signed-off-by: Doruk Tan Ozturk <doruk@0sec.ai>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: hci_sync: Set HCI_CMD_DRAIN_WORKQUEUE during device close [+ + +]
Author: Heitor Alves de Siqueira <halves@igalia.com>
Date:   Tue May 26 10:50:58 2026 -0300

    Bluetooth: hci_sync: Set HCI_CMD_DRAIN_WORKQUEUE during device close
    
    [ Upstream commit 525daaea459fc215f432de1b8debbd9144bf97b0 ]
    
    Since hci_dev_close_sync() can now be called during the reset path, we
    should also set HCI_CMD_DRAIN_WORKQUEUE. This avoids queuing timeouts
    while the hdev workqueue is being drained.
    
    Fixes: 877afadad2dc ("Bluetooth: When HCI work queue is drained, only queue chained work")
    Signed-off-by: Heitor Alves de Siqueira <halves@igalia.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: HIDP: fix missing length checks in hidp_input_report() [+ + +]
Author: Muhammad Bilal <meatuni001@gmail.com>
Date:   Wed May 20 18:56:43 2026 -0400

    Bluetooth: HIDP: fix missing length checks in hidp_input_report()
    
    commit 2a3ac9ee11dbb9845f3947cef4a79dba658cf6f6 upstream.
    
    hidp_input_report() reads keyboard and mouse payload data from an skb
    without first verifying that skb->len contains enough data.
    
    hidp_recv_intr_frame() pulls the 1-byte HIDP header before dispatching
    to hidp_input_report(). If a paired device sends a truncated packet,
    the handler reads beyond the valid skb data, resulting in an
    out-of-bounds read of skb data. The OOB bytes may be interpreted as
    phantom key presses or spurious mouse movement.
    
    Replace the open-coded length tracking and pointer arithmetic with
    skb_pull_data() calls. skb_pull_data() returns NULL if the requested
    bytes are not present, eliminating the need for a manual size variable
    and the separate skb->len guard.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable@vger.kernel.org
    Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: ISO: fix UAF in iso_recv_frame [+ + +]
Author: Muhammad Bilal <meatuni001@gmail.com>
Date:   Wed May 27 04:59:17 2026 +0000

    Bluetooth: ISO: fix UAF in iso_recv_frame
    
    commit 47f23a259517abbdb8032c057a1e8a6bf3734878 upstream.
    
    iso_recv_frame reads conn->sk under iso_conn_lock but releases the lock
    before using sk, with no reference held. A concurrent iso_sock_kill()
    can free sk in that window, causing use-after-free on sk->sk_state and
    sock_queue_rcv_skb().
    
    Fix by replacing the bare pointer read with iso_sock_hold(conn), which
    calls sock_hold() while the spinlock is held, atomically elevating the
    refcount before the lock drops. Add a drop_put label so sock_put() is
    called on all exit paths where the hold succeeded.
    
    Fixes: ccf74f2390d60a2f9a75ef496d2564abb478f46a ("Bluetooth: Add BTPROTO_ISO socket type")
    Cc: stable@vger.kernel.org
    Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: ISO: serialize iso_sock_clear_timer with socket lock [+ + +]
Author: Muhammad Bilal <meatuni001@gmail.com>
Date:   Wed May 27 04:59:18 2026 +0000

    Bluetooth: ISO: serialize iso_sock_clear_timer with socket lock
    
    commit 4b5f8e608749b7e8fa386c6e4301cf9272595859 upstream.
    
    iso_sock_close() calls iso_sock_clear_timer() before acquiring
    lock_sock(sk).
    
    iso_sock_clear_timer() reads iso_pi(sk)->conn twice without the
    socket lock held:
    
        if (!iso_pi(sk)->conn)
            return;
        cancel_delayed_work(&iso_pi(sk)->conn->timeout_work);
    
    Concurrently, iso_conn_del() executes under lock_sock(sk) and calls
    iso_chan_del(), which sets iso_pi(sk)->conn to NULL and may result in
    the final reference to the connection being dropped:
    
        CPU0                         CPU1
        ----                         ----
        iso_sock_clear_timer()
          if (conn != NULL) ...      lock_sock(sk)
                                       iso_chan_del()
                                       iso_pi(sk)->conn = NULL
          cancel_delayed_work(conn)  /* NULL deref or UAF */
    
    iso_pi(sk)->conn is not stable across the unlock window, causing a
    NULL pointer dereference or use-after-free.
    
    Serialize iso_sock_clear_timer() with the socket lock by moving it
    inside lock_sock()/release_sock(), matching the pattern used in
    iso_conn_del() and all other call sites.
    
    Fixes: ccf74f2390d60a2f9a75ef496d2564abb478f46a ("Bluetooth: Add BTPROTO_ISO socket type")
    Cc: stable@vger.kernel.org
    Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: l2cap: clear chan->ident on ECRED reconfiguration success [+ + +]
Author: Zhenghang Xiao <kipreyyy@gmail.com>
Date:   Tue May 26 18:51:52 2026 +0800

    Bluetooth: l2cap: clear chan->ident on ECRED reconfiguration success
    
    [ Upstream commit 00e1950716c6ed67d74777b2db286b0fa23b4be9 ]
    
    l2cap_ecred_reconf_rsp() returns early on success without clearing
    chan->ident. Every other L2CAP response handler (l2cap_ecred_conn_rsp,
    l2cap_le_connect_rsp, l2cap_config_rsp) clears chan->ident after a
    successful transaction to prevent the channel from matching subsequent
    responses with the recycled ident value.
    
    A remote attacker that completed a reconfiguration as the peer can
    replay a failure response with the stale ident, causing the kernel to
    match and destroy the already-established channel via
    l2cap_chan_del(chan, ECONNRESET).
    
    Clear chan->ident for all matching channels on success, and harden the
    failure path by using l2cap_chan_hold_unless_zero() consistent with
    other L2CAP handlers (l2cap_le_command_rej, __l2cap_get_chan_by_ident).
    
    Fixes: 15f02b910562 ("Bluetooth: L2CAP: Add initial code for Enhanced Credit Based Mode")
    Signed-off-by: Zhenghang Xiao <kipreyyy@gmail.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: L2CAP: fix chan ref leak in l2cap_chan_timeout() on !conn [+ + +]
Author: Siwei Zhang <oss@fourdim.xyz>
Date:   Wed May 20 22:30:36 2026 -0400

    Bluetooth: L2CAP: fix chan ref leak in l2cap_chan_timeout() on !conn
    
    commit 9dbd84990394c51f5cee1e8871bb5ff8af5ed939 upstream.
    
    __set_chan_timer() takes a l2cap_chan reference via l2cap_chan_hold()
    before scheduling the delayed work.  The normal path in
    l2cap_chan_timeout() drops this reference with l2cap_chan_put() at the
    end, but the early return when chan->conn is NULL skips the put,
    leaking the reference.
    
    Add the missing l2cap_chan_put() before the early return.
    
    Fixes: adf0398cee86 ("Bluetooth: l2cap: fix null-ptr-deref in l2cap_chan_timeout")
    Cc: stable@vger.kernel.org
    Signed-off-by: Siwei Zhang <oss@fourdim.xyz>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: L2CAP: Fix possible crash on l2cap_ecred_conn_rsp [+ + +]
Author: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date:   Mon May 11 12:09:42 2026 -0400

    Bluetooth: L2CAP: Fix possible crash on l2cap_ecred_conn_rsp
    
    [ Upstream commit 41c2713b204e6cb6a94587bc6bf6935107df5479 ]
    
    If dcid is received for an already-assigned destination CID the spec
    requires that both channels to be discarded, but calling l2cap_chan_del
    may invalidate the tmp cursor created by list_for_each_entry_safe and
    in fact it is the wrong procedure as the chan->dcid may be assigned
    previously it really needs to be disconnected.
    
    Calling l2cap_chan_clone directly may still lead to l2cap_chan_del so
    instead schedule l2cap_chan_timeout with delay 0 to close the channel
    asynchronously.
    
    Fixes: 15f02b910562 ("Bluetooth: L2CAP: Add initial code for Enhanced Credit Based Mode")
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: L2CAP: use chan timer to close channels in cleanup_listen() [+ + +]
Author: Siwei Zhang <oss@fourdim.xyz>
Date:   Wed May 20 22:12:20 2026 -0400

    Bluetooth: L2CAP: use chan timer to close channels in cleanup_listen()
    
    commit 8c8e620467a7b51562dbcefbd1f09f288d7d710d upstream.
    
    l2cap_chan_close() removes the channel from conn->chan_l, which
    must be done under conn->lock.  cleanup_listen() runs under the
    parent sk_lock, so acquiring conn->lock would invert the
    established conn->lock -> chan->lock -> sk_lock order.
    
    Instead of calling l2cap_chan_close() directly, schedule
    l2cap_chan_timeout with delay 0 to close the channel
    asynchronously.  The timeout handler already acquires conn->lock
    and chan->lock in the correct order.
    
    The timer is only armed when chan->conn is still set: if it is
    already NULL, l2cap_conn_del() has already processed this channel
    (l2cap_chan_del + l2cap_sock_teardown_cb + l2cap_sock_close_cb),
    so there is nothing left to do.  If l2cap_conn_del() races in
    after the timer is armed, __clear_chan_timer() inside
    l2cap_chan_del() cancels it; if the timer has already fired, the
    handler returns harmlessly because chan->conn was cleared.
    
    Fixes: 3df91ea20e74 ("Bluetooth: Revert to mutexes from RCU list")
    Cc: <stable@vger.kernel.org> # 0b58004: Bluetooth: fix UAF in l2cap_sock_cleanup_listen() vs l2cap_conn_del()
    Signed-off-by: Siwei Zhang <oss@fourdim.xyz>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
bonding: refuse to enslave CAN devices [+ + +]
Author: Oliver Hartkopp <socketcan@hartkopp.net>
Date:   Tue May 26 21:33:19 2026 +0200

    bonding: refuse to enslave CAN devices
    
    [ Upstream commit 8ba68464e4787b6a7ec938826e16124df20fd23d ]
    
    syzbot reported a kernel paging request crash in
    can_rx_unregister() inside net/can/af_can.c. The crash occurs
    because a virtual CAN device (vxcan) is being enslaved to a
    bonding master.
    
    During the enslavement process, the bonding driver mutates
    and modifies the network device states to fit an Ethernet-like
    aggregation model. However, CAN devices operate on a completely
    different Layer 2 architecture, relying on the CAN mid-layer
    private data structure (can_ml_priv) instead of standard
    Ethernet structures. Since bonding does not initialize or
    maintain these CAN structures, subsequent operations on the
    half-enslaved interface (such as closing associated sockets
    via isotp_release) lead to a null-pointer dereference when
    accessing the CAN receiver lists.
    
    Bonding CAN interfaces is architecturally invalid as CAN lacks
    MAC addresses, ARP capabilities, and standard Ethernet
    link-layer mechanisms. While generic loopback devices are
    blocked globally in net/core/dev.c, virtual CAN devices
    bypass this check because they do not carry the IFF_LOOPBACK
    flag, despite acting as local software-loopbacks.
    
    Fix this by explicitly blocking network devices of type
    ARPHRD_CAN from being enslaved at the very beginning of
    bond_enslave(). This prevents illegal state mutations,
    eliminates the resulting KASAN crashes, and avoids potential
    memory leaks from incomplete socket cleanups.
    
    As the CAN support has been added a long time after bonding
    the Fixes-tag points to the introduction of ARPHRD_CAN that
    would have needed a specific handling in bonding_main.c.
    
    Fixes: cd05acfe65ed ("[CAN]: Allocate protocol numbers for PF_CAN")
    Reported-by: syzbot+8ed98cbd0161632bce95@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=8ed98cbd0161632bce95
    Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
    Acked-by: Jay Vosburgh <jv@jvosburgh.net>
    Link: https://patch.msgid.link/20260526-bonding-candev-v1-1-ba1df400918a@hartkopp.net
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
bpf: sockmap: fix tail fragment offset in bpf_msg_push_data [+ + +]
Author: Yuqi Xu <xuyq21@lenovo.com>
Date:   Wed May 27 11:48:15 2026 +0800

    bpf: sockmap: fix tail fragment offset in bpf_msg_push_data
    
    commit f72eed9b84fb771019a955908132410a9ba9ea3f upstream.
    
    When bpf_msg_push_data() inserts data in the middle of a scatterlist
    entry, it splits the original entry into a left fragment and a right
    fragment.
    
    The right fragment offset is page-local, but the code advances it with
    `start`, which is the message-global insertion point. For inserts into a
    non-first SG entry, this over-advances the offset and leaves the split
    layout inconsistent.
    
    Advance the right fragment offset by the fragment-local delta,
    `start - offset`, which matches the length removed from the front of the
    original entry.
    
    Fixes: 6fff607e2f14 ("bpf: sk_msg program helper bpf_msg_push_data")
    Cc: stable@kernel.org
    Reported-by: Yuan Tan <yuantan098@gmail.com>
    Reported-by: Zhengchuan Liang <zcliangcn@gmail.com>
    Reported-by: Xin Liu <bird@lzu.edu.cn>
    Signed-off-by: Yuqi Xu <xuyq21@lenovo.com>
    Signed-off-by: Ren Wei <n05ec@lzu.edu.cn>
    Link: https://patch.msgid.link/8b129d10566aa3eb43f61a8f9757bcf51707d324.1779636774.git.xuyq21@lenovo.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
comedi: comedi_test: fix check for valid scan_begin_src in waveform_ai_cmdtest() [+ + +]
Author: Ian Abbott <abbotti@mev.co.uk>
Date:   Wed Apr 22 17:21:19 2026 +0100

    comedi: comedi_test: fix check for valid scan_begin_src in waveform_ai_cmdtest()
    
    commit 542f5248cb481073203e0dadab5bcbd28aeae308 upstream.
    
    Commit 783ddaebd397 ("staging: comedi: comedi_test: support
    scan_begin_src == TRIG_FOLLOW") neglected to add a test that
    `scan_begin_src` has only one bit set.  The allowed values are
    `TRIG_FOLLOW` and `TRIG_TIMER`, but the code incorrectly also allows
    `TRIG_FOLLOW | TRIG_TIMER`.  Add a call to
    `comedi_check_trigger_is_unique()` to check that only one trigger source
    bit is set.
    
    Fixes: 783ddaebd397 ("staging: comedi: comedi_test: support scan_begin_src == TRIG_FOLLOW")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
    Link: https://patch.msgid.link/20260422162138.36003-1-abbotti@mev.co.uk
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

comedi: comedi_test: Fix limiting of convert_arg in waveform_ai_cmdtest() [+ + +]
Author: Ian Abbott <abbotti@mev.co.uk>
Date:   Wed Apr 22 15:46:37 2026 +0100

    comedi: comedi_test: Fix limiting of convert_arg in waveform_ai_cmdtest()
    
    commit 8a3bee801d420be8a7a0bae4a26547b353b8fe22 upstream.
    
    The function checks and possibly modifies the description of an
    asynchronous command to be run on the analog input subdevice of a comedi
    device attached to the "comedi_test" driver, returning 0 if no
    modifications were required, or a positive value that indicates which
    step of the checking process it failed on.  Step 4 fixes up various
    argument values for various trigger sources.
    
    There are two bugs in the fixing up of the `convert_arg` value to keep
    the `scan_begin_arg` value within the range of `unsigned int` when
    `scan_begin_src` and `convert_src` both have the value `TRIG_TIMER`,
    which indicates that the corresponding `_arg` values hold a time period
    in nanoseconds.  The code also uses `scan_end_arg` which hold the number
    of "conversions" within each "scan".  The goal is to end up with the
    scan period being less than or equal to the convert period multiplied by
    the number of conversions per scan.  It intends to do that by clamping
    the `convert_arg` value to a maximum value of `UINT_MAX / scan_end_arg`
    rounded down to a multiple of 1000 (`NSEC_PER_USEC`).
    
    (The rounding from nanoseconds to microseconds is because the driver is
    modelling a device that uses a 1 MHz clock for timing.  This is partly
    because that is a more typical timing base for real hardware devices
    driven by comedi, and partly because the driver used to use `struct
    timeval` internally.)
    
    The first bug is that the code checks if `scan_begin_arg == TRIG_TIMER`
    when it should be checking if `scan_begin_src == TRIG_TIMER`.  The
    bugged check will always fail because if `scan_begin_src == TRIG_TIMER`,
    then `scan_begin_arg` will be at least 1000 (`NSEC_PER_USEC`), otherwise
    `scan_begin_src == TRIG_FOLLOW` and `scan_begin_arg` will be 0.  (N.B
    `TRIG_TIMER` is defined as `0x10`.)  The second bug is that is rounding
    the maximum value down to a multiple of 1000000000 (`NSEC_PER_SEC`)
    instead of 1000 (`NSEC_PER_USEC`), however this bug is not reached due
    to the first bug.  This patch fixes both bugs.
    
    Fixes: 783ddaebd397 ("staging: comedi: comedi_test: support scan_begin_src == TRIG_FOLLOW")
    Fixes: 5afdcad2f818 ("staging: comedi: comedi_test: limit maximum convert_arg")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
    Link: https://patch.msgid.link/20260422144637.27692-1-abbotti@mev.co.uk
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
counter: Fix refcount leak in counter_alloc() error path [+ + +]
Author: Guangshuo Li <lgs201920130244@gmail.com>
Date:   Mon Apr 13 21:46:04 2026 +0800

    counter: Fix refcount leak in counter_alloc() error path
    
    commit d9eeb0ea0d2de658663bfaa9c26eccdd8fd64440 upstream.
    
    After device_initialize(), the lifetime of the embedded struct device
    is expected to be managed through the device core reference counting.
    
    In counter_alloc(), if dev_set_name() fails after device_initialize(),
    the error path removes the chrdev, frees the ID, and frees the backing
    allocation directly instead of releasing the device reference with
    put_device(). This bypasses the normal device lifetime rules and may
    leave the reference count of the embedded struct device unbalanced,
    resulting in a refcount leak.
    
    The issue was identified by a static analysis tool I developed and
    confirmed by manual review.
    
    Fix this by using put_device() in the dev_set_name() failure path and
    let counter_device_release() handle the final cleanup.
    
    Fixes: 4da08477ea1f ("counter: Set counter device name")
    Cc: stable@vger.kernel.org
    Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
    Link: https://lore.kernel.org/r/20260413134604.2861772-1-lgs201920130244@gmail.com
    Signed-off-by: William Breathitt Gray <wbg@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
cxl/test: Update mock dev array before calling platform_device_add() [+ + +]
Author: Li Ming <ming.li@zohomail.com>
Date:   Wed May 20 20:14:57 2026 +0800

    cxl/test: Update mock dev array before calling platform_device_add()
    
    [ Upstream commit d90f236f8b9e354848bd226f581db27755ab901d ]
    
    CXL test environment hits the following error sometimes.
    
     cxl_mem mem9: endpoint7 failed probe
    
    All mock memdevs are platform firmware devices added by cxl_test module,
    and cxl_test module also provides a platform device driver for them to
    create a memdev device to CXL subsystem. cxl_test module uses
    cxl_rcd/mem_single/mem arrays to store different types of mock memdevs.
    CXL drivers calls registered mock functions for a mock memdev by
    checking if a given memdev is in these arrays.
    
    When cxl_test module adds these mock memdevs, it always calls
    platform_device_add() before adding them to a suitable mock memdev
    array. However, there is a small window where CXL drivers calls mock
    function for a added memdev before it added to a mock memdev array. In
    above case, cxl endpoint driver considers a added memdev was not a mock
    memdev, then calling devm_cxl_endpoint_decoders_setup() for it rather
    than mock_endpoint_decoders_setup().
    
    An appropriate solution is that adding a new mock device to a mock
    device array before calling platform_device_add() for it. It can
    guarantee the new mock device is visible to CXL subsystem.
    
    This patch introduces a new helped called cxl_mock_platform_device_add()
    to handle the issue, and uses the function for all mock devices addition.
    
    Fixes: 3a2b97b3210b ("cxl/test: Improve init-order fidelity relative to real-world systems")
    Signed-off-by: Li Ming <ming.li@zohomail.com>
    Tested-by: Alison Schofield <alison.schofield@intel.com>
    Reviewed-by: Alison Schofield <alison.schofield@intel.com>
    Link: https://patch.msgid.link/20260520121457.234404-1-ming.li@zohomail.com
    Signed-off-by: Dave Jiang <dave.jiang@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
Linux: Disable -Wattribute-alias for clang-23 and newer [+ + +]
Author: Nathan Chancellor <nathan@kernel.org>
Date:   Sat May 16 04:34:14 2026 +0900

    Disable -Wattribute-alias for clang-23 and newer
    
    commit 175db11786bde9061db526bf1ac5107d915f5163 upstream.
    
    Clang recently added support for -Wattribute-alias [1], which results in
    the same warnings that necessitated commit bee20031772a ("disable
    -Wattribute-alias warning for SYSCALL_DEFINEx()") for GCC.
    
      kernel/time/itimer.c:325:1: error: alias and aliasee have different types 'long (unsigned int)' and 'long (typeof (__builtin_choose_expr((__builtin_types_compatible_p(typeof ((unsigned int)0), typeof (0LL)) || __builtin_types_compatible_p(typeof ((unsigned int)0), typeof (0ULL))), 0LL, 0L)))' (aka 'long (long)') [-Werror,-Wattribute-alias]
        325 | SYSCALL_DEFINE1(alarm, unsigned int, seconds)
            | ^
      include/linux/syscalls.h:225:36: note: expanded from macro 'SYSCALL_DEFINE1'
        225 | #define SYSCALL_DEFINE1(name, ...) SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
            |                                    ^
      include/linux/syscalls.h:236:2: note: expanded from macro 'SYSCALL_DEFINEx'
        236 |         __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
            |         ^
      include/linux/syscalls.h:251:18: note: expanded from macro '__SYSCALL_DEFINEx'
        251 |                 __attribute__((alias(__stringify(__se_sys##name))));    \
            |                                ^
      kernel/time/itimer.c:325:1: note: aliasee is declared here
      include/linux/syscalls.h:225:36: note: expanded from macro 'SYSCALL_DEFINE1'
        225 | #define SYSCALL_DEFINE1(name, ...) SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
            |                                    ^
      include/linux/syscalls.h:236:2: note: expanded from macro 'SYSCALL_DEFINEx'
        236 |         __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
            |         ^
      include/linux/syscalls.h:255:18: note: expanded from macro '__SYSCALL_DEFINEx'
        255 |         asmlinkage long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__))  \
            |                         ^
      <scratch space>:16:1: note: expanded from here
         16 | __se_sys_alarm
            | ^
    
    Disable the warnings in the same way for clang-23 and newer. Disable the
    warning about unknown warning options to avoid breaking the build for
    versions of clang-23 that do not have -Wattribute-alias, such as ones
    deployed by vendors like Android or CI systems or when bisecting LLVM
    between llvmorg-23-init and release/23.x.
    
    Cc: stable@vger.kernel.org
    Closes: https://github.com/ClangBuiltLinux/linux/issues/2163
    Link: https://github.com/llvm/llvm-project/commit/40da6920a0d71d49dfa2392b09153600b0759f5e [1]
    Link: https://patch.msgid.link/20260515-syscall-disable-attribute-alias-for-clang-v1-1-9a9d95d41df6@kernel.org
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/amd/pm/si: Disregard vblank time when no displays are connected [+ + +]
Author: Timur Kristóf <timur.kristof@gmail.com>
Date:   Tue May 19 10:41:54 2026 +0200

    drm/amd/pm/si: Disregard vblank time when no displays are connected
    
    commit dd4f3ee535b3b0ac027f75dbf9dc5fc88733c765 upstream.
    
    When no displays are connected, there is no vblank
    happening so the power management code shouldn't
    worry about it.
    
    This fixes a regression that caused the memory clock
    to be stuck at maximum when there were no displays
    connected to a SI GPU.
    
    Fixes: 9003a0746864 ("drm/amd/pm: Treat zero vblank time as too short in si_dpm (v3)")
    Fixes: 9d73b107a61b ("drm/amd/pm: Use pm_display_cfg in legacy DPM (v2)")
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Tested-by: Jeremy Klarenbeek <jeremy.klarenbeek99@gmail.com>
    Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 6d87e0199f7b83735b56e422d59f170a201897a8)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/amdkfd: Check for pdd drm file first in CRIU restore path [+ + +]
Author: David Francis <David.Francis@amd.com>
Date:   Thu May 14 10:31:20 2026 -0400

    drm/amdkfd: Check for pdd drm file first in CRIU restore path
    
    commit 6842b6a4b72da9b2906ffc5ca9d846ace2c54c14 upstream.
    
    CRIU restore ioctls are meant to be called by CRIU with no
    existing drm file. There's an error path
    for if the drm file unexpectedly exists. It was positioned so
    it was missing a fput(drm_file).
    
    Do that check earlier, as soon as we have the pdd.
    
    Signed-off-by: David Francis <David.Francis@amd.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 2bab781dac78916c5cc8de76345a4102449267d7)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amdkfd: fix a vulnerability of integer overflow in kfd debugger [+ + +]
Author: Eric Huang <jinhuieric.huang@amd.com>
Date:   Tue May 12 10:19:52 2026 -0400

    drm/amdkfd: fix a vulnerability of integer overflow in kfd debugger
    
    commit 93f5534b35a05ef8a0109c1eefa800062fee810a upstream.
    
    get_queue_ids() computes array_size = num_queues * sizeof(uint32_t),
    which could overflow on 32-bit size_t build. using array_size()
    instead, it saturates to SIZE_MAX on overflow.
    
    Signed-off-by: Eric Huang <jinhuieric.huang@amd.com>
    Acked-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 2d57a0475f085c08b49312dfd8edcb461845f285)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amdkfd: fix NULL pointer bug in svm_range_set_attr [+ + +]
Author: Eric Huang <jinhuieric.huang@amd.com>
Date:   Thu May 7 15:51:49 2026 -0400

    drm/amdkfd: fix NULL pointer bug in svm_range_set_attr
    
    commit e984d61d92e702096058f0f828f4b2b8563b88ce upstream.
    
    The process_info could be NULL if user doesn't call kfd_ioctl_acquire_vm
    before calling kfd_ioctl_svm.
    
    Signed-off-by: Eric Huang <jinhuieric.huang@amd.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 83a26c812e0529eb040d31a76f73e33e637243d4)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/dp: Add eDP 1.5 bit definition [+ + +]
Author: Suraj Kandpal <suraj.kandpal@intel.com>
Date:   Fri May 29 13:42:05 2026 +0300

    drm/dp: Add eDP 1.5 bit definition
    
    commit 5dfc37a6b77bf6beedbd30d70184b54e1a08ccac upstream.
    
    Add the eDP revision bit value for 1.5.
    
    Spec: eDPv1.5 Table 16-5
    Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
    Reviewed-by: Arun R Murthy <arun.r.murthy@intel.com>
    Tested-by: Ben Kao <ben.kao@intel.com>
    Acked-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20250206063253.2827017-2-suraj.kandpal@intel.com
    Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/hyperv: validate resolution_count and fix WIN8 fallback [+ + +]
Author: Berkant Koc <me@berkoc.com>
Date:   Tue May 19 22:08:17 2026 +0200

    drm/hyperv: validate resolution_count and fix WIN8 fallback
    
    commit 13d33b9ef67066c77c84273fac5a1d3fde3533d1 upstream.
    
    A SYNTHVID_RESOLUTION_RESPONSE with resolution_count > 64 walks past
    the supported_resolution[SYNTHVID_MAX_RESOLUTION_COUNT] array in the
    parse loop. Bound resolution_count against the array size, folded
    into the existing zero-check.
    
    When the WIN10 resolution probe fails, the caller in
    hyperv_connect_vsp() left hv->screen_*_max / preferred_* unpopulated,
    which sets mode_config.max_width / max_height to 0 and makes
    drm_internal_framebuffer_create() reject every userspace framebuffer
    with -EINVAL. The pre-WIN10 branch had the same gap for
    preferred_width / preferred_height. Use a single post-probe fallback
    guarded by screen_width_max == 0 so both paths converge on the WIN8
    defaults.
    
    Signed-off-by: Berkant Koc <me@berkoc.com>
    Assisted-by: Claude:claude-opus-4-7 berkoc-pipeline
    Fixes: 76c56a5affeb ("drm/hyperv: Add DRM driver for hyperv synthetic video device")
    Cc: stable@vger.kernel.org # 5.14+
    Reviewed-by: Michael Kelley <mhklinux@outlook.com>
    Tested-by: Michael Kelley <mhklinux@outlook.com>
    Signed-off-by: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
    Link: https://patch.msgid.link/6945b22419c7d404b4954a113de2ac9c900dba93.1779542874.git.me@berkoc.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/hyperv: validate VMBus packet size in receive callback [+ + +]
Author: Berkant Koc <me@berkoc.com>
Date:   Sat May 23 15:27:47 2026 +0200

    drm/hyperv: validate VMBus packet size in receive callback
    
    commit 7f87763f47a3c22fb50265a00619ef10f2394b18 upstream.
    
    hyperv_receive_sub() reads msg->vid_hdr.type and dispatches into one
    of four message-type branches without knowing how many bytes the host
    wrote into hv->recv_buf. The completion path then runs
    memcpy(hv->init_buf, msg, VMBUS_MAX_PACKET_SIZE), so the consumer that
    wakes on wait_for_completion_timeout() can read up to 16 KiB of
    residue from a prior message as if it were the response payload.
    
    Pass bytes_recvd into hyperv_receive_sub() and reject any packet that
    does not cover the pipe + synthvid header. A single switch on
    msg->vid_hdr.type then computes the type-specific payload size: the
    three completion-driving types (SYNTHVID_VERSION_RESPONSE,
    SYNTHVID_RESOLUTION_RESPONSE, SYNTHVID_VRAM_LOCATION_ACK) fall through
    to a shared exit that requires that size before memcpy/complete, while
    SYNTHVID_FEATURE_CHANGE validates its own payload and returns before
    reading is_dirt_needed. Unknown types are dropped.
    
    SYNTHVID_RESOLUTION_RESPONSE is variable length: the host fills
    resolution_count entries, not the full SYNTHVID_MAX_RESOLUTION_COUNT
    array. Validate the fixed prefix first so resolution_count can be
    read, bound it against the array, then require only the count-sized
    array, so the shorter responses the host actually sends are accepted.
    
    Only run the sub-handler when vmbus_recvpacket() returned success. The
    memcpy length is bytes_recvd, which is bounded by VMBUS_MAX_PACKET_SIZE
    only on a successful receive; on -ENOBUFS vmbus_recvpacket() instead
    reports the required length, which can exceed hv->recv_buf, so copying
    bytes_recvd would read and write past the 16 KiB buffers. Gating on the
    success return keeps the copy bounded. The nonzero-return path is itself
    a malformed-message case and is now logged rather than silently skipped;
    channel recovery is not attempted.
    
    Rejected packets are reported via drm_err_ratelimited() rather than
    silently dropped, matching the CoCo-hardened pattern in
    hv_kvp_onchannelcallback().
    
    Fixes: 76c56a5affeb ("drm/hyperv: Add DRM driver for hyperv synthetic video device")
    Cc: stable@vger.kernel.org # 5.14+
    Signed-off-by: Berkant Koc <me@berkoc.com>
    Assisted-by: Claude:claude-opus-4-7 berkoc-pipeline
    Reviewed-by: Michael Kelley <mhklinux@outlook.com>
    Tested-by: Michael Kelley <mhklinux@outlook.com>
    Signed-off-by: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
    Link: https://patch.msgid.link/8200dbc199c7a9b75ac7e8af6c748d2189b5ebd5.1779542874.git.me@berkoc.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/i915/psr: Add defininitions for INTEL_WA_REGISTER_CAPS DPCD register [+ + +]
Author: Jouni Högander <jouni.hogander@intel.com>
Date:   Fri May 29 13:42:03 2026 +0300

    drm/i915/psr: Add defininitions for INTEL_WA_REGISTER_CAPS DPCD register
    
    commit fbceb39b536e40c2f7cc47ab42037bb7c2b7ced9 upstream.
    
    EDP specification says:
    
    "If either VSC SDP is unable to be transmitted 100 ns before the SU region,
    the Source device may optionally transmit the VSC SDP during the prior
    video scan line’s HBlank period There is a Intel specific drm dp register
    currently containing bits related how TCON can support PSR2 with SDP on
    prior line."
    
    Unfortunately many panels are having problems in implementing this. So
    there is a custom Intel specific DPCD register (INTEL_WA_REGISTER_CAPS) to
    figure out if this is properly implemented on a panel or if panel doesn't
    require that 100 ns delay before the SU region. Here are the definitions in
    this custom DPCD address:
    
    0 = Panel doesn't support SDP on prior line
    1 = Panel supports SDP on prior line
    2 = Panel doesn't have 100ns requirement
    3 = Reserved
    
    Add definitions for this new register and it's values into new header
    intel_dpcd.h.
    
    v2: add INTEL_DPCD_ prefix to definitions
    
    Bspec: 74741
    Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
    Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
    Link: https://patch.msgid.link/20260515095756.2799483-2-jouni.hogander@intel.com
    (cherry picked from commit 1da1c9294825f08f622c473480d185680c2a3b75)
    Signed-off-by: Tvrtko Ursulin <tursulin@ursulin.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/i915/psr: Apply Intel DPCD workaround when SDP on prior line used [+ + +]
Author: Jouni Högander <jouni.hogander@intel.com>
Date:   Fri May 29 13:42:06 2026 +0300

    drm/i915/psr: Apply Intel DPCD workaround when SDP on prior line used
    
    commit 4703049f768fc1c1caac754134118bee1a3af189 upstream.
    
    There is Intel specific workaround DPCD address containing workaround for
    case where SDP is on prior line. Apply this workaround according to values
    in the offset.
    
    Fixes: 61e887329e33 ("drm/i915/xelpd: Handle PSR2 SDP indication in the prior scanline")
    Cc: <stable@vger.kernel.org> # v5.15+
    Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
    Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
    Link: https://patch.msgid.link/20260515095756.2799483-4-jouni.hogander@intel.com
    (cherry picked from commit c3fe899fbeac86ea4a5ca9dd845b2cbc0da46249)
    Signed-off-by: Tvrtko Ursulin <tursulin@ursulin.net>
    Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/i915/psr: Read Intel DPCD workaround register [+ + +]
Author: Jouni Högander <jouni.hogander@intel.com>
Date:   Fri May 29 13:42:04 2026 +0300

    drm/i915/psr: Read Intel DPCD workaround register
    
    commit f30bece421a4ae34359254e1dc2a187a42b6af9b upstream.
    
    Read Intel DPCD workaround register and store it into
    intel_connector->dp.psr_caps. psr_caps was chosen as currently it contains
    only PSR workaround for PSR2 SDP on prior scanline implementation.
    
    Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
    Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
    Link: https://patch.msgid.link/20260515095756.2799483-3-jouni.hogander@intel.com
    (cherry picked from commit c48ff24d0f4ab7ad696b2d35ad64ce7e049c668c)
    Signed-off-by: Tvrtko Ursulin <tursulin@ursulin.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/i915: Fix potential UAF in TTM object purge [+ + +]
Author: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Date:   Fri May 8 14:23:51 2026 +0200

    drm/i915: Fix potential UAF in TTM object purge
    
    commit 5c4063c87a619e4df954c179d24628636f5db15f upstream.
    
    TLDR: The bo->ttm object might be changed by calling ttm_bo_validate(),
          move casting it to an i915_tt object later to actually get the right
          pointer.
    
    A user reported hitting the following bug under heavy use on DG2:
    
    [26620.095550] Oops: general protection fault, probably for non-canonical address 0xa56b6b6b6b6b6b8b: 0000 1 SMP NOPTI
    [26620.095556] CPU: 2 UID: 0 PID: 631 Comm: Xorg Not tainted 6.18.8 #1 PREEMPT(lazy)
    [26620.095558] Hardware name: ASRock B850M Steel Legend WiFi/B850M Steel Legend WiFi, BIOS 3.50 09/18/2025
    [26620.095559] RIP: 0010:i915_ttm_purge+0x84/0x100 [i915]
    [26620.095604] Code: 00 00 00 48 8d 54 24 10 48 89 e6 48 89 fb e8 83 aa ae ff 85 c0 75 6f 48 83 bb a8 01 00 00 00 74 2c 48 8b 45 78 48 85 c0 74 23 <48> 8b 78 20 48 c7 c2 ff ff ff ff 31 f6 e8 7a 73 e3 e0 48 8b 7d 78
    [26620.095605] RSP: 0018:ffffc90005fd7430 EFLAGS: 00010282
    [26620.095607] RAX: a56b6b6b6b6b6b6b RBX: ffff8881f46c3dc0 RCX: 0000000000000000
    [26620.095608] RDX: 0000000000000000 RSI: 0000000000000246 RDI: 00000000ffffffff
    [26620.095609] RBP: ffff888289610f00 R08: 0000000000000001 R09: ffff88823b022000
    [26620.095609] R10: ffff888103029b28 R11: ffff8881fc7f3800 R12: ffff88810b6150d0
    [26620.095609] R13: ffff888289610f00 R14: 0000000000000000 R15: ffff8881f46c3dc0
    [26620.095610] FS: 00007f1004d86900(0000) GS:ffff88901c858000(0000) knlGS:0000000000000000
    [26620.095611] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [26620.095611] CR2: 00007f0fdf489000 CR3: 000000035b0c1000 CR4: 0000000000750ef0
    [26620.095612] PKRU: 55555554
    [26620.095612] Call Trace:
    [26620.095615] <TASK>
    [26620.095615] i915_ttm_move+0x2b9/0x420 [i915]
    [26620.095642] ? ttm_tt_init+0x65/0x80 [ttm]
    [26620.095644] ? i915_ttm_tt_create+0xc6/0x150 [i915]
    [26620.095667] ttm_bo_handle_move_mem+0xb6/0x160 [ttm]
    [26620.095669] ttm_bo_evict+0x100/0x150 [ttm]
    [26620.095671] ? preempt_count_add+0x64/0xa0
    [26620.095673] ? _raw_spin_lock+0xe/0x30
    [26620.095675] ? _raw_spin_unlock+0xd/0x30
    [26620.095675] ? i915_gem_object_evictable+0xb7/0xd0 [i915]
    [26620.095704] ttm_bo_evict_cb+0x6e/0xd0 [ttm]
    [26620.095705] ttm_lru_walk_for_evict+0xa6/0x200 [ttm]
    [26620.095708] ttm_bo_alloc_resource+0x185/0x4f0 [ttm]
    [26620.095709] ? init_object+0x62/0xd0
    [26620.095712] ttm_bo_validate+0x7a/0x180 [ttm]
    [26620.095713] ? _raw_spin_unlock_irqrestore+0x16/0x30
    [26620.095714] __i915_ttm_get_pages+0xb0/0x170 [i915]
    [26620.095737] i915_ttm_get_pages+0x9f/0x150 [i915]
    [26620.095759] ? i915_gem_do_execbuffer+0xedc/0x2b40 [i915]
    [26620.095786] ? alloc_debug_processing+0xd0/0x100
    [26620.095787] ? _raw_spin_unlock_irqrestore+0x16/0x30
    [26620.095788] ? i915_vma_instance+0xa0/0x4e0 [i915]
    [26620.095822] __i915_gem_object_get_pages+0x2f/0x40 [i915]
    [26620.095848] i915_vma_pin_ww+0x706/0x980 [i915]
    [26620.095875] ? i915_gem_do_execbuffer+0xedc/0x2b40 [i915]
    [26620.095904] eb_validate_vmas+0x170/0xa00 [i915]
    [26620.095930] i915_gem_do_execbuffer+0x1201/0x2b40 [i915]
    [26620.095953] ? alloc_debug_processing+0xd0/0x100
    [26620.095954] ? _raw_spin_unlock_irqrestore+0x16/0x30
    [26620.095955] ? i915_gem_execbuffer2_ioctl+0xc9/0x240 [i915]
    [26620.095977] ? __wake_up_sync_key+0x32/0x50
    [26620.095979] ? i915_gem_execbuffer2_ioctl+0xc9/0x240 [i915]
    [26620.096001] ? __slab_alloc.isra.0+0x67/0xc0
    [26620.096003] i915_gem_execbuffer2_ioctl+0x11a/0x240 [i915]
    
    Results from decode_stacktrace.sh pointed to dereference of a file pointer
    field of a i915 TTM page vector container associated with an object being
    purged on eviction.  That path is taken when the object is marked as no
    longer needed.
    
    Code analysis revealed a possibility of the i915 TTM page vector container
    being replaced with a new instance inside a function that purges content
    of the object, should it be still busy.  That function is called,
    indirectly via a more general function that changes the object's placement
    and caching policy, before the problematic dereference, but still after
    a pointer to the container is captured, rendering the pointer no longer
    valid.
    
    Fix the issue by capturing the pointer to the container only after its
    potential replacement.
    
    v2: Move the container_of() inside the if block (Sebastian),
      - a simplified version of the commit description that explains briefly
        why the change is necessary (Christian).
    
    Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/work_items/14882
    Fixes: 7ae034590ceae ("drm/i915/ttm: add tt shmem backend")
    Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
    Cc: stable@vger.kernel.org # v5.17+
    Cc: Matthew Auld <matthew.auld@intel.com>
    Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
    Cc: Sebastian Brzezinka <sebastian.brzezinka@intel.com>
    Cc: Christian König <christian.koenig@amd.com>
    Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
    Reviewed-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
    Link: https://lore.kernel.org/r/20260508122612.469227-2-janusz.krzysztofik@linux.intel.com
    (cherry picked from commit 4462966a93eb185849b7f174f0d0de53476d00a4)
    Signed-off-by: Tvrtko Ursulin <tursulin@ursulin.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/v3d: Fix use-after-free of CPU job query arrays on error path [+ + +]
Author: Maíra Canal <mcanal@igalia.com>
Date:   Sun May 31 18:02:01 2026 -0300

    drm/v3d: Fix use-after-free of CPU job query arrays on error path
    
    [ Upstream commit b0fe80c0b9250b35e2211bf3117e7aca814a21b0 ]
    
    The CPU job ioctl's fail label calls kvfree() on cpu_job's timestamp and
    performance query arrays after v3d_job_cleanup(), which drops the job's
    last reference and frees cpu_job. Reading cpu_job at that point is a
    use-after-free. Also, on the early v3d_job_init() failure path, it is a
    NULL dereference, since v3d_job_deallocate() zeroes the local pointer.
    
    In the success path, the arrays are released from the scheduler's
    .free_job callback, but on the error path, they are freed manually, as
    the job was never pushed to the scheduler. While the success path deals
    with this correctly, the fail path doesn't.
    
    On top of that, the manual kvfree() calls only free the array storage;
    they don't drm_syncobj_put() the per-query syncobjs that
    v3d_timestamp_query_info_free() and v3d_performance_query_info_free()
    release on the success path. So the same fail path that triggers the
    use-after-free also leaks one syncobj reference per query.
    
    Unify the CPU job teardown into the CPU job's kref destructor, mirroring
    v3d_render_job_free(). The scheduler's .free_job slot reverts to the
    generic v3d_sched_job_free() and the fail label drops the manual
    kvfree() calls, leaving a single teardown path that is reached from both
    the scheduler and the ioctl error path. That removes the use-after-free,
    the NULL dereference, and the syncobj leak by construction.
    
    Cc: stable@vger.kernel.org
    Fixes: 9ba0ff3e083f ("drm/v3d: Create a CPU job extension for the timestamp query job")
    Assisted-by: Claude:claude-opus-4.7
    Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
    Link: https://patch.msgid.link/20260515-v3d-cpu-job-leaks-v1-1-7f147cbbf935@igalia.com
    Signed-off-by: Maíra Canal <mcanal@igalia.com>
    Signed-off-by: Maíra Canal <mcanal@igalia.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/v3d: Release indirect CSD GEM reference on CPU job free [+ + +]
Author: Maíra Canal <mcanal@igalia.com>
Date:   Sun May 31 18:02:02 2026 -0300

    drm/v3d: Release indirect CSD GEM reference on CPU job free
    
    [ Upstream commit 6eb6e5acafa46854d4363e6c34981289995f3ace ]
    
    v3d_get_cpu_indirect_csd_params() takes a reference to the indirect BO via
    drm_gem_object_lookup() and stashes it in cpu_job->indirect_csd.indirect,
    but nothing on the CPU job teardown path ever drops that reference.
    
    Drop the extra reference in v3d_cpu_job_free(). The NULL check covers ioctl
    errors before the lookup ran and CPU job types other than
    V3D_CPU_JOB_TYPE_INDIRECT_CSD, which leave the field zero-initialised.
    
    Cc: stable@vger.kernel.org
    Fixes: 18b8413b25b7 ("drm/v3d: Create a CPU job extension for a indirect CSD job")
    Assisted-by: Claude:claude-opus-4.7
    Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
    Link: https://patch.msgid.link/20260515-v3d-cpu-job-leaks-v1-2-7f147cbbf935@igalia.com
    Signed-off-by: Maíra Canal <mcanal@igalia.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ethtool: cmis: fix u16-to-u8 truncation of msleep_pre_rpl [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri May 22 16:13:10 2026 -0700

    ethtool: cmis: fix u16-to-u8 truncation of msleep_pre_rpl
    
    [ Upstream commit 3e8c3d464c36bb342fe377b026577c7ec27fdbb4 ]
    
    ethtool_cmis_cdb_compose_args() accepts msleep_pre_rpl as u16 but stores
    it into the u8 field ethtool_cmis_cdb_cmd_args::msleep_pre_rpl, silently
    truncating values >= 256. Seven of the nine call sites pass 1000 ms
    (it's the third argument from the end).
    
    Fixes: a39c84d79625 ("ethtool: cmis_cdb: Add a layer for supporting CDB commands")
    Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
    Reviewed-by: Danielle Ratson <danieller@nvidia.com>
    Link: https://patch.msgid.link/20260522231312.1710836-8-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ethtool: cmis: require exact CDB reply length [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri May 22 16:13:09 2026 -0700

    ethtool: cmis: require exact CDB reply length
    
    [ Upstream commit 6c3f999a9d1338c6c89a9ff4549eafe72bc2e7b1 ]
    
    Malicious SFP module could respond with rpl_len longer than
    what cmis_cdb_process_reply() expected, leading to OOB writes.
    Malicious HW is a bit theoretical but some modules may just
    be buggy and/or the reads may occasionally get corrupted,
    so let's protect the kernel.
    
    The existing check protects from short replies. We need to
    protect from long ones, too. All callers that pass a non-zero
    rpl_exp_len cast the reply payload to a fixed-layout struct
    and read fields at fixed offsets, with no version negotiation
    or short-reply handling:
    
      - cmis_cdb_validate_password()
      - cmis_cdb_module_features_get()
      - cmis_fw_update_fw_mng_features_get()
    
    so let's assume that responses longer than expected do not
    have to be handled gracefully here. Add a warning message
    to make the debug easier in case my understanding is wrong...
    
    Note that page_data->length (argument of kmalloc) comes from
    last arg to ethtool_cmis_page_init() which is rpl_exp_len.
    
    Note2 that AIs also like to point out overflows in args->req.payload
    itself (which is a fixed-size 120 B buffer, on the stack),
    but callers should be reading structs defined by the standard,
    so protecting from requests for more data than max seem like
    defensive programming.
    
    Fixes: a39c84d79625 ("ethtool: cmis_cdb: Add a layer for supporting CDB commands")
    Reviewed-by: Danielle Ratson <danieller@nvidia.com>
    Link: https://patch.msgid.link/20260522231312.1710836-7-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ethtool: cmis: validate fw->size against start_cmd_payload_size [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri May 22 16:13:12 2026 -0700

    ethtool: cmis: validate fw->size against start_cmd_payload_size
    
    [ Upstream commit d5551f4c1800dc714cec86647bdd651ae0de923e ]
    
    cmis_fw_update_start_download() copies start_cmd_payload_size bytes
    from the firmware blob into the CDB LPL vendor_data[] payload without
    validating that the FW has enough data.
    
    Since the start_cmd_payload_size can only be ~120B an image too short
    is most likely corrupted, so reject it.
    
    Fixes: c4f78134d45c ("ethtool: cmis_fw_update: add a layer for supporting firmware update using CDB")
    Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
    Reviewed-by: Danielle Ratson <danieller@nvidia.com>
    Link: https://patch.msgid.link/20260522231312.1710836-10-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ethtool: cmis: validate start_cmd_payload_size from module [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri May 22 16:13:11 2026 -0700

    ethtool: cmis: validate start_cmd_payload_size from module
    
    [ Upstream commit 12c2496a71f82f63617971ca9b730dffa05cf58b ]
    
    The CMIS firmware update code reads start_cmd_payload_size from
    the module's FW Management Features CDB reply and uses it directly
    as the byte count for memcpy. The destination buffer is 112 bytes
    (ETHTOOL_CMIS_CDB_LPL_MAX_PL_LENGTH - 8). So a malicious
    module (or corrupted response) can cause a OOB write later on in
    cmis_fw_update_start_download().
    
    Let's error out. If modules that expect longer LPL writes actually
    exist we should revisit.
    
    struct cmis_cdb_start_fw_download_pl's definition has to move,
    no change there.
    
    Fixes: c4f78134d45c ("ethtool: cmis_fw_update: add a layer for supporting firmware update using CDB")
    Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
    Reviewed-by: Danielle Ratson <danieller@nvidia.com>
    Link: https://patch.msgid.link/20260522231312.1710836-9-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ethtool: cmis_cdb: Fix incorrect read / write length extension [+ + +]
Author: Ido Schimmel <idosch@nvidia.com>
Date:   Wed Apr 9 14:24:40 2025 +0300

    ethtool: cmis_cdb: Fix incorrect read / write length extension
    
    commit eaa517b77e63442260640d875f824d1111ca6569 upstream.
    
    The 'read_write_len_ext' field in 'struct ethtool_cmis_cdb_cmd_args'
    stores the maximum number of bytes that can be read from or written to
    the Local Payload (LPL) page in a single multi-byte access.
    
    Cited commit started overwriting this field with the maximum number of
    bytes that can be read from or written to the Extended Payload (LPL)
    pages in a single multi-byte access. Transceiver modules that support
    auto paging can advertise a number larger than 255 which is problematic
    as 'read_write_len_ext' is a 'u8', resulting in the number getting
    truncated and firmware flashing failing [1].
    
    Fix by ignoring the maximum EPL access size as the kernel does not
    currently support auto paging (even if the transceiver module does) and
    will not try to read / write more than 128 bytes at once.
    
    [1]
    Transceiver module firmware flashing started for device enp177s0np0
    Transceiver module firmware flashing in progress for device enp177s0np0
    Progress: 0%
    Transceiver module firmware flashing encountered an error for device enp177s0np0
    Status message: Write FW block EPL command failed, LPL length is longer
            than CDB read write length extension allows.
    
    Fixes: 9a3b0d078bd8 ("net: ethtool: Add support for writing firmware blocks using EPL payload")
    Reported-by: Damodharam Ammepalli <damodharam.ammepalli@broadcom.com>
    Closes: https://lore.kernel.org/netdev/20250402183123.321036-3-michael.chan@broadcom.com/
    Tested-by: Damodharam Ammepalli <damodharam.ammepalli@broadcom.com>
    Signed-off-by: Ido Schimmel <idosch@nvidia.com>
    Reviewed-by: Damodharam Ammepalli <damodharam.ammepalli@broadcom.com>
    Reviewed-by: Petr Machata <petrm@nvidia.com>
    Link: https://patch.msgid.link/20250409112440.365672-1-idosch@nvidia.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ethtool: coalesce: cap profile updates at NET_DIM_PARAMS_NUM_PROFILES [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Tue May 26 08:35:24 2026 -0700

    ethtool: coalesce: cap profile updates at NET_DIM_PARAMS_NUM_PROFILES
    
    [ Upstream commit 7281b096b072f6c6e30420e3467d738f2e4c4b57 ]
    
    ethnl_update_profile() walks the ETHTOOL_A_PROFILE_IRQ_MODERATION
    nest list with an index 'i' and writes new_profile[i++] without
    bounding i. The destination is kmemdup()'d at NET_DIM_PARAMS_NUM_PROFILES
    entries (5), but the Netlink nest count is entirely user-controlled.
    Netlink policies do not have support for constraining the number
    of nested entries (or number of multi-attr entries).
    
    Fixes: f750dfe825b9 ("ethtool: provide customized dim profile management")
    Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
    Link: https://patch.msgid.link/20260526153533.2779187-2-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ethtool: eeprom: add missing ethnl_ops_begin() / _complete() during fallback [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Tue May 26 08:35:32 2026 -0700

    ethtool: eeprom: add missing ethnl_ops_begin() / _complete() during fallback
    
    [ Upstream commit 2376586f85f972fefe701f095bb37dcfe7405d21 ]
    
    All ethtool driver op calls should be sandwiched between
    ethnl_ops_begin() / ethnl_ops_complete(). In Netlink eeprom code,
    if the paged access failed we fall back to old API, but we
    first call _complete() and the fallback never does its own
    ethnl_ops_begin(). Move the fallback into the _begin() / _complete()
    section.
    
    Fixes: 96d971e307cc ("ethtool: Add fallback to get_module_eeprom from netlink command")
    Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
    Link: https://patch.msgid.link/20260526153533.2779187-10-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ethtool: eeprom: add more safeties to EEPROM Netlink fallback [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Tue May 26 08:35:33 2026 -0700

    ethtool: eeprom: add more safeties to EEPROM Netlink fallback
    
    [ Upstream commit 67cfdd9210b99f260b3e0afeb9525e0acc7be31e ]
    
    The Netlink fallback path for reading module EEPROM
    (fallback_set_params()) validates that offset < eeprom_len,
    but does not check that offset + length stays within eeprom_len.
    The ioctl equivalent (ethtool_get_any_eeprom() in ioctl.c) has
    always enforced both bounds:
    
      if (eeprom.offset + eeprom.len > total_len)
          return -EINVAL;
    
    This could lead to surprises in both drivers and device FW.
    Add the missing offset + length validation to fallback_set_params(),
    mirroring the ioctl.
    
    Similarly - ethtool core in general, and ethtool_get_any_eeprom()
    in particular tries to zero-init all buffers passed to the drivers
    to avoid any extra work of zeroing things out. eeprom_fallback()
    uses a plain kmalloc(), change it to zalloc.
    
    Fixes: 96d971e307cc ("ethtool: Add fallback to get_module_eeprom from netlink command")
    Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
    Link: https://patch.msgid.link/20260526153533.2779187-11-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ethtool: linkstate: fix unbalanced ethnl_ops_complete() on PHY lookup error [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Tue May 26 08:35:26 2026 -0700

    ethtool: linkstate: fix unbalanced ethnl_ops_complete() on PHY lookup error
    
    [ Upstream commit 596c51ed9e125b12c4d85b4530dfd4c7847634b7 ]
    
    linkstate_prepare_data() calls ethnl_req_get_phydev() before
    ethnl_ops_begin(), but routes its error path through "goto out"
    which calls ethnl_ops_complete().
    
    Fixes: fe55b1d401c6 ("ethtool: linkstate: migrate linkstate functions to support multi-PHY setups")
    Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
    Link: https://patch.msgid.link/20260526153533.2779187-4-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ethtool: module: avoid leaking a netdev ref on module flash errors [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri May 22 16:13:05 2026 -0700

    ethtool: module: avoid leaking a netdev ref on module flash errors
    
    [ Upstream commit fb7f511d62692661846c47f199e0afe25c2982db ]
    
    module_flash_fw_schedule() is missing undo for setting
    the "in_progress" flag and taking the netdev reference.
    Delay taking these, the device can't disappear while
    we are holding rtnl_lock.
    
    Fixes: 32b4c8b53ee7 ("ethtool: Add ability to flash transceiver modules' firmware")
    Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
    Reviewed-by: Danielle Ratson <danieller@nvidia.com>
    Link: https://patch.msgid.link/20260522231312.1710836-3-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ethtool: module: check fw_flash_in_progress under rtnl_lock [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri May 22 16:13:07 2026 -0700

    ethtool: module: check fw_flash_in_progress under rtnl_lock
    
    [ Upstream commit 504eaefa44c8dec50f7499edcb36d24f3aefab2a ]
    
    ethnl_set_module_validate() inspects module_fw_flash_in_progress
    but validate is meant for _input_ validation, not state validation.
    rtnl_lock is not held, yet. Move the check into ethnl_set_module().
    
    Fixes: 32b4c8b53ee7 ("ethtool: Add ability to flash transceiver modules' firmware")
    Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
    Reviewed-by: Danielle Ratson <danieller@nvidia.com>
    Link: https://patch.msgid.link/20260522231312.1710836-5-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ethtool: module: fix cleanup if socket used for flashing multiple devices [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri May 22 16:13:08 2026 -0700

    ethtool: module: fix cleanup if socket used for flashing multiple devices
    
    [ Upstream commit 760d04ebad5c4304f22c0d2251c9623b87a117c8 ]
    
    When a single Netlink socket issues MODULE_FW_FLASH_ACT against multiple
    devices, ethnl_sock_priv_set() overwrites sk_priv->dev on each call,
    retaining only the last one. The socket priv is used on socket close,
    to walk the global work list and mark the uncompleted flashing work
    as "orphaned". Otherwise if another socket reuses the PID it will
    unexpectedly receive the flashing notifications.
    
    Don't record the device, record net pointer instead. The purpose of
    the dev is to scope the work to a netns, anyway. If we store netns
    the overrides are safe/a nop since all flashed devices must be in
    the same netns as the socket.
    
    Fixes: 32b4c8b53ee7 ("ethtool: Add ability to flash transceiver modules' firmware")
    Reviewed-by: Danielle Ratson <danieller@nvidia.com>
    Link: https://patch.msgid.link/20260522231312.1710836-6-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ethtool: pse-pd: fix missing ethnl_ops_complete() [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Tue May 26 08:35:27 2026 -0700

    ethtool: pse-pd: fix missing ethnl_ops_complete()
    
    [ Upstream commit ab5bf428fb6bd361163c7247b92750d1d24ca2ed ]
    
    pse_prepare_data() is missing ethnl_ops_complete() if
    ethnl_req_get_phydev() returned an error. Move getting
    phydev up so that we don't have to worry about this
    (similar order to linkstate_prepare_data()).
    
    Note that phydev may still be NULL (this is checked in
    pse_get_pse_attributes()), the goal isn't really to avoid
    the _begin() / _complete() calls, only to simplify the error
    handling.
    
    While at it propagate the original error. Why this code
    overrides the error with -ENODEV but !phydev generates
    -EOPNOTSUPP is unclear to me...
    
    Fixes: 31748765bed3 ("net: ethtool: pse-pd: Target the command to the requested PHY")
    Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
    Link: https://patch.msgid.link/20260526153533.2779187-5-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ethtool: rss: fix hkey leak when indir_size is 0 [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri May 22 16:06:46 2026 -0700

    ethtool: rss: fix hkey leak when indir_size is 0
    
    [ Upstream commit 78ccf1a70c6378e1f5073a8c2209b5129067b925 ]
    
    rss_get_data_alloc() allocates a single buffer that backs both the
    indirection table and the hash key, but only assigned data->indir_table
    when indir_size was nonzero. The expectation was that no driver
    implements RSS without supporting indirection table but apparently
    enic does just that (it's the only such in-tree driver).
    enic has get_rxfh_key_size but no get_rxfh_indir_size.
    data->indir_table stays as NULL, hkey gets set but rss_get_data_free()
    kfree(data->indir_table) is a nop and the allocation leaks.
    
    Always store the allocation base in data->indir_table so the free path
    is unambiguous. No caller treats indir_table as a sentinel; everything
    keys off indir_size.
    
    Fixes: 7112a04664bf ("ethtool: add netlink based get rss support")
    Link: https://patch.msgid.link/20260522230647.1705600-6-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ethtool: strset: fix header attribute index in ethnl_req_get_phydev() [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Tue May 26 08:35:31 2026 -0700

    ethtool: strset: fix header attribute index in ethnl_req_get_phydev()
    
    [ Upstream commit a8d8bef6b45bf7cc0b1f6110c5cd8d0160a9bad7 ]
    
    strset_prepare_data() passes ETHTOOL_A_HEADER_FLAGS (3) as the header
    attribute to ethnl_req_get_phydev(). This is incorrect, in the main
    attr space 3 is ETHTOOL_A_STRSET_COUNTS_ONLY, not the request
    header attr. The correct constant is ETHTOOL_A_STRSET_HEADER (1).
    
    ethnl_req_get_phydev() only uses this value for the extack,
    so this is not a "functionally visible"(?) bug.
    
    Fixes: e96c93aa4be9 ("net: ethtool: strset: Allow querying phy stats by index")
    Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
    Link: https://patch.msgid.link/20260526153533.2779187-9-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
gpio: mxc: fix irq_high handling [+ + +]
Author: Alexander Stein <alexander.stein@ew.tq-group.com>
Date:   Tue May 26 08:35:01 2026 +0200

    gpio: mxc: fix irq_high handling
    
    [ Upstream commit dac917ed5aead741004db8d0d5151dd577802df8 ]
    
    If port->irq_high is -1 (fsl,imx21-gpio compatible) and gpio_idx is >= 16
    enable_irq_wake() is called with -1 which is wrong.
    
    Fixes: 5f6d1998adeb ("gpio: mxc: release the parent IRQ in runtime suspend")
    Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Link: https://patch.msgid.link/20260526063504.25916-1-alexander.stein@ew.tq-group.com
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

gpio: rockchip: convert bank->clk to devm_clk_get_enabled() [+ + +]
Author: Marco Scardovi <scardracs@disroot.org>
Date:   Tue May 26 19:02:45 2026 +0200

    gpio: rockchip: convert bank->clk to devm_clk_get_enabled()
    
    [ Upstream commit 3e46c18d5d87f063a93ae0fe7662fbf6660459d5 ]
    
    The bank->clk was previously obtained via of_clk_get() and manually
    prepared/enabled. However, it was missing a corresponding clk_put() in
    both the error paths and the remove function, leading to a reference leak.
    
    Convert the allocation to devm_clk_get_enabled(), which also properly
    propagates failures from clk_prepare_enable() that were previously ignored.
    
    The GPIO bank device uses the same OF node as the previous of_clk_get()
    call, so devm_clk_get_enabled(dev, NULL) correctly resolves the same
    clock provider entry.
    
    Fix the reference leak and simplify the code by removing the manual
    clk_disable_unprepare() calls in the probe error paths and in the
    remove function.
    
    Fixes: 936ee2675eee ("gpio/rockchip: add driver for rockchip gpio")
    Assisted-by: Antigravity:gemini-3.5-flash
    Signed-off-by: Marco Scardovi <scardracs@disroot.org>
    Link: https://patch.msgid.link/20260526171050.12785-2-scardracs@disroot.org
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

gpio: virtuser: Fix uninitialized data bug in gpio_virtuser_direction_do_write() [+ + +]
Author: Dan Carpenter <error27@gmail.com>
Date:   Mon May 25 10:15:16 2026 +0300

    gpio: virtuser: Fix uninitialized data bug in gpio_virtuser_direction_do_write()
    
    [ Upstream commit 8a122b5e72cc0043705f0d524bcd15f0c0b3ec15 ]
    
    If *ppos is non-zero (user-space write split over multiple calls to
    write()) then simple_write_to_buffer() won't initialize the start of the
    buffer. Really, non-zero values for *ppos aren't going to work at all.
    Check for that and return -EINVAL at the start of the function.
    
    Fixes: 91581c4b3f29 ("gpio: virtuser: new virtual testing driver for the GPIO API")
    Signed-off-by: Dan Carpenter <error27@gmail.com>
    Link: https://patch.msgid.link/ahP3BJWWy-m_qI0X@stanley.mountain
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
HID: core: Add printk_ratelimited variants to hid_warn() etc [+ + +]
Author: Vicki Pfau <vi@endrift.com>
Date:   Mon Jun 1 09:36:09 2026 +0100

    HID: core: Add printk_ratelimited variants to hid_warn() etc
    
    [ Upstream commit 1d64624243af8329b4b219d8c39e28ea448f9929 ]
    
    hid_warn_ratelimited() is needed. Add the others as part of the block.
    
    Signed-off-by: Vicki Pfau <vi@endrift.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Lee Jones <lee@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: core: Fix size_t specifier in hid_report_raw_event() [+ + +]
Author: Nathan Chancellor <nathan@kernel.org>
Date:   Mon Jun 1 09:36:12 2026 +0100

    HID: core: Fix size_t specifier in hid_report_raw_event()
    
    [ Upstream commit 4d3a2a466b8d68d852a1f3bbf11204b718428dc4 ]
    
    When building for 32-bit platforms, for which 'size_t' is
    'unsigned int', there are warnings around using the incorrect format
    specifier to print bsize in hid_report_raw_event():
    
      drivers/hid/hid-core.c:2054:29: error: format specifies type 'long' but the argument has type 'size_t' (aka 'unsigned int') [-Werror,-Wformat]
       2053 |                 hid_warn_ratelimited(hid, "Event data for report %d is incorrect (%d vs %ld)\n",
            |                                                                                         ~~~
            |                                                                                         %zu
       2054 |                                      report->id, csize, bsize);
            |                                                         ^~~~~
      drivers/hid/hid-core.c:2076:29: error: format specifies type 'long' but the argument has type 'size_t' (aka 'unsigned int') [-Werror,-Wformat]
       2075 |                 hid_warn_ratelimited(hid, "Event data for report %d was too short (%d vs %ld)\n",
            |                                                                                          ~~~
            |                                                                                          %zu
       2076 |                                      report->id, rsize, bsize);
            |                                                         ^~~~~
    
    Use the proper 'size_t' format specifier, '%zu', to clear up the
    warnings.
    
    Cc: stable@vger.kernel.org
    Fixes: 2c85c61d1332 ("HID: pass the buffer size to hid_report_raw_event")
    Reported-by: Miguel Ojeda <ojeda@kernel.org>
    Closes: https://lore.kernel.org/20260516020430.110135-1-ojeda@kernel.org/
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    (cherry picked from commit 3ab135238832446399614e7a4bb796d620717806)
    Signed-off-by: Lee Jones <lee@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: core: introduce hid_safe_input_report() [+ + +]
Author: Benjamin Tissoires <bentiss@kernel.org>
Date:   Mon Jun 1 09:36:11 2026 +0100

    HID: core: introduce hid_safe_input_report()
    
    [ Upstream commit 206342541fc887ae919774a43942dc883161fece ]
    
    hid_input_report() is used in too many places to have a commit that
    doesn't cross subsystem borders. Instead of changing the API, introduce
    a new one when things matters in the transport layers:
    - usbhid
    - i2chid
    
    This effectively revert to the old behavior for those two transport
    layers.
    
    Fixes: 0a3fe972a7cb ("HID: core: Mitigate potential OOB by removing bogus memset()")
    Cc: stable@vger.kernel.org
    Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    (cherry picked from commit 301338b8edadc67a42b1c86add975091e66768d9)
    Signed-off-by: Lee Jones <lee@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: pass the buffer size to hid_report_raw_event [+ + +]
Author: Benjamin Tissoires <bentiss@kernel.org>
Date:   Mon Jun 1 09:36:10 2026 +0100

    HID: pass the buffer size to hid_report_raw_event
    
    [ Upstream commit 2c85c61d1332e1e16f020d76951baf167dcb6f7a ]
    
    commit 0a3fe972a7cb ("HID: core: Mitigate potential OOB by removing
    bogus memset()") enforced the provided data to be at least the size of
    the declared buffer in the report descriptor to prevent a buffer
    overflow. However, we can try to be smarter by providing both the buffer
    size and the data size, meaning that hid_report_raw_event() can make
    better decision whether we should plaining reject the buffer (buffer
    overflow attempt) or if we can safely memset it to 0 and pass it to the
    rest of the stack.
    
    Fixes: 0a3fe972a7cb ("HID: core: Mitigate potential OOB by removing bogus memset()")
    Cc: stable@vger.kernel.org
    Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
    Acked-by: Johan Hovold <johan@kernel.org>
    Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Stable-dep-of: 206342541fc8 ("HID: core: introduce hid_safe_input_report()")
    (cherry picked from commit 509c2605065004fc4cd86ee50a9350d402785307)
    [Lee: Backported to linux-6.12.y and beyond]
    Signed-off-by: Lee Jones <lee@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

HID: quirks: Add ALWAYS_POLL quirk for SIGMACHIP USB mouse [+ + +]
Author: hlleng <a909204013@gmail.com>
Date:   Tue May 12 09:57:37 2026 +0800

    HID: quirks: Add ALWAYS_POLL quirk for SIGMACHIP USB mouse
    
    commit 07466fc91c55532edcfb5c6a7ccd2ea52728d6bd upstream.
    
    The SIGMACHIP USB mouse with VID/PID 1c4f:0034 can disconnect and
    re-enumerate repeatedly after it has been enumerated if its interrupt
    endpoint is not continuously polled.
    
    This was observed with the device reporting itself as "SIGMACHIP Usb
    Mouse". Keeping the input event device open avoids the disconnects.
    
    Add HID_QUIRK_ALWAYS_POLL for this device so the HID core keeps polling
    it even when there is no userspace input consumer.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: hlleng <a909204013@gmail.com>
    Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

HID: wacom: Fix OOB write in wacom_hid_set_device_mode() [+ + +]
Author: Lee Jones <lee@kernel.org>
Date:   Wed May 27 17:05:26 2026 +0100

    HID: wacom: Fix OOB write in wacom_hid_set_device_mode()
    
    commit c0a8899e02ddebd51e2589835182c239c2e224ae upstream.
    
    wacom_hid_set_device_mode() currently assumes that the HID_DG_INPUTMODE
    usage is always located in the first field (field[0]) of the feature report.
    However, a device can specify HID_DG_INPUTMODE in a different field.
    
    If HID_DG_INPUTMODE is in a field other than the first one and the first
    field has a report_count smaller than the usage_index of HID_DG_INPUTMODE,
    this leads to an out-of-bounds write to r->field[0]->value.
    
    Fix this by storing the field index of HID_DG_INPUTMODE in 'struct
    hid_data' during feature mapping.  In wacom_hid_set_device_mode(), use
    this stored field index to access the correct field and add bounds
    checks to ensure both the field index and the value index are within
    valid ranges before writing.
    
    Cc: stable@vger.kernel.org
    Fixes: 5ae6e89f7409 ("HID: wacom: implement the finger part of the HID generic handling")
    Tested-by: Ping Cheng <ping.cheng@wacom.com>
    Reviewed-by: Ping Cheng <ping.cheng@wacom.com>
    Signed-off-by: Lee Jones <lee@kernel.org>
    Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
hpfs: fix a crash if hpfs_map_dnode_bitmap fails [+ + +]
Author: Mikulas Patocka <mpatocka@redhat.com>
Date:   Mon May 25 14:48:58 2026 +0200

    hpfs: fix a crash if hpfs_map_dnode_bitmap fails
    
    commit 974820a59efde7c1a7e1260bcfe9bb81f833cc9f upstream.
    
    If hpfs_map_dnode_bitmap fails, the code would call hpfs_brelse4 on
    uninitialized quad buffer head, causing a crash.
    
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Reported-by: Farhad Alemi <farhad.alemi@berkeley.edu>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
hwmon: (pmbus/adm1266) serialize GPIO PMBus accesses with pmbus_lock [+ + +]
Author: Abdurrahman Hussain <abdurrahman@nexthop.ai>
Date:   Mon Jun 1 15:59:14 2026 -0400

    hwmon: (pmbus/adm1266) serialize GPIO PMBus accesses with pmbus_lock
    
    [ Upstream commit bab8c6fb5af8df7e753d196c1262cb78e92ca872 ]
    
    adm1266_gpio_get(), adm1266_gpio_get_multiple(), and
    adm1266_gpio_dbg_show() all issue PMBus reads against the device but
    none of them take pmbus_lock.  The pmbus_core framework holds
    pmbus_lock around its own multi-transaction sequences (notably the
    "set PAGE, then read paged register" pattern used by hwmon
    attributes), so an unlocked GPIO accessor can land between a PAGE
    write and the subsequent paged read in another thread and corrupt
    either side's view of the device state machine.
    
    Take pmbus_lock at the top of each of the three accessors via the
    scope-based guard().  The lock is uncontended in the common case and
    adds only a single mutex round-trip per call.
    
    Fixes: d98dfad35c38 ("hwmon: (pmbus/adm1266) Add support for GPIOs")
    Cc: stable@vger.kernel.org
    Signed-off-by: Abdurrahman Hussain <abdurrahman@nexthop.ai>
    Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
    Link: https://lore.kernel.org/r/20260518-adm1266-gpio-fixes-v3-6-e425e4f88139@nexthop.ai
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    [ open-coded each `guard(pmbus_lock)(data->client)` as explicit `pmbus_lock_interruptible()`/`pmbus_unlock()` ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

hwmon: (pmbus/adm1266) serialize NVMEM blackbox read with pmbus_lock [+ + +]
Author: Abdurrahman Hussain <abdurrahman@nexthop.ai>
Date:   Mon Jun 1 12:28:40 2026 -0400

    hwmon: (pmbus/adm1266) serialize NVMEM blackbox read with pmbus_lock
    
    [ Upstream commit 9f1dd8f9491eb840cbea7ffdf4cad031e25f8ae0 ]
    
    adm1266_nvmem_read() is the reg_read callback the NVMEM core invokes
    when userspace reads /sys/bus/nvmem/devices/.../nvmem on this chip.
    On the first byte of every read it does a memset of data->dev_mem,
    walks the device blackbox through adm1266_nvmem_read_blackbox()
    (which issues a chain of PMBus block transactions), and then memcpys
    the refreshed buffer out to userspace.  None of that runs under
    pmbus_lock today.
    
    Two consequences:
    
      - The PMBus traffic the refresh issues is not serialised against
        pmbus_core's own multi-step PAGE+register sequences.  A paged
        hwmon attribute read from another thread can land between a
        PAGE write and the paged read in either direction and corrupt
        one side's view of the device state machine.
    
      - The NVMEM core does not serialise concurrent reg_read calls, so
        two userspace readers racing at offset 0 can interleave the
        memset of data->dev_mem with another reader's
        adm1266_nvmem_read_blackbox() refill or memcpy out, returning
        torn data to userspace.
    
    Take pmbus_lock at the top of adm1266_nvmem_read() via the
    scope-based guard().  Patch 5 of this series moves
    adm1266_config_nvmem() past pmbus_do_probe() so the lock is
    guaranteed to be live before the callback is reachable from
    userspace.
    
    Fixes: 15609d189302 ("hwmon: (pmbus/adm1266) read blackbox")
    Cc: stable@vger.kernel.org
    Signed-off-by: Abdurrahman Hussain <abdurrahman@nexthop.ai>
    Link: https://lore.kernel.org/r/20260518-adm1266-gpio-fixes-v3-7-e425e4f88139@nexthop.ai
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    [ changed `guard(pmbus_lock)(data->client)` to explicit `pmbus_lock_interruptible()`/`pmbus_unlock()` ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

hwmon: (pmbus/adm1266) serialize sequencer_state debugfs read with pmbus_lock [+ + +]
Author: Abdurrahman Hussain <abdurrahman@nexthop.ai>
Date:   Mon Jun 1 10:46:51 2026 -0400

    hwmon: (pmbus/adm1266) serialize sequencer_state debugfs read with pmbus_lock
    
    [ Upstream commit 4e4af55aaca7f6d7673d5f9889ad0529db86a048 ]
    
    adm1266_state_read() backs the sequencer_state debugfs entry and
    issues an i2c_smbus_read_word_data(client, ADM1266_READ_STATE)
    against the device without taking pmbus_lock.  pmbus_core holds
    pmbus_lock around its own multi-transaction sequences (notably the
    "set PAGE, then read paged register" pattern used by hwmon
    attributes), so an unlocked debugfs reader can land between a PAGE
    write and the subsequent paged read in another thread.  READ_STATE
    itself is not paged, so it cannot corrupt PAGE in flight, but the
    same defensive serialisation that applies to the GPIO accessors
    applies here: any direct device access from outside pmbus_core
    should be ordered with respect to pmbus_core's own.
    
    Take pmbus_lock at the top of adm1266_state_read() via the
    scope-based guard().
    
    Fixes: ed1ff457e187 ("hwmon: (pmbus/adm1266) add debugfs for states")
    Cc: stable@vger.kernel.org
    Signed-off-by: Abdurrahman Hussain <abdurrahman@nexthop.ai>
    Link: https://lore.kernel.org/r/20260518-adm1266-gpio-fixes-v3-8-e425e4f88139@nexthop.ai
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    [ replaced `guard(pmbus_lock)(client)` with manual `pmbus_lock_interruptible()`/`pmbus_unlock()` ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ice: fix VF queue configuration with low MTU values [+ + +]
Author: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
Date:   Fri May 29 21:17:49 2026 -0400

    ice: fix VF queue configuration with low MTU values
    
    [ Upstream commit 3ba4dd024d26372733d1c02e13e076c6016e3320 ]
    
    The ice driver's VF queue configuration validation rejects
    databuffer_size values below 1024 bytes, which prevents VFs from
    using MTU values below 871 bytes.
    
    The iavf driver calculates databuffer_size based on the MTU using:
      databuffer_size = ALIGN(MTU + LIBETH_RX_LL_LEN, 128)
    
    where LIBETH_RX_LL_LEN = 26 (ETH_HLEN + 2*VLAN_HLEN + ETH_FCS_LEN).
    
    For MTU values below 871:
      MTU 870: 870 + 26 = 896, aligned to 128 = 896 (< 1024, rejected)
      MTU 871: 871 + 26 = 897, aligned to 128 = 1024 (>= 1024, accepted)
    
    The 1024-byte minimum seems unnecessarily restrictive, because the hardware
    supports databuffer_size as low as 128 bytes (the alignment boundary),
    which should allow MTU values down to the standard minimum of 68 bytes.
    
    I haven't found the reason why the limit was configured in the commit
    9c7dd7566d18 ("ice: add validation in OP_CONFIG_VSI_QUEUES VF message"), so
    with no more information and since it is working, change the minimum
    databuffer_size validation from 1024 to 128 bytes to allow standard low
    MTU values while still preventing invalid configurations.
    
    Fixes: 9c7dd7566d18 ("ice: add validation in OP_CONFIG_VSI_QUEUES VF message")
    cc: stable@vger.kernel.org
    Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
    Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
    Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
    Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
    Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Link: https://patch.msgid.link/20260515182419.1597859-3-anthony.l.nguyen@intel.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    [ applied the change to ice_virtchnl.c ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
iio: adc: mt6359: fix unchecked return value in mt6358_read_imp [+ + +]
Author: Salah Triki <salah.triki@gmail.com>
Date:   Mon Apr 27 21:12:38 2026 +0100

    iio: adc: mt6359: fix unchecked return value in mt6358_read_imp
    
    commit f9bbd943c34a9ad60e593a4b99ce2394e4e2381b upstream.
    
    In mt6358_read_imp(), the variable val_v is passed to regmap_read()
    but the return value is not checked. If the read fails, val_v remains
    uninitialized and its random stack content is subsequently reported
    as a measurement result.
    
    Initialize val_v to zero to ensure a predictable value is reported
    in case of bus failure and to prevent potential stack data leakage.
    This also satisfies static analyzers that might otherwise flag the
    variable as used uninitialized.
    
    Fixes: 3587914bf61d ("iio: adc: Add support for MediaTek MT6357/8/9 Auxiliary ADC")
    Signed-off-by: Salah Triki <salah.triki@gmail.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: adc: npcm: fix unbalanced clk_disable_unprepare() [+ + +]
Author: David Carlier <devnexen@gmail.com>
Date:   Tue Apr 14 13:30:06 2026 +0100

    iio: adc: npcm: fix unbalanced clk_disable_unprepare()
    
    commit 0d42e2c0bd6ceb89e44c6e065f9bdf9b1df3ef0c upstream.
    
    The driver acquired the ADC clock with devm_clk_get() and read its
    rate, but never called clk_prepare_enable(). The probe error path and
    npcm_adc_remove() both called clk_disable_unprepare() unconditionally,
    causing the clk framework's enable/prepare counts to underflow on
    probe failure or module unbind.
    
    The issue went unnoticed because NPCM BMC firmware leaves the ADC
    clock enabled at boot, so the driver happened to work in practice.
    
    Switch to devm_clk_get_enabled() so the clock is properly enabled
    during probe and automatically released by the device-managed
    cleanup, and drop the now-redundant clk_disable_unprepare() from
    both the probe error path and remove().
    
    While at it, drop the duplicate error message on devm_request_irq()
    failure since the IRQ core already logs it.
    
    Fixes: 9bf85fbc9d8f ("iio: adc: add NPCM ADC driver")
    Signed-off-by: David Carlier <devnexen@gmail.com>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: adc: viperboard: Fix error handling in vprbrd_iio_read_raw [+ + +]
Author: Salah Triki <salah.triki@gmail.com>
Date:   Thu May 7 20:07:51 2026 +0100

    iio: adc: viperboard: Fix error handling in vprbrd_iio_read_raw
    
    commit 422b5bbf333f75fb486855ad0eedc23cf21f3277 upstream.
    
    The driver proceeds to the reception phase even if the preceding
    transmission fails.
    
    This uses a goto error label for an early bail out and ensures the mutex is
    properly unlocked in case of failure.
    
    Fixes: ffd8a6e7a778 ("iio: adc: Add viperboard adc driver")
    Signed-off-by: Salah Triki <salah.triki@gmail.com>
    Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
    Reviewed-by: Maxwell Doose <m32285159@gmail.com>
    Reviewed-by: Nuno Sá <nuno.sa@analog.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: adc: xilinx-xadc: Fix sequencer mode in postdisable for dual mux [+ + +]
Author: Christofer Jonason <christofer.jonason@guidelinegeo.com>
Date:   Wed Mar 4 10:07:27 2026 +0100

    iio: adc: xilinx-xadc: Fix sequencer mode in postdisable for dual mux
    
    commit 852534744c2d35626a604f128ff0b8ec12805591 upstream.
    
    xadc_postdisable() unconditionally sets the sequencer to continuous
    mode. For dual external multiplexer configurations this is incorrect:
    simultaneous sampling mode is required so that ADC-A samples through
    the mux on VAUX[0-7] while ADC-B simultaneously samples through the
    mux on VAUX[8-15]. In continuous mode only ADC-A is active, so
    VAUX[8-15] channels return incorrect data.
    
    Since postdisable is also called from xadc_probe() to set the initial
    idle state, the wrong sequencer mode is active from the moment the
    driver loads.
    
    The preenable path already uses xadc_get_seq_mode() which returns
    SIMULTANEOUS for dual mux. Fix postdisable to do the same.
    
    Fixes: bdc8cda1d010 ("iio:adc: Add Xilinx XADC driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Christofer Jonason <christofer.jonason@guidelinegeo.com>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
    Reviewed-by: Nuno Sá <nuno.sa@analog.com>
    Reviewed-by: Salih Erim <salih.erim@amd.com>
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: buffer: Fix DMA fence leak in iio_buffer_enqueue_dmabuf() [+ + +]
Author: Benoît Monin <benoit.monin@bootlin.com>
Date:   Wed Apr 1 17:24:58 2026 +0200

    iio: buffer: Fix DMA fence leak in iio_buffer_enqueue_dmabuf()
    
    commit a093999355084bdbfe6e97f1dd232e58a1525f0b upstream.
    
    iio_buffer_enqueue_dmabuf() allocates a struct iio_dma_fence (104 bytes,
    kmalloc-128) via kmalloc_obj()+dma_fence_init(), which sets the initial
    kref to 1.  It then calls dma_resv_add_fence() which takes a second
    reference (kref=2), and stores a raw pointer in block->fence.
    
    On the success path the function returns without calling dma_fence_put()
    to release the initial reference, so every buffer enqueue permanently
    leaks one kmalloc-128 allocation.
    
    The iio_buffer_cleanup() work item only releases the temporary reference
    taken during completion signalling by iio_buffer_signal_dmabuf_done();
    the initial reference from dma_fence_init() is never released.
    
    With four iio_rwdev instances at 240kHz and 512 samples per buffer,
    this produces ~1875 kmalloc-128 allocations per second matching the
    observed slab growth exactly. A test with ftrace confirmed that the
    dma_fence_destroy event was never triggered.
    
    Fix by calling dma_fence_put() after dma_resv_add_fence(), transferring
    ownership of the fence to the DMA reservation object. The DMA fence then
    gets properly discarded after being signalled.
    
    Fixes: 3e26d9f08fbe0 ("iio: core: Add new DMABUF interface infrastructure")
    Originally-by: James Nuss <jamesnuss@nanometrics.ca>
    Signed-off-by: Benoît Monin <benoit.monin@bootlin.com>
    Reviewed-by: Paul Cercueil <paul@crapouillou.net>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: buffer: hw-consumer: fix use-after-free in error path [+ + +]
Author: Felix Gu <ustc.gu@gmail.com>
Date:   Thu Apr 30 21:29:06 2026 +0800

    iio: buffer: hw-consumer: fix use-after-free in error path
    
    commit 6f5ed4f2c7c83f33344e0ba179f72a12e5dad4a4 upstream.
    
    In the err_put_buffers cleanup path of iio_hw_consumer_alloc(), the code
    was using list_for_each_entry() to iterate through buffers while calling
    iio_buffer_put() which can free the current buffer if refcount drops to 0.
    The list_for_each_entry() loop macro then evaluates buf->head.next to
    continue iteration, accessing the freed buffer.
    
    Fix this by using list_for_each_entry_safe().
    
    Fixes: 48b66f8f936f ("iio: Add hardware consumer buffer support")
    Reported-by: sashiko <sashiko-bot@kernel.org>
    Closes: https://sashiko.dev/#/patchset/20260427-iio_buf-v1-1-2bbdac844647%40gmail.com
    Signed-off-by: Felix Gu <ustc.gu@gmail.com>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
    Reviewed-by: Nuno Sá <nuno.sa@analog.com>
    Reviewed-by: Maxwell Doose <m32285159@gmail.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: chemical: scd30: fix division by zero in write_raw [+ + +]
Author: Antoniu Miclaus <antoniu.miclaus@analog.com>
Date:   Thu Jun 4 13:38:04 2026 -0400

    iio: chemical: scd30: fix division by zero in write_raw
    
    [ Upstream commit 5aba4f94b225617a55fed442a70329b2ee19c0a5 ]
    
    Add a zero check for val2 before using it as a divisor when setting the
    sampling frequency. A user writing a zero fractional part to the
    sampling_frequency sysfs attribute triggers a division by zero in the
    kernel.
    
    Fixes: 64b3d8b1b0f5 ("iio: chemical: scd30: add core driver")
    Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: chemical: scd30: Use guard(mutex) to allow early returns [+ + +]
Author: Jonathan Cameron <jic23@kernel.org>
Date:   Thu Jun 4 13:38:03 2026 -0400

    iio: chemical: scd30: Use guard(mutex) to allow early returns
    
    [ Upstream commit 5feb5532870fbced5d6f450b8061a33f461b88ca ]
    
    Auto cleanup based release of the lock allows for simpler code flow in a
    few functions with large multiplexing style switch statements and no
    common operations following the switch.
    
    Suggested-by: David Lechner <dlechner@baylibre.com>
    Cc: Tomasz Duszynski <tomasz.duszynski@octakon.com>
    Reviewed-by: David Lechner <dlechner@baylibre.com>
    Link: https://patch.msgid.link/20250209180624.701140-3-jic23@kernel.org
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Stable-dep-of: 5aba4f94b225 ("iio: chemical: scd30: fix division by zero in write_raw")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: dac: ad5686: acquire lock when doing powerdown control [+ + +]
Author: Rodrigo Alencar <rodrigo.alencar@analog.com>
Date:   Tue May 5 13:35:04 2026 +0100

    iio: dac: ad5686: acquire lock when doing powerdown control
    
    commit 5237c3175cae5ab05f18878cec3301a04403859e upstream.
    
    Protect access of pwr_down_mode and pwr_down_mask fields with existing
    mutex lock. Each channel exposes their own attributes for controlling
    powerdown modes and powerdown state. This fixes potential race conditions
    as those the write functions perform non-atomic read-modify-write
    operations to those pwr_down_* fields. This issue exists since the ad5686
    driver was first introduced.
    
    Fixes: c2f37c8dcadc ("iio: dac: New driver for AD5686R, AD5685R, AD5684R Digital to analog converters")
    Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: dac: ad5686: fix input raw value check [+ + +]
Author: Rodrigo Alencar <rodrigo.alencar@analog.com>
Date:   Fri May 1 10:14:55 2026 +0100

    iio: dac: ad5686: fix input raw value check
    
    commit d01220ee5e43c65a206df827b39bf5cf5f7b9dce upstream.
    
    Fix range check for input raw value, which is off by one, i.e., for a
    10-bit DAC the max valid value is 1023, but 1 << 10 equals 1024, which
    passes the previous check, allowing an out-of-range write. The issue
    exists since the ad5686 driver was first introduced.
    
    Fixes: c2f37c8dcadc ("iio: dac: New driver for AD5686R, AD5685R, AD5684R Digital to analog converters")
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
    Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: dac: ad5686: fix ref bit initialization for single-channel parts [+ + +]
Author: Rodrigo Alencar <rodrigo.alencar@analog.com>
Date:   Thu Jun 4 19:49:27 2026 -0400

    iio: dac: ad5686: fix ref bit initialization for single-channel parts
    
    [ Upstream commit ecae2ae606d493cf11457946436335bd0e726663 ]
    
    The reference bit position was ignored when writing the register at the
    probe() function (!!val was used). When such bit is 1, internal voltage
    reference is disabled so that an external one can be used. For
    multi-channel devices, bit 0 of the Internal Reference Setup command
    behaves the same way, so AD5686_REF_BIT_MSK is created. The issue exists
    since support for single-channel devices were first introduced.
    
    Fixes: be1b24d24541 ("iio:dac:ad5686: Add AD5691R/AD5692R/AD5693/AD5693R support")
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
    Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    [ adapted `has_external_vref` to the in-tree equivalent `voltage_uv` variable in the `val =` computation ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: dac: max5821: fix return value check in powerdown sync [+ + +]
Author: Salah Triki <salah.triki@gmail.com>
Date:   Mon Apr 27 22:33:19 2026 +0100

    iio: dac: max5821: fix return value check in powerdown sync
    
    commit d0a228d903425e653f18a4341e60c0538afb6d41 upstream.
    
    The function max5821_sync_powerdown_mode() returned the result of
    i2c_master_send() directly. If a partial transfer occurred, it would
    be incorrectly treated as a success by the caller.
    
    While the caller currently handles the positive return value of 2 as
    success, this patch refactors the function to return 0 on full success
    and -EIO on short writes. This ensures robust error handling for
    incomplete transfers and improves code maintainability by using
    sizeof(outbuf).
    
    Fixes: 472988972737 ("iio: add support of the max5821")
    Signed-off-by: Salah Triki <salah.triki@gmail.com>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: gyro: adis16260: fix division by zero in write_raw [+ + +]
Author: Antoniu Miclaus <antoniu.miclaus@analog.com>
Date:   Tue Mar 31 13:13:00 2026 +0300

    iio: gyro: adis16260: fix division by zero in write_raw
    
    commit 761e8b489e6cf166c574034b70637f8a7eadd0ee upstream.
    
    Add a validation check for the sampling frequency value before using it
    as a divisor. A user writing zero to the sampling_frequency sysfs
    attribute triggers a division by zero in the kernel.
    
    Fixes: 089a41985c6c ("staging: iio: adis16260 digital gyro driver")
    Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
    Reviewed-by: Nuno Sá <nuno.sa@analog.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: gyro: itg3200: fix i2c read into the wrong stack location [+ + +]
Author: David Carlier <devnexen@gmail.com>
Date:   Tue May 5 14:37:48 2026 +0100

    iio: gyro: itg3200: fix i2c read into the wrong stack location
    
    commit 6bdc3023d62ed5c7d591f0eb27a5adb37fb892ae upstream.
    
    itg3200_read_all_channels() takes `__be16 *buf' as a parameter and
    fills the i2c_msg destination as `(char *)&buf'. Since `buf' is the
    parameter (a pointer), `&buf' is the address of the local pointer
    slot on the stack of itg3200_read_all_channels(), not the address
    of the caller's scan buffer. The (char *) cast hides the type
    mismatch.
    
    i2c_transfer() therefore writes ITG3200_SCAN_ELEMENTS * sizeof(s16)
    = 8 bytes into the parameter's stack slot, which is discarded when
    the function returns. The caller's scan buffer in
    itg3200_trigger_handler() is never written to, so
    iio_push_to_buffers_with_timestamp() pushes uninitialised stack
    contents to userspace via /dev/iio:deviceX every scan -- both a
    functional bug (no actual gyroscope or temperature data is
    delivered through the triggered buffer) and an information leak.
    
    The non-buffered read_raw() path is unaffected: it goes through
    itg3200_read_reg_s16() which uses `&out' on a local s16 value,
    where that is correct.
    
    Drop the spurious `&' so the i2c read writes into the caller's
    buffer.
    
    Fixes: 9dbf091da080 ("iio: gyro: Add itg3200")
    Cc: stable@vger.kernel.org
    Signed-off-by: David Carlier <devnexen@gmail.com>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: imu: st_lsm6dsx: fix stack leak in tagged FIFO buffer [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Thu Apr 9 15:40:48 2026 +0200

    iio: imu: st_lsm6dsx: fix stack leak in tagged FIFO buffer
    
    commit c9d8e9adaa63150ef7e833480b799d0bab83a276 upstream.
    
    The tagged FIFO path declares iio_buff on the stack with __aligned(8)
    but no initializer, but there is a hole in the structure, which will
    then leak to userspace as ST_LSM6DSX_SAMPLE_SIZE bytes (6) will be
    copied, but the space between that and the timestamp are not
    initialized.
    
    Commit c14edb4d0bdc ("iio:imu:st_lsm6dsx Fix alignment and data leak
    issues") moved the untagged FIFO path to a kzalloc'd buffer in hw->scan,
    but for the tagged path it only added the alignment qualifier and not
    the initializer :(
    
    Fix this by just zero-initializing the structure on the stack.
    
    Cc: Lorenzo Bianconi <lorenzo@kernel.org>
    Cc: Jonathan Cameron <jic23@kernel.org>
    Cc: David Lechner <dlechner@baylibre.com>
    Cc: "Nuno Sá" <nuno.sa@analog.com>
    Cc: Andy Shevchenko <andy@kernel.org>
    Fixes: c14edb4d0bdc ("iio:imu:st_lsm6dsx Fix alignment and data leak issues")
    Cc: stable <stable@kernel.org>
    Assisted-by: gregkh_clanker_t1000
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Reviewed-by: David Lechner <dlechner@baylibre.com>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: light: cm3323: fix reg_conf not being initialized correctly [+ + +]
Author: Aldo Conte <aldocontelk@gmail.com>
Date:   Tue Apr 7 17:17:01 2026 +0200

    iio: light: cm3323: fix reg_conf not being initialized correctly
    
    commit 1f4f0bcc5255dec5c4c3a1551bf49d8c33b69b20 upstream.
    
    The code stores the return value of i2c_smbus_write_word_data()
    in data->reg_conf; however, this value represents the result
    of the write operation and not the value actually written to
    the configuration register. This meant that the contents of
    data->reg_conf did not truly reflect the contents
    of the hardware register.
    
    Instead, save the value of the register before the write
    and use this value in the I2C write.
    
    The bug was found by code inspection: i2c_smbus_write_word_data()
    returns 0 on success, not the value written to the register.
    
    Tested using i2c-stub on a Raspberry Pi 3B running a custom 6.19.10
    kernel. Before loading the driver, the configuration register 0x00
    CM3323_CMD_CONF was populated with 0x0030 using
    `i2cset -y 11 0x10 0x00 0x0030 w`, encoding an integration time of 320ms
    in bits[6:4].
    
    Due to incorrect initialization of data->reg_conf in
    cm3323_init(), the print of integration_time returns 0.040000
    instead of the expected 0.320000. This happens because the read of the
    integration_time depends on cm3323_get_it_bits() that is based on the
    value of data->reg_conf, which is erroneously set to 0.
    
    With this fix applied, data->reg_conf correctly saves 0x0030 after init
    and the successive integration_time reports 0.320000 as expected.
    
    Fixes: 8b0544263761 ("iio: light: Add support for Capella CM3323 color sensor")
    Cc: stable@vger.kernel.org
    Signed-off-by: Aldo Conte <aldocontelk@gmail.com>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: magnetometer: st_magn: fix default DRDY pin selection for LIS2MDL [+ + +]
Author: Advait Dhamorikar <advaitd@mechasystems.com>
Date:   Tue Apr 7 12:50:59 2026 +0530

    iio: magnetometer: st_magn: fix default DRDY pin selection for LIS2MDL
    
    commit 49f79cd28f1e3333cbe0d616ce59ead0b24bf34e upstream.
    
    The device tree binding for st,lis2mdl does not support
    st,drdy-int-pin property. However, when no platform data is provided
    and the property is absent, the driver falls back to default_magn_pdata
    which hardcodes drdy_int_pin = 2. This causes
    `st_sensors_set_drdy_int_pin` to fail with -EINVAL because the LIS2MDL
    sensor settings have no INT2 DRDY mask defined.
    
    Fix this by checking the sensor's INT2 DRDY mask availability at
    probe time and selecting the appropriate default pin. Sensors that
    do not support INT2 DRDY will default to INT1, while all others
    retain the existing default of INT2.
    
    Fixes: 38934daf7b5c ("iio: magnetometer: st_magn: Provide default platform data")
    Signed-off-by: Advait Dhamorikar <advaitd@mechasystems.com>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: ssp_sensors: cancel delayed work_refresh on remove [+ + +]
Author: Sanjay Chitroda <sanjayembeddedse@gmail.com>
Date:   Sun Apr 26 14:47:04 2026 +0530

    iio: ssp_sensors: cancel delayed work_refresh on remove
    
    commit eedf7602fbd929e97e0c480da501dc7a34beb2a8 upstream.
    
    The work_refresh may still be pending or running when the device is
    removed, cancel the delayed work_refresh in remove path.
    
    Fixes: 50dd64d57eee ("iio: common: ssp_sensors: Add sensorhub driver")
    Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: temperature: tsys01: fix broken PROM checksum validation [+ + +]
Author: Salah Triki <salah.triki@gmail.com>
Date:   Tue May 5 08:10:24 2026 +0100

    iio: temperature: tsys01: fix broken PROM checksum validation
    
    commit 4701e471c16866e7aa8f5e6a3a6b0d31e097e2c9 upstream.
    
    The current implementation of tsys01_crc_valid() incorrectly sums the
    first word (n_prom[0]) repeatedly instead of iterating over the 8 words
    retrieved from the PROM. This leads to a checksum mismatch and probe
    failure on hardware.
    
    According to the TSYS01 datasheet, the PROM consists of 8 words. A valid
    check must iterate through all 8 words to verify the integrity of the
    calibration data. The current driver only checks the first word 8 times.
    
    Note: This fix was identified during a code audit and is based on
    datasheet specifications. It has not been tested on real hardware.
    
    Fixes: 43e53407f680 ("Add tsys01 meas-spec driver support")
    Signed-off-by: Salah Triki <salah.triki@gmail.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
inet: frags: add inet_frag_queue_flush() [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri May 29 17:29:51 2026 +0800

    inet: frags: add inet_frag_queue_flush()
    
    [ Upstream commit 1231eec6994be29d6bb5c303dfa54731ed9fc0e6 ]
    
    Instead of exporting inet_frag_rbtree_purge() which requires that
    caller takes care of memory accounting, add a new helper. We will
    need to call it from a few places in the next patch.
    
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Link: https://patch.msgid.link/20251207010942.1672972-3-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Rajani Kantha <681739313@139.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

inet: frags: flush pending skbs in fqdir_pre_exit() [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri May 29 17:29:52 2026 +0800

    inet: frags: flush pending skbs in fqdir_pre_exit()
    
    [ Upstream commit 006a5035b495dec008805df249f92c22c89c3d2e ]
    
    We have been seeing occasional deadlocks on pernet_ops_rwsem since
    September in NIPA. The stuck task was usually modprobe (often loading
    a driver like ipvlan), trying to take the lock as a Writer.
    lockdep does not track readers for rwsems so the read wasn't obvious
    from the reports.
    
    On closer inspection the Reader holding the lock was conntrack looping
    forever in nf_conntrack_cleanup_net_list(). Based on past experience
    with occasional NIPA crashes I looked thru the tests which run before
    the crash and noticed that the crash follows ip_defrag.sh. An immediate
    red flag. Scouring thru (de)fragmentation queues reveals skbs sitting
    around, holding conntrack references.
    
    The problem is that since conntrack depends on nf_defrag_ipv6,
    nf_defrag_ipv6 will load first. Since nf_defrag_ipv6 loads first its
    netns exit hooks run _after_ conntrack's netns exit hook.
    
    Flush all fragment queue SKBs during fqdir_pre_exit() to release
    conntrack references before conntrack cleanup runs. Also flush
    the queues in timer expiry handlers when they discover fqdir->dead
    is set, in case packet sneaks in while we're running the pre_exit
    flush.
    
    The commit under Fixes is not exactly the culprit, but I think
    previously the timer firing would eventually unblock the spinning
    conntrack.
    
    Fixes: d5dd88794a13 ("inet: fix various use-after-free in defrags units")
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Link: https://patch.msgid.link/20251207010942.1672972-4-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Rajani Kantha <681739313@139.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
Input: atmel_mxt_ts - fix boundary check in mxt_prepare_cfg_mem [+ + +]
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date:   Mon May 4 11:54:45 2026 -0700

    Input: atmel_mxt_ts - fix boundary check in mxt_prepare_cfg_mem
    
    commit baa0210fb6a9dc3882509a9411b6d284d88fe30e upstream.
    
    When a configuration file provides an object size that is larger than the
    driver's known mxt_obj_size(object), the driver intends to discard the
    extra bytes.
    
    The loop iterates using for (i = 0; i < size; i++). Inside the loop, the
    condition to skip processing extra bytes is:
    
        if (i > mxt_obj_size(object))
            continue;
    
    Since i is a 0-based index, the valid indices for the object are 0 through
    mxt_obj_size(object) - 1.
    
    When i == mxt_obj_size(object), the condition evaluates to false, and the
    code processes the byte instead of discarding it.
    
    This causes the code to calculate byte_offset = reg + i - cfg->start_ofs
    and writes the byte there, overwriting exactly one byte of the adjacent
    instance or object.
    
    Update the boundary check to skip extra bytes correctly by using >=.
    
    Fixes: 50a77c658b80 ("Input: atmel_mxt_ts - download device config using firmware loader")
    Cc: stable@vger.kernel.org
    Assisted-by: Gemini:gemini-3.1-pro
    Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
    Link: https://patch.msgid.link/20260504185448.4055973-1-dmitry.torokhov@gmail.com
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Input: elan_i2c - validate firmware size before use [+ + +]
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date:   Sat Apr 25 22:07:06 2026 -0700

    Input: elan_i2c - validate firmware size before use
    
    commit 76b0d0baa9ae9c60e726bbe1b6ff0bec2c993634 upstream.
    
    Ensure that the firmware file is large enough to contain the expected
    number of pages and the signature (which resides at the end of the
    firmware blob) before accessing them to prevent potential out-of-bounds
    reads.
    
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/ae2dOgiFvXRm4BHo@google.com
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Input: ims-pcu - fix usb_free_coherent() size in ims_pcu_buffers_free() [+ + +]
Author: Thomas Fourier <fourier.thomas@gmail.com>
Date:   Fri May 22 10:54:04 2026 +0200

    Input: ims-pcu - fix usb_free_coherent() size in ims_pcu_buffers_free()
    
    commit dab48a7e74e6a394f3aa0461a2b1fb0c7b38fcb8 upstream.
    
    The input buffer size is pcu->max_in_size, but pcu->max_out_size is
    passed to usb_free_coherent().
    
    Change size to match the allocation size.
    
    Fixes: 628329d52474 ("Input: add IMS Passenger Control Unit driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
    Link: https://patch.msgid.link/20260522085412.45430-2-fourier.thomas@gmail.com
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Input: synaptics - add LEN2058 to SMBus passlist for ThinkPad E490 [+ + +]
Author: Nicolás Bazaes <contacto@bazaes.cl>
Date:   Wed May 13 21:35:49 2026 -0400

    Input: synaptics - add LEN2058 to SMBus passlist for ThinkPad E490
    
    commit 16ca52bc209fa4bf9239cd9e5643e95533476b58 upstream.
    
    The Lenovo ThinkPad E490 (PNP ID: LEN2058) has a Synaptics TM3471-020
    touchpad that supports SMBus/RMI4 mode but is not listed in
    smbus_pnp_ids[]. Without this entry, RMI4 over SMBus is not enabled
    by default, and the touchpad falls back to PS/2 mode.
    
    Adding LEN2058 to the passlist enables automatic RMI4 detection without
    requiring the psmouse.synaptics_intertouch parameter, and matches
    the behavior of similar ThinkPad models already in the list
    (E480/LEN2054, E580/LEN2055).
    
    Tested on ThinkPad E490 with kernel 7.0.5-zen1 and Arch Linux.
    RMI4 over SMBus is confirmed working without any kernel parameters.
    
    Signed-off-by: Nicolás Bazaes <contacto@bazaes.cl>
    Assisted-by: Claude:claude-sonnet-4-6
    Link: https://patch.msgid.link/20260514013552.14234-1-contacto@bazaes.cl
    Cc: stable@vger.kernel.org
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Input: usbtouchscreen - clamp NEXIO data_len/x_len to URB buffer size [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Mon Apr 20 18:00:27 2026 +0200

    Input: usbtouchscreen - clamp NEXIO data_len/x_len to URB buffer size
    
    commit 2905281cbda52ec9df540113b35b835feb5fafd3 upstream.
    
    nexio_read_data() pulls data_len and x_len from a packed __be16 header
    in the device's interrupt packet and then walks packet->data[0..x_len)
    and packet->data[x_len..data_len) comparing each byte against a
    threshold.
    
    Both fields are 16-bit on the wire (max 65535).  The existing
    adjustments shave at most 0x100 / 0x80 off, so the loop bound can still
    reach roughly 0xfeff.  The URB transfer buffer for NEXIO is rept_size
    (1024) bytes from usb_alloc_coherent(), with the first 7 occupied by the
    packed header — so packet->data[] has 1017 valid bytes.  read_data()
    callbacks are not given urb->actual_length, and nothing else bounds the
    walk.
    
    A device that lies about its length can get a ~64 KiB out-of-bounds read
    past the coherent DMA allocation.  The first index whose byte exceeds
    NEXIO_THRESHOLD lands in begin_x / begin_y and from there into the
    reported touch coordinates, so adjacent kernel memory contents leak to
    userspace as ABS_X / ABS_Y events.  Far enough out, the read can also
    hit an unmapped page and fault.
    
    Fix this all by clamping data_len to the buffer's data[] capacity and
    x_len to data_len.
    
    Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Fixes: 5197424cdccc ("Input: usbtouchscreen - add NEXIO (or iNexio) support")
    Cc: stable <stable@kernel.org>
    Assisted-by: gkh_clanker_t1000
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Link: https://patch.msgid.link/2026042026-chlorine-epidermis-fd6d@gregkh
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Input: xpad - add "Nova 2 Lite" from GameSir [+ + +]
Author: Qbeliw Tanaka <q.tanaka@gmx.com>
Date:   Thu Apr 30 21:44:12 2026 -0700

    Input: xpad - add "Nova 2 Lite" from GameSir
    
    commit 1f6ac0f8441c48c4cc250141e1da8486c13512ba upstream.
    
    Add support for the gamepad "Nova 2 Lite" from GameSir, compatible with
    the Xbox 360 gamepad.
    
    Signed-off-by: Qbeliw Tanaka <q.tanaka@gmx.com>
    Link: https://patch.msgid.link/20260429.162040.930225048583399359.q.tanaka@gmx.com
    Cc: stable@vger.kernel.org
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Input: xpad - add support for ASUS ROG RAIKIRI II [+ + +]
Author: Dmitriy Zharov <contact@zharov.dev>
Date:   Thu Apr 30 22:35:22 2026 +0400

    Input: xpad - add support for ASUS ROG RAIKIRI II
    
    commit c897cf120696b94f56ed0f3197ba9a77071a59ec upstream.
    
    Add the VID/PIDs for the ASUS ROG RAIKIRI II controller to xpad_device
    and the VID to xpad_table. The controller has a physical PC/XBOX toggle
    which switches between XBOX360 and XBOXONE protocols.
    
    Signed-off-by: Dmitriy Zharov <contact@zharov.dev>
    Link: https://patch.msgid.link/20260430183522.122151-1-contact@zharov.dev
    Cc: stable@vger.kernel.org
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Input: xpad - fix out-of-bounds access for Share button [+ + +]
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date:   Sun Apr 26 21:09:33 2026 -0700

    Input: xpad - fix out-of-bounds access for Share button
    
    commit 6cdc46b38cf146ce81d4831b6472dbf7731849a2 upstream.
    
    xpadone_process_packet() receives len directly from urb->actual_length
    and uses it to index the share-button byte at data[len - 18] or
    data[len - 26]. Since both len and data[0] are under the device's
    control, a broken controller can send a GIP_CMD_INPUT packet with
    actual_length < 18 (e.g. 5 bytes) and reach this code path, causing
    accesses beyond the actual array.
    
    Fix this by calculating the offset and checking bounds against the
    packet length.
    
    Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Fixes: 4ef46367073b ("Input: xpad - fix Share button on Xbox One controllers")
    Cc: stable@vger.kernel.org
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
iommu, debugobjects: avoid gcc-16.1 section mismatch warnings [+ + +]
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Wed May 13 16:53:54 2026 +0200

    iommu, debugobjects: avoid gcc-16.1 section mismatch warnings
    
    commit 4c9ad387aa2d6785299722e54224d34764edaeb3 upstream.
    
    gcc-16 has gained some more advanced inter-procedual optimization
    techniques that enable it to inline the dummy_tlb_add_page() and
    dummy_tlb_flush() function pointers into a specialized version of
    __arm_v7s_unmap:
    
    WARNING: modpost: vmlinux: section mismatch in reference: __arm_v7s_unmap+0x2cc (section: .text) -> dummy_tlb_add_page (section: .init.text)
    ERROR: modpost: Section mismatches detected.
    
    >From what I can tell, the transformation is correct, as this is only
    called when __arm_v7s_unmap() is called from arm_v7s_do_selftests(),
    which is also __init. Since __arm_v7s_unmap() however is not __init,
    gcc cannot inline the inner function calls directly.
    
    In debug_objects_selftest(), the same thing happens. Both the
    caller and the leaf function are __init, but the IPA pulls
    it into a non-init one:
    
    WARNING: modpost: vmlinux: section mismatch in reference: lookup_object_or_alloc+0x7c (section: .text.lookup_object_or_alloc) -> is_static_object (section: .init.text)
    
    Marking the affected functions as not "__init" would reliably avoid this
    issue but is not a good solution because it removes an otherwise correct
    annotation. I tried marking the functions as 'noinline', but that ended
    up not covering all the affected configurations.
    
    With some more experimenting, I found that marking these functions as
    __attribute__((noipa)) is both logical and reliable.
    
    In order to keep the syntax readable, add a custom macro for this in
    include/linux/compiler_attributes.h next to other related macros and
    use it to annotate both files.
    
    Link: https://lore.kernel.org/all/abRB6g-48ZX6Yl2r@willie-the-truck/
    Cc: Will Deacon <will@kernel.org>
    Cc: Thomas Gleixner <tglx@kernel.org>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Miguel Ojeda <ojeda@kernel.org>
    Cc: linux-kbuild@vger.kernel.org
    Cc: stable@vger.kernel.org
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Acked-by: Will Deacon <will@kernel.org>
    Acked-by: Thomas Gleixner <tglx@kernel.org>
    Acked-by: Miguel Ojeda <ojeda@kernel.org>
    Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
iommu: Skip PASID validation for devices without PASID capability [+ + +]
Author: Tushar Dave <tdave@nvidia.com>
Date:   Thu Jun 4 16:47:53 2026 +0300

    iommu: Skip PASID validation for devices without PASID capability
    
    [ Upstream commit b3f6fcd8404f9f92262303369bb877ec5d188a81 ]
    
    Generally PASID support requires ACS settings that usually create
    single device groups, but there are some niche cases where we can get
    multi-device groups and still have working PASID support. The primary
    issue is that PCI switches are not required to treat PASID tagged TLPs
    specially so appropriate ACS settings are required to route all TLPs to
    the host bridge if PASID is going to work properly.
    
    pci_enable_pasid() does check that each device that will use PASID has
    the proper ACS settings to achieve this routing.
    
    However, no-PASID devices can be combined with PASID capable devices
    within the same topology using non-uniform ACS settings. In this case
    the no-PASID devices may not have strict route to host ACS flags and
    end up being grouped with the PASID devices.
    
    This configuration fails to allow use of the PASID within the iommu
    core code which wrongly checks if the no-PASID device supports PASID.
    
    Fix this by ignoring no-PASID devices during the PASID validation. They
    will never issue a PASID TLP anyhow so they can be ignored.
    
    Fixes: c404f55c26fc ("iommu: Validate the PASID in iommu_attach_device_pasid()")
    Cc: stable@vger.kernel.org
    Signed-off-by: Tushar Dave <tdave@nvidia.com>
    Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
    Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
    Link: https://lore.kernel.org/r/20250520011937.3230557-1-tdave@nvidia.com
    Signed-off-by: Joerg Roedel <jroedel@suse.de>
    
    [ Refactored to apply cleanly without support attaching PASID to the blocked domain ]
    Signed-off-by: Dmitrii Chervov <fary.ru@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ip6: vti: Use ip6_tnl.net in vti6_changelink(). [+ + +]
Author: Kuniyuki Iwashima <kuniyu@google.com>
Date:   Thu May 21 21:05:54 2026 +0800

    ip6: vti: Use ip6_tnl.net in vti6_changelink().
    
    commit 11b326fb0a374f4654f9be22d0f0f7abd9f7d3fe upstream.
    
    ip netns add ns1
    ip netns add ns2
    ip -n ns1 link add vti6_test type vti6 remote ::1 local ::2 key 7
    ip -n ns1 link set vti6_test netns ns2
    ip -n ns2 link set vti6_test type vti6 remote ::3 local ::4 key 9
    ip netns del ns2
    ip netns del ns1
    [  132.495484] ------------[ cut here ]------------
    [  132.497609] kernel BUG at net/core/dev.c:12376!
    
    Commit 61220ab34948 ("vti6: Enable namespace changing") dropped
    NETIF_F_NETNS_LOCAL from vti6 devices. A vti6 tunnel can then
    move through IFLA_NET_NS_FD. After the move dev_net(dev) points
    at the new netns while t->net stays at the creation netns.
    
    vti6_changelink() and vti6_update() still use dev_net(dev) and
    dev_net(t->dev). They unlink from one per netns hash and relink
    into another. The creation netns is left with a stale entry.
    cleanup_net() of that netns later walks freed memory.
    
    Reachable from an unprivileged user namespace (unshare --user
    --map-root-user --net). Cross tenant scope on container hosts.
    
    Fixes: 61220ab34948 ("vti6: Enable namespace changing")
    Reported-by: Maoyi Xie <maoyi.xie@ntu.edu.sg>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Cc: stable@vger.kernel.org # v5.15+
    Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
    Link: https://patch.msgid.link/20260521130555.3421684-2-maoyixie.tju@gmail.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ip6: vti: Use ip6_tnl.net in vti6_siocdevprivate(). [+ + +]
Author: Maoyi Xie <maoyixie.tju@gmail.com>
Date:   Thu May 21 21:05:55 2026 +0800

    ip6: vti: Use ip6_tnl.net in vti6_siocdevprivate().
    
    commit 8b484efd5cb4eeef9021a661e198edc5349dacf6 upstream.
    
    After patch 1/2 in this series, vti6_update() unlinks and relinks
    the tunnel through t->net. vti6_siocdevprivate() still uses
    dev_net(dev) for the collision lookup. For a tunnel moved through
    IFLA_NET_NS_FD, dev_net(dev) is the new netns, not t->net.
    
    SIOCCHGTUNNEL on a migrated tunnel then runs:
    
      net = dev_net(dev)                    /* migrated netns */
      t   = vti6_locate(net, &p1, false)    /* misses target in t->net */
      ...
      t   = netdev_priv(dev)
      vti6_update(t, &p1, false)            /* mutates t->net's hash */
    
    A caller in the migrated netns picks params that match a tunnel
    in the creation netns. The lookup in dev_net(dev) finds nothing.
    vti6_update() prepends the migrated tunnel at the head of the
    creation netns hash bucket for those params. Later lookups in
    the creation netns resolve to the migrated device. xfrm receive
    delivers the matched packets through a device the caller controls.
    
    Reachable from an unprivileged user namespace (unshare --user
    --map-root-user --net). Cross tenant scope on container hosts.
    
    Switch the SIOCCHGTUNNEL path on a non fallback device to use
    t->net for the lookup. The lookup now matches the netns
    vti6_update() operates on.
    
    Also add ns_capable(self->net->user_ns, CAP_NET_ADMIN) before
    the lookup. The check at the top of the case is against
    dev_net(dev)->user_ns, which after migration is the attacker's
    netns. A caller there can pick params absent from self->net,
    the lookup returns NULL, t becomes self, and vti6_update()
    inserts the device into the creation netns hash. The new check
    requires CAP_NET_ADMIN in the creation netns user_ns too.
    
    SIOCADDTUNNEL and SIOCCHGTUNNEL on the fallback device keep
    dev_net(dev), which equals init_net there.
    
    Fixes: 61220ab34948 ("vti6: Enable namespace changing")
    Suggested-by: Jakub Kicinski <kuba@kernel.org>
    Suggested-by: Xiao Liang <shaw.leon@gmail.com>
    Cc: stable@vger.kernel.org # v5.15+
    Signed-off-by: Maoyi Xie <maoyixie.tju@gmail.com>
    Link: https://patch.msgid.link/20260521130555.3421684-3-maoyixie.tju@gmail.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ipc: limit next_id allocation to the valid ID range [+ + +]
Author: Linpu Yu <linpu5433@gmail.com>
Date:   Sun May 10 13:43:30 2026 +0800

    ipc: limit next_id allocation to the valid ID range
    
    commit fa0b9b2b7ae3539908d69c2b9ac0d144d9bc5139 upstream.
    
    The checkpoint/restore sysctl path can request the next SysV IPC id
    through ids->next_id.  ipc_idr_alloc() currently forwards that request to
    idr_alloc() with an open-ended upper bound.
    
    If the valid tail of the SysV IPC id space is full, the allocation can
    spill beyond ipc_mni.  The returned SysV IPC id still uses the normal
    index encoding, so later lookup and removal can target the wrong slot.
    This leaves the real IDR entry behind and breaks the IDR state for the
    object.
    
    The bug is in ipc_idr_alloc() in the checkpoint/restore path.
    
    1. ids->next_id is passed to:
    
           idr_alloc(&ids->ipcs_idr, new, ipcid_to_idx(next_id), 0, ...)
    
    2. The zero upper bound makes the allocation effectively open-ended.
       Once the valid SysV IPC tail is occupied, idr_alloc() can spill past
       ipc_mni and allocate an entry beyond the valid IPC id range.
    
    3. The new object id is still encoded with the narrower SysV IPC index
       width:
    
           new->id = (new->seq << ipcmni_seq_shift()) + idx
    
    4. Later removal goes through ipc_rmid(), which uses:
    
           ipcid_to_idx(ipcp->id)
    
       That truncates the real IDR index. An object actually stored at a
       high index can then be removed as if it lived at a low in-range
       index.
    
    5. For shared memory, shm_destroy() frees the current object anyway, but
       the real high IDR slot is left behind as a dangling pointer.
    
    6. A subsequent walk of /proc/sysvipc/shm reaches the stale IDR entry
       and dereferences freed memory.
    
    Prevent this by bounding the requested allocation to ipc_mni so the
    checkpoint/restore path fails once the valid range is exhausted.
    
    Link: https://lore.kernel.org/cover.1778336914.git.linpu5433@gmail.com
    Link: https://lore.kernel.org/2eebe949bfa7d1f6e13b5be6a92c64c850ce9d45.1778336914.git.linpu5433@gmail.com
    Fixes: 03f595668017 ("ipc: add sysctl to specify desired next object id")
    Signed-off-by: Linpu Yu <linpu5433@gmail.com>
    Signed-off-by: Ren Wei <n05ec@lzu.edu.cn>
    Reported-by: Yuan Tan <yuantan098@gmail.com>
    Reported-by: Yifan Wu <yifanwucs@gmail.com>
    Reported-by: Juefei Pu <tomapufckgml@gmail.com>
    Reported-by: Xin Liu <bird@lzu.edu.cn>
    Cc: Kees Cook <kees@kernel.org>
    Cc: Stanislav Kinsbursky <skinsbursky@parallels.com>
    Cc: Davidlohr Bueso <dave@stgolabs.net>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ipv4: free net->ipv4.sysctl_local_reserved_ports after unregister_net_sysctl_table() [+ + +]
Author: Eric Dumazet <edumazet@google.com>
Date:   Thu May 21 12:21:47 2026 +0000

    ipv4: free net->ipv4.sysctl_local_reserved_ports after unregister_net_sysctl_table()
    
    [ Upstream commit 87a1e0fe7776da7ab411be332b4be58ac8840d10 ]
    
    ipv4_sysctl_exit_net() is currently freeing net->ipv4.sysctl_local_reserved_ports
    too soon.
    
    Only after unregister_net_sysctl_table() we can be sure no threads can possibly
    use the sysctls, including /proc/sys/net/ipv4/ip_local_reserved_ports.
    
    Fixes: 122ff243f5f1 ("ipv4: make ip_local_reserved_ports per netns")
    Reported-by: Ji'an Zhou <eilaimemedsnaimel@gmail.com>
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Cc: Cong Wang <xiyou.wangcong@gmail.com>
    Reviewed-by: Jason Xing <kerneljasonxing@gmail.com>
    Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
    Link: https://patch.msgid.link/20260521122147.3584624-1-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ipv6: exthdrs: refresh nh after handling HAO option [+ + +]
Author: Zhengchuan Liang <zcliangcn@gmail.com>
Date:   Fri May 22 17:42:26 2026 +0800

    ipv6: exthdrs: refresh nh after handling HAO option
    
    commit f7b52afe3592eae66e160586b45a3f2242972c63 upstream.
    
    ip6_parse_tlv() caches skb_network_header(skb) in nh while walking
    IPv6 TLVs.
    
    ipv6_dest_hao() may call pskb_expand_head() for a cloned skb, which can
    move the skb head and invalidate the cached network header pointer.
    Refresh nh after ipv6_dest_hao() returns so any trailing padding or TLVs
    are parsed from the current skb head.
    
    This matches the existing pattern used in ip6_parse_tlv() after helpers
    that can modify skb header storage.
    
    Fixes: a831f5bbc89a ("[IPV6] MIP6: Add inbound interface of home address option.")
    Cc: stable@kernel.org
    Reported-by: Yuan Tan <yuantan098@gmail.com>
    Reported-by: Xin Liu <bird@lzu.edu.cn>
    Co-developed-by: Luxing Yin <tr0jan@lzu.edu.cn>
    Signed-off-by: Luxing Yin <tr0jan@lzu.edu.cn>
    Signed-off-by: Zhengchuan Liang <zcliangcn@gmail.com>
    Signed-off-by: Ren Wei <n05ec@lzu.edu.cn>
    Reviewed-by: Justin Iurman <justin.iurman@gmail.com>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Link: https://patch.msgid.link/7aba1debc2196189172499e5769802b026f8caf8.1779247873.git.zcliangcn@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ipv6: exthdrs: refresh nh pointer after ipv6_hop_jumbo() [+ + +]
Author: Justin Iurman <justin.iurman@gmail.com>
Date:   Fri May 22 13:20:13 2026 +0200

    ipv6: exthdrs: refresh nh pointer after ipv6_hop_jumbo()
    
    commit d47548a36639095939f4747d4c43f2271366f565 upstream.
    
    ipv6_hop_jumbo() calls pskb_trim_rcsum(), which can change skb pointers.
    Let's recompute nh pointer to make sure any change won't mess things up.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable@vger.kernel.org
    Signed-off-by: Justin Iurman <justin.iurman@gmail.com>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Link: https://patch.msgid.link/20260522112013.12342-1-justin.iurman@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ipv6: fix possible infinite loop in fib6_select_path() [+ + +]
Author: Jiayuan Chen <jiayuan.chen@linux.dev>
Date:   Wed May 27 13:31:31 2026 +0800

    ipv6: fix possible infinite loop in fib6_select_path()
    
    [ Upstream commit 9c7da87c2dc860bb17ca1ece942495d28b1ce3b9 ]
    
    Found while auditing the same pattern Sashiko reported in
    rt6_fill_node() [1]. Apply the same fix as
    commit f8d8ce1b515a ("ipv6: fix possible infinite loop in fib6_info_uses_dev()").
    
    Writers holding tb6_lock can list_del_rcu(&first->fib6_siblings)
    without waiting for RCU readers; first->fib6_siblings.next then
    still points into the old ring and this softirq-side walker never
    reaches &first->fib6_siblings as its terminator. fib6_purge_rt()
    always WRITE_ONCE()s first->fib6_nsiblings to 0 before
    list_del_rcu(), so an inside-loop check is a reliable detach signal.
    
    [1] https://sashiko.dev/#/patchset/20260526020227.4857-1-jiayuan.chen%40linux.dev
    
    Fixes: d9ccb18f83ea ("ipv6: Fix soft lockups in fib6_select_path under high next hop churn")
    Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Link: https://patch.msgid.link/20260527053133.180695-2-jiayuan.chen@linux.dev
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ipv6: fix possible infinite loop in rt6_fill_node() [+ + +]
Author: Jiayuan Chen <jiayuan.chen@linux.dev>
Date:   Wed May 27 13:31:30 2026 +0800

    ipv6: fix possible infinite loop in rt6_fill_node()
    
    [ Upstream commit 9f72412bcf60144f252b0d6205106abf14344abc ]
    
    Sashiko reported this issue [1]. Apply the same fix as
    commit f8d8ce1b515a ("ipv6: fix possible infinite loop in fib6_info_uses_dev()").
    
    Writers holding tb6_lock can list_del_rcu(&rt->fib6_siblings)
    without waiting for RCU readers; rt->fib6_siblings.next then still
    points into the old ring and this softirq-side walker never reaches
    &rt->fib6_siblings, causing a CPU stall. fib6_del_route() always
    WRITE_ONCE()s rt->fib6_nsiblings to 0 before list_del_rcu(), so an
    inside-loop check is a reliable detach signal.
    
    [1] https://sashiko.dev/#/patchset/20260526020227.4857-1-jiayuan.chen%40linux.dev
    
    Fixes: d9ccb18f83ea ("ipv6: Fix soft lockups in fib6_select_path under high next hop churn")
    Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Link: https://patch.msgid.link/20260527053133.180695-1-jiayuan.chen@linux.dev
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ipv6: rpl: fix hdrlen overflow in ipv6_rpl_srh_decompress() [+ + +]
Author: Rahul Chandelkar <rc@rexion.ai>
Date:   Mon May 25 21:10:31 2026 +0530

    ipv6: rpl: fix hdrlen overflow in ipv6_rpl_srh_decompress()
    
    [ Upstream commit 9d5e7a46a9f6d8f503b41bfefef70659845f1679 ]
    
    ipv6_rpl_srh_decompress() computes:
    
        outhdr->hdrlen = (((n + 1) * sizeof(struct in6_addr)) >> 3);
    
    hdrlen is __u8. For n >= 127 the result exceeds 255 and silently
    truncates. With n=127 (cmpri=15, cmpre=15, pad=0, hdrlen=16):
    
        (128 * 16) >> 3 = 256, truncated to 0 as __u8
    
    The caller in ipv6_rpl_srh_rcv() then places the compressed header
    at buf + ((ohdr->hdrlen + 1) << 3). With hdrlen=0 this is buf + 8,
    but the decompressed region occupies buf[0..2055] (8-byte header
    plus 128 full addresses). The compressed header overlaps the
    decompressed data, and ipv6_rpl_srh_compress() writes into this
    overlap, corrupting the routing header of the forwarded packet.
    
    The existing guard at exthdrs.c:546 checks (n + 1) > 255, which
    prevents n+1 from overflowing unsigned char (the segments_left
    field), but does not prevent the computed hdrlen from overflowing
    __u8. n=127 passes because 128 <= 255, yet hdrlen=256 does not
    fit.
    
    Tighten the bound to (n + 1) > 127. This caps n at 126, giving
    hdrlen = (127 * 16) >> 3 = 254, which fits in __u8. The compressed
    header then lands at buf + ((254 + 1) << 3) = buf + 2040, exactly
    past the decompressed region (buf[0..2039]). No overlap. 127
    segments is well beyond any realistic RPL deployment.
    
    Fixes: 8610c7c6e3bd ("net: ipv6: add support for rpl sr exthdr")
    Signed-off-by: Rahul Chandelkar <rc@rexion.ai>
    Link: https://patch.msgid.link/20260525154031.2290876-1-rc@rexion.ai
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ipv6: validate extension header length before copying to cmsg [+ + +]
Author: Qi Tang <tpluszz77@gmail.com>
Date:   Sat May 23 22:32:45 2026 +0800

    ipv6: validate extension header length before copying to cmsg
    
    commit dd433671fef381fdaf7b530c631e6b782d66e224 upstream.
    
    ip6_datagram_recv_specific_ctl() builds IPV6_{HOPOPTS,DSTOPTS,RTHDR}
    cmsgs (and their IPV6_2292* legacy counterparts) by trusting the
    on-wire hdrlen byte (ptr[1]) when computing the put_cmsg() length.
    The length was validated only at parse time (ipv6_parse_hopopts(),
    etc.).  An nftables payload-write expression can rewrite hdrlen after
    parsing and before the skb reaches recvmsg; the write itself is
    in-bounds but put_cmsg() then reads up to ((hdrlen+1) << 3) = 2040
    bytes from an 8-byte header.  nftables is reachable from an
    unprivileged user namespace, so this is an unprivileged
    slab-out-of-bounds read:
    
      BUG: KASAN: slab-out-of-bounds in put_cmsg+0x3ac/0x540
       put_cmsg+0x3ac/0x540
       udpv6_recvmsg+0xca0/0x1250
       sock_recvmsg+0xdf/0x190
       ____sys_recvmsg+0x1b1/0x620
    
    Add ipv6_get_exthdr_len() which validates that at least two bytes
    are accessible before reading the hdrlen field, then checks the
    computed length against skb_tail_pointer(skb), returning 0 on
    failure.  Extension headers are kept in the linear skb area by
    pskb_may_pull() during input, so skb_tail_pointer() is the correct
    bound.
    
    Use ipv6_get_exthdr_len() at all non-AH call sites: the five
    standalone cmsg blocks (HbH, 2292HbH, 2292DSTOPTS x2, 2292RTHDR)
    and the three standard cases in the extension-header walk loop
    (DSTOPTS, ROUTING, default).  AH retains an inline bounds check
    because its length formula differs ((ptr[1]+2)<<2).
    
    The walk loop also gets a pre-read bounds check at the top to
    validate ptr before any case accesses ptr[0] or ptr[1].
    
    When the walk loop detects a corrupted header, return from the
    function instead of continuing to process later socket options.
    
    Cc: stable@vger.kernel.org
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Qi Tang <tpluszz77@gmail.com>
    Reviewed-by: Willem de Bruijn <willemb@google.com>
    Link: https://patch.msgid.link/20260523143245.2281415-1-tpluszz77@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ksmbd: OOB read regression in smb_check_perm_dacl() ACE-walk loops [+ + +]
Author: Ali Ganiyev <ali.qaniyev@gmail.com>
Date:   Mon May 25 10:23:47 2026 +0900

    ksmbd: OOB read regression in smb_check_perm_dacl() ACE-walk loops
    
    commit 0e60dafe97eca61721f3db456f97d97a80c6c8ae upstream.
    
    Commit d07b26f39246 ("ksmbd: require minimum ACE size in
    smb_check_perm_dacl()") introduced a transposed bounds check:
    
        if (offsetof(struct smb_ace, sid) + aces_size < CIFS_SID_BASE_SIZE)
    
    Since offsetof(..sid) is 8 and CIFS_SID_BASE_SIZE is 8, this evaluates
    to `aces_size < 0`. Because `aces_size` is always non-negative, this
    check becomes dead code and never breaks the loop.
    
    Worse, that commit removed the old 4-byte guard, meaning the loop now
    reads `ace->size` (offset 2) even when `aces_size` is 0-3 bytes. This
    re-opens a 2-byte heap out-of-bounds (OOB) read past the pntsd allocation
    during subsequent SMB2_CREATE operations.
    
    Fix this by properly transposing the comparison to require at least
    16 bytes (8-byte offset + 8-byte SID base), matching the correct form
    used in smb_inherit_dacl().
    
    Fixes: d07b26f39246 ("ksmbd: require minimum ACE size in smb_check_perm_dacl()")
    Cc: stable@vger.kernel.org
    Signed-off-by: Ali Ganiyev <ali.qaniyev@gmail.com>
    Acked-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
kunit: fix use-after-free in debugfs when using kunit.filter [+ + +]
Author: Florian Schmaus <florian.schmaus@codasip.com>
Date:   Thu May 7 10:48:54 2026 +0200

    kunit: fix use-after-free in debugfs when using kunit.filter
    
    [ Upstream commit fb6988b83b4cafe8db63999c1ddff1b7c66d2ff5 ]
    
    When the kernel is booted with a kunit filter (e.g.,
    kunit.filter="speed!=slow"), the kunit executor dynamically allocates
    copies of the filtered test suites using kmalloc/kmemdup.
    
    During the initial boot execution, kunit_debugfs_create_suite() creates
    debugfs files (such as /sys/kernel/debug/kunit/<suite>/run) and
    permanently stores a pointer to the dynamically allocated suite in the
    inode's i_private field.
    
    Previously, the executor freed this dynamically allocated suite_set
    immediately after executing the boot-time tests. Because the debugfs
    nodes were not destroyed, any subsequent interaction with the debugfs
    `run` file from userspace triggered a use-after-free (UAF). On systems
    with architectural capabilities, like CHERI RISC-V, this resulted in
    an immediate fatal hardware exception due to the invalidation of the
    capability tags on the reclaimed memory. On other architectures, it
    resulted in silent memory corruption.
    
    Fix this UAF by properly coupling the lifetime of the filtered suite
    memory allocation to the lifetime of the kunit subsystem and its
    associated VFS nodes. Ownership of the boot-time suite_set is now
    transferred to a global tracker ('kunit_boot_suites'), and the memory
    is cleanly released in kunit_exit() during module teardown.
    
    Link: https://lore.kernel.org/r/20260507084854.233984-1-florian.schmaus@codasip.com
    Fixes: e2219db280e3 ("kunit: add debugfs /sys/kernel/debug/kunit/<suite>/results display")
    Signed-off-by: Florian Schmaus <florian.schmaus@codasip.com>
    Reviewed-by: Martin Kaiser <martin@kaiser.cx>
    Reviewed-by: David Gow <david@davidgow.net>
    Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
KVM: arm64: PMU: Preserve AArch32 counter low bits [+ + +]
Author: Qiang Ma <maqianga@uniontech.com>
Date:   Tue May 26 15:46:40 2026 +0800

    KVM: arm64: PMU: Preserve AArch32 counter low bits
    
    commit 1750ad1388e03fb27068cd1f22c9c8b4590fe936 upstream.
    
    AArch32 writes to PMU event counters cannot update the top 32 bits,
    even when PMUv3p5 makes the counters 64-bit. KVM therefore needs to
    preserve the existing high half and only update the low half written by
    the guest, unless the caller explicitly forces a full reset through
    PMCR.P.
    
    The current code masks @val down to the old high half before taking
    lower_32_bits(val), which means the low half is always zero. As a
    result, AArch32 writes to event counters discard the guest-provided low
    32 bits instead of storing them.
    
    Build the new value from the old high 32 bits and the low 32 bits of
    the value supplied by the guest.
    
    Fixes: 26d2d0594d70 ("KVM: arm64: PMU: Do not let AArch32 change the counters' top 32 bits")
    Signed-off-by: Qiang Ma <maqianga@uniontech.com>
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Link: https://patch.msgid.link/20260526074640.791991-1-maqianga@uniontech.com
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: arm64: vgic-its: Drop the translation cache reference only for the erased entry [+ + +]
Author: Hyunwoo Kim <imv4bel@gmail.com>
Date:   Mon Jun 1 23:53:26 2026 +0900

    KVM: arm64: vgic-its: Drop the translation cache reference only for the erased entry
    
    commit 13031fb6b8357fbbcded2a7f4cba73e4781ee594 upstream.
    
    vgic_its_invalidate_cache() walks the per-ITS translation cache with
    xa_for_each() and drops the cache's reference on each entry with
    vgic_put_irq(). It puts the iterated pointer, though, rather than the
    value returned by xa_erase().
    
    The function is called from contexts that do not exclude one another: the
    ITS command handlers hold its_lock, the GITS_CTLR write path holds
    cmd_lock, and the path that clears EnableLPIs in a redistributor's
    GICR_CTLR holds neither. Two or more of them can drain the same cache
    concurrently, and if each one observes the same entry, erases it and then
    puts it, the single reference the cache holds on that entry is dropped
    more than once. The entry can then be freed while an ITE still maps it.
    
    xa_erase() is atomic and returns the previous entry, so put only the entry
    that this context actually removed. The cache reference is then dropped
    exactly once per entry even when the invalidations run concurrently, and
    the behavior is unchanged when only one context runs.
    
    Fixes: 8201d1028caa ("KVM: arm64: vgic-its: Maintain a translation cache per ITS")
    Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
    Reviewed-by: Oliver Upton <oupton@kernel.org>
    Link: https://patch.msgid.link/ah2c5lu4JbUg7dj-@v4bel
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: SEV: Check PSC request indices against the actual size of the buffer [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Fri May 1 13:22:34 2026 -0700

    KVM: SEV: Check PSC request indices against the actual size of the buffer
    
    commit 121d88de56bc5c0ba0ce2f6381af67f948a7e7c1 upstream.
    
    When processing Page State Change (PSC) requests, validate the PSC buffer
    against the effective size of the scratch area, which could be less than
    the maximum size if the guest provided a pointer that isn't exactly at the
    start of the GHCB shared buffer.
    
    Fixes: 9b54e248d264 ("KVM: SEV: Add support to handle Page State Change VMGEXIT")
    Cc: stable@vger.kernel.org
    Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
    Reviewed-by: Michael Roth <michael.roth@amd.com>
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Message-ID: <20260501202250.2115252-10-seanjc@google.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: SEV: Compute the correct max length of the in-GHCB scratch area [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Fri May 1 13:22:31 2026 -0700

    KVM: SEV: Compute the correct max length of the in-GHCB scratch area
    
    commit 5867d7e202e09f037cefe77f7af4413c7c0fa088 upstream.
    
    When setting the length of the GHCB scratch area, and the area is in the
    GHCB shared buffer, set the effective length of the scratch area to the max
    possible size given the start of the guest-provided pointer, and the end of
    the shared buffer.
    
    The code was "fine" when first introduced, as KVM doesn't consult the
    length of the buffer when emulating MMIO, because the passed in @len always
    specifies the *max* size required.  But for PSC requests, the incoming @len
    is just the minimum length (to process the header), and KVM needs to know
    the full size of the scratch area to avoid buffer overflows (spoiler alert).
    
    Opportunistically rename @len => @min_len to better reflect its role.
    
    Fixes: 9b54e248d264 ("KVM: SEV: Add support to handle Page State Change VMGEXIT")
    Cc: stable@vger.kernel.org
    Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
    Reviewed-by: Michael Roth <michael.roth@amd.com>
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Message-ID: <20260501202250.2115252-7-seanjc@google.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: SEV: Don't explicitly pass PSC buffer to snp_begin_psc() [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Fri May 1 13:22:33 2026 -0700

    KVM: SEV: Don't explicitly pass PSC buffer to snp_begin_psc()
    
    commit ebe4b2dc9cfbfb2d8f665667c4d08f4c6c9bec05 upstream.
    
    Stop explicitly passing the PSC buffer to snp_begin_psc(): it *must*
    be the scratch area.  This will allow fixing a variety of bugs without
    further complicating the code.
    
    No functional change intended.
    
    Cc: stable@vger.kernel.org
    Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
    Reviewed-by: Michael Roth <michael.roth@amd.com>
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Message-ID: <20260501202250.2115252-9-seanjc@google.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: SEV: Require in-GHCB scratch area if GHCB v2+ is in use [+ + +]
Author: Michael Roth <michael.roth@amd.com>
Date:   Fri May 1 13:22:26 2026 -0700

    KVM: SEV: Require in-GHCB scratch area if GHCB v2+ is in use
    
    commit db3f2195d29344a3cf1e9dd9ab7f21ced7308cf7 upstream.
    
    As per the GHCB spec, when using GHCB v2+ require the software scratch area
    to reside in the GHCB's shared buffer.  Note, things like Page State Change
    (PSC) requests _rely_ on this behavior, as the guest can't provide a length
    when making the request, i.e. the size of the guest payload is bounded by
    the size of the shared buffer.
    
    Failure to force usage of the GHCB, and a slew of other flaws, lets a
    malicious SNP guest corrupt host kernel heap memory, and leak host heap
    layout information.
    
    setup_vmgexit_scratch() allocates a buffer via kvzalloc(exit_info_2),
    where exit_info_2 is guest-controlled. With exit_info_2=24, this yields
    a 24-byte allocation in kmalloc-cg-32 (32-byte slab objects). The buffer
    holds an 8-byte psc_hdr followed by 8-byte psc_entry structs, so only
    entries[0] and entries[1] are in-bounds.
    
    snp_begin_psc() validates end_entry against VMGEXIT_PSC_MAX_COUNT (253)
    but NOT against the actual buffer size:
    
          idx_end = hdr->end_entry;
    
          if (idx_end >= VMGEXIT_PSC_MAX_COUNT) {   // checks 253, not buffer
              snp_complete_psc(svm, ...);
              return 1;
          }
    
          for (idx = idx_start; idx <= idx_end; idx++) {
              entry_start = entries[idx];           // OOB when idx >= 2
    
    The guest sets end_entry=10+, causing the host to iterate entries[2+]
    which are OOB into adjacent slab objects. For each OOB entry:
    
      - The host reads 8 bytes (OOB READ / info leak oracle)
      - If the data passes PSC validation, __snp_complete_one_psc() writes
        cur_page = 1 or 512 into the entry (OOB WRITE, sev.c:3806)
      - If validation fails, the error response reveals whether adjacent
        memory is zero vs non-zero (information disclosure to guest)
    
    The guest controls allocation size (exit_info_2), entry range
    (cur_entry/end_entry), and can fire unlimited VMGEXITs to repeatedly
    hit different slab positions.
    
    By exploiting the variety of bugs, a malicious SEV-SNP guest can:
        - OOB read adjacent kmalloc-cg-32 objects (heap layout disclosure)
        - OOB write cur_page bits into adjacent objects (heap corruption)
        - Trigger use-after-free conditions across VMGEXITs
    
    E.g. with KASAN enabled, a single insmod of the PoC guest module
    produces 73 KASAN reports:
    
        BUG: KASAN: slab-out-of-bounds in snp_begin_psc+0x126/0x890
        Read of size 8 at addr ffff888219ffb5e0 by task qemu-system-x86/2199
    
        BUG: KASAN: slab-out-of-bounds in snp_begin_psc+0x468/0x890
        Write of size 8 at addr ffff888351566648 by task qemu-system-x86/2199
    
        The buggy address belongs to the object at ffff888XXXXXXXXX
         which belongs to the cache kmalloc-cg-32 of size 32
        The buggy address is located N bytes to the right of
         allocated 32-byte region [ffff888XXXXXXXXX, ffff888XXXXXXXXX)
    
      Breakdown:
        62 slab-out-of-bounds (reads + writes past allocation)
         7 slab-use-after-free
         4 use-after-free
    
    All credit to Stan for the wonderful description and reproducer!
    
    Reported-by: Stan Shaw <shawstan96@gmail.com>
    Cc: Michael Roth <michael.roth@amd.com>
    Cc: Tom Lendacky <thomas.lendacky@amd.com>
    Cc: Peter Gonda <pgonda@google.com>
    Cc: Jacky Li <jackyli@google.com>
    Fixes: 4af663c2f64a ("KVM: SEV: Allow per-guest configuration of GHCB protocol version")
    Cc: stable@vger.kernel.org
    Signed-off-by: Michael Roth <michael.roth@amd.com>
    [sean: write changelog]
    Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Message-ID: <20260501202250.2115252-2-seanjc@google.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: SEV: Use READ_ONCE() when reading entries/indices from PSC buffer [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Fri May 1 13:22:35 2026 -0700

    KVM: SEV: Use READ_ONCE() when reading entries/indices from PSC buffer
    
    commit c8cc238093ca6c99267032f6cfe78f59389f3157 upstream.
    
    Use READ_ONCE() when reading entries/indices from the guest-accessible
    Page State Change buffer to defend against TOCTOU bugs.
    
    Don't bother with READ_ONCE()/WRITE_ONCE() for cases where KVM is writing
    (and not consuming the result!), as the guest isn't supposed to touch the
    buffer while it's being processed.  I.e. using READ_ONCE() is all about
    protecting against misbehaving guests.
    
    Fixes: 9b54e248d264 ("KVM: SEV: Add support to handle Page State Change VMGEXIT")
    Cc: stable@vger.kernel.org
    Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Message-ID: <20260501202250.2115252-11-seanjc@google.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: SEV: Use the size of the PSC header as the minimum size for PSC requests [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Fri May 1 13:22:30 2026 -0700

    KVM: SEV: Use the size of the PSC header as the minimum size for PSC requests
    
    commit 2be54670bdc017004c4a4b8bddb6ff02ebe7dbe2 upstream.
    
    When handling a Page State Change (PSC) #VMGEXIT use the size of the PSC
    header as the minimum size for the scratch area.  Per the GHCB spec, PSC
    requests do NOT provide the length, i.e. using control->exit_info_2 for the
    length is completely made up behavior.  The existing code "works", e.g.
    even though Linux-as-a-guest always passes '0', because KVM doesn't do
    anything with the length when the request is in the GHCB's shared buffer.
    
    Use the header as the min length.  Once the header is retrieved, KVM can
    use the specified indices to compute the full size of the request.
    
    Fixes: 9b54e248d264 ("KVM: SEV: Add support to handle Page State Change VMGEXIT")
    Cc: stable@vger.kernel.org
    Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
    Reviewed-by: Michael Roth <michael.roth@amd.com>
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Message-ID: <20260501202250.2115252-6-seanjc@google.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: SEV: WARN if KVM attempts to setup scratch area with min_len==0 [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Fri May 1 13:22:32 2026 -0700

    KVM: SEV: WARN if KVM attempts to setup scratch area with min_len==0
    
    commit f185e05dce6f170f83c4ba602e969b1c3c7a22e6 upstream.
    
    Now that all paths in KVM properly validate the length needed for the
    scratch area, and are guaranteed to pass in a non-zero length, WARN if KVM
    attempts to configured the scratch area with min_len==0 to guard against
    future bugs.
    
    Cc: stable@vger.kernel.org
    Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
    Reviewed-by: Michael Roth <michael.roth@amd.com>
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Message-ID: <20260501202250.2115252-8-seanjc@google.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: SVM: Flush the current TLB when transitioning from xAVIC => x2AVIC [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Fri May 15 10:15:36 2026 -0700

    KVM: SVM: Flush the current TLB when transitioning from xAVIC => x2AVIC
    
    commit a9e18aa3263f356edae305e29830e5fe63d8597a upstream.
    
    Flush the current TLB when xAVIC *or* x2AVIC is activated, as KVM is
    (apparently) responsible for purging TLB entries when transitioning from
    xAVIC to x2AVIC.  The APM says a whole lot of nothing about TLB flushing
    with respect to (x2)AVIC, but empirical data strongly suggests hardware
    also does a whole lot of nothing.
    
    Failure to flush the TLB when enabling x2AVIC can lead to guest accesses
    to the APIC base address getting incorrectly redirected to the virtual
    APIC page.  The flaw most visibly manifests as failures in KVM-Unit-Test's
    verify_disabled_apic_mmio() testcase when x2APIC is enabled (though for
    reasons unknown, the test only reliably fails with EFI builds).
    
    Fixes: 0ccf3e7cb95a ("KVM: SVM: Flush the "current" TLB when activating AVIC")
    Fixes: 4d1d7942e36a ("KVM: SVM: Introduce logic to (de)activate x2AVIC mode")
    Cc: stable@vger.kernel.org
    Cc: Naveen N Rao (AMD) <naveen@kernel.org>
    Link: https://patch.msgid.link/20260515171536.1841645-1-seanjc@google.com
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
l2tp: use refcount_inc_not_zero in l2tp_session_get_by_ifname [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
Date:   Fri May 22 22:34:23 2026 -0400

    l2tp: use refcount_inc_not_zero in l2tp_session_get_by_ifname
    
    commit 05f95729ca844704d15e49ce14868af4b403b32b upstream.
    
    A reader in l2tp_session_get_by_ifname() can return a pointer to a
    session whose refcount has reached zero. The getter takes its
    reference with plain refcount_inc(), but every other session getter
    in the same file (l2tp_v2_session_get, l2tp_v3_session_get, and the
    corresponding _get_next variants) uses refcount_inc_not_zero()
    because the IDR/RCU lookup can race with refcount_dec_and_test() ->
    l2tp_session_free() -> kfree_rcu(). The ifname getter is the only
    outlier; the inconsistency was raised on-list after 979c017803c4
    ("l2tp: use list_del_rcu in l2tp_session_unhash").
    
    A reader inside rcu_read_lock_bh() that matches session->ifname can
    be preempted between the strcmp() and the refcount_inc(). If the
    last reference drops on another CPU in that window, the reader's
    refcount_inc() runs on a counter that has reached zero. refcount_t
    catches the addition-on-zero, prints "refcount_t: addition on 0;
    use-after-free", saturates the counter, and returns the saturated
    pointer to the caller. Session memory is held live by the in-flight
    RCU read section, but the kfree_rcu() callback queued from
    l2tp_session_free() will free it once the grace period closes; a
    caller that dereferences the returned session past that point hits
    a slab-use-after-free. On PREEMPT_RT local_bh_disable() is a per-CPU
    sleeping lock and the preemption window is real; on stock PREEMPT
    kernels local_bh_disable() is a preempt_count increment that closes
    the cross-CPU race in practice (see below).
    
    Use refcount_inc_not_zero() and continue the list walk on failure,
    matching the other session getters in the file. The ifname getter
    is the only session getter in net/l2tp/ that still uses the bare
    refcount_inc() pattern; this change restores file-internal
    consistency. The success path is unchanged.
    
    Fixes: abe7a1a7d0b6 ("l2tp: improve tunnel/session refcount helpers")
    Cc: stable@vger.kernel.org
    Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
    Reviewed-by: James Chapman <jchapman@katalix.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20260523023423.2568972-1-michael.bommarito@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Linux: Linux 6.12.93 [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Tue Jun 9 12:26:06 2026 +0200

    Linux 6.12.93
    
    Link: https://lore.kernel.org/r/20260607095727.647295505@linuxfoundation.org
    Tested-by: Pavel Machek (CIP) <pavel@nabladev.com>
    Tested-by: Miguel Ojeda <ojeda@kernel.org>
    Tested-by: Peter Schneider <pschneider1968@googlemail.com>
    Tested-by: Francesco Dolcini <francesco.dolcini@toradex.com>
    Tested-by: Ron Economos <re@w6rz.net>
    Tested-by: Mark Brown <broonie@kernel.org>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Salvatore Bonaccorso <carnil@debian.org>
    Tested-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
macsec: fix replay protection at XPN lower-PN wrap [+ + +]
Author: Junrui Luo <moonafterrain@outlook.com>
Date:   Wed May 20 11:47:55 2026 +0800

    macsec: fix replay protection at XPN lower-PN wrap
    
    commit e68842b3356471ba56c882209f324613dac47f64 upstream.
    
    In macsec_post_decrypt(), when pn is U32_MAX, pn + 1 overflows u32 to 0
    and the first branch never fires. If next_pn_halves.lower is also in the
    upper half, pn_same_half(pn, lower) is true and the XPN else-if does not
    fire either, leaving next_pn_halves unchanged. An attacker that captures
    the legitimate frame carrying pn == 0xFFFFFFFF on an XPN association
    can then replay it indefinitely, since lowest_pn never rises above
    the captured pn and macsec_decrypt() reconstructs the same IV.
    
    Extend the XPN else-if to also fire when pn + 1 wraps to 0, so receipt
    of pn == U32_MAX advances next_pn_halves to (upper + 1, 0).
    
    Fixes: a21ecf0e0338 ("macsec: Support XPN frame handling - IEEE 802.1AEbw")
    Reported-by: Yuhao Jiang <danisjiang@gmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Junrui Luo <moonafterrain@outlook.com>
    Link: https://patch.msgid.link/SYBPR01MB78813FD49E58F253B989F197AF012@SYBPR01MB7881.ausprd01.prod.outlook.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
media: rc: fix race between unregister and urb/irq callbacks [+ + +]
Author: Sean Young <sean@mess.org>
Date:   Sat Dec 20 10:33:26 2025 +0000

    media: rc: fix race between unregister and urb/irq callbacks
    
    [ Upstream commit dccc0c3ddf8f16071736f98a7d6dd46a2d43e037 ]
    
    Some rc device drivers have a race condition between rc_unregister_device()
    and irq or urb callbacks. This is because rc_unregister_device() does two
    things, it marks the device as unregistered so no new commands can be
    issued and then it calls rc_free_device(). This means the driver has no
    chance to cancel any pending urb callbacks or interrupts after the device
    has been marked as unregistered. Those callbacks may access struct rc_dev
    or its members (e.g. struct ir_raw_event_ctrl), which have been freed by
    rc_free_device().
    
    This change removes the implicit call to rc_free_device() from
    rc_unregister_device(). This means that device drivers can call
    rc_unregister_device() in their remove or disconnect function, then cancel
    all the urbs and interrupts before explicitly calling rc_free_device().
    
    Note this is an alternative fix for an issue found by Haotian Zhang, see
    the Closes: tags.
    
    Reported-by: Haotian Zhang <vulab@iscas.ac.cn>
    Closes: https://lore.kernel.org/linux-media/20251114101432.2566-1-vulab@iscas.ac.cn/
    Closes: https://lore.kernel.org/linux-media/20251114101418.2548-1-vulab@iscas.ac.cn/
    Closes: https://lore.kernel.org/linux-media/20251114101346.2530-1-vulab@iscas.ac.cn/
    Closes: https://lore.kernel.org/linux-media/20251114090605.2413-1-vulab@iscas.ac.cn/
    Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
    Signed-off-by: Sean Young <sean@mess.org>
    Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
    Stable-dep-of: 646ebdd31058 ("media: rc: ttusbir: fix inverted error logic")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

media: rc: igorplugusb: fix control request setup packet [+ + +]
Author: Henri A <contact@henrialfonso.com>
Date:   Wed May 20 10:25:44 2026 -0400

    media: rc: igorplugusb: fix control request setup packet
    
    commit 171022c7d594c133a45f92357a2a91475edabe20 upstream.
    
    Commit eac69475b01f ("media: rc: igorplugusb: heed coherency
    rules") changed the control request storage from an embedded struct to
    an allocated pointer so it can obey DMA coherency rules.
    
    However, the driver still passes &ir->request to usb_fill_control_urb().
    That points the URB setup packet at the pointer field itself rather than
    at the allocated struct usb_ctrlrequest.
    
    USB core then interprets pointer bytes as the setup packet. This can
    produce an invalid bRequestType and trigger the control direction warning
    reported by syzbot:
    
      usb 2-1: BOGUS control dir, pipe 80003580 doesn't match bRequestType 0
    
    Pass ir->request itself as the setup packet.
    
    Fixes: eac69475b01f ("media: rc: igorplugusb: heed coherency rules")
    Reported-by: syzbot+11f0e4f957c7c3bf3d51@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=11f0e4f957c7c3bf3d51
    Tested-by: syzbot+11f0e4f957c7c3bf3d51@syzkaller.appspotmail.com
    Cc: stable@vger.kernel.org
    Assisted-by: Codex:GPT-5.5
    Signed-off-by: Henri A <contact@henrialfonso.com>
    Signed-off-by: Sean Young <sean@mess.org>
    Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: rc: ttusbir: fix inverted error logic [+ + +]
Author: Oliver Neukum <oneukum@suse.com>
Date:   Fri Apr 10 23:03:09 2026 +0200

    media: rc: ttusbir: fix inverted error logic
    
    [ Upstream commit 646ebdd3105809d84ed04aa9e92e47e89cc44502 ]
    
    We have to report ENOMEM if no buffer is allocated.
    Typo dropped a "!". Restore it.
    
    Fixes: 50acaad3d202 ("media: rc: ttusbir: respect DMA coherency rules")
    Cc: stable@vger.kernel.org
    Signed-off-by: Oliver Neukum <oneukum@suse.com>
    Signed-off-by: Sean Young <sean@mess.org>
    Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
memfd: deny writeable mappings when implying SEAL_WRITE [+ + +]
Author: Pratyush Yadav (Google) <pratyush@kernel.org>
Date:   Thu Jun 4 09:54:21 2026 -0400

    memfd: deny writeable mappings when implying SEAL_WRITE
    
    [ Upstream commit 3b041514cb6eae45869b020f743c14d983363222 ]
    
    When SEAL_EXEC is added, SEAL_WRITE is implied to make W^X.  But the
    implied seal is set after the check that makes sure the memfd can not have
    any writable mappings.  This means one can use SEAL_EXEC to apply
    SEAL_WRITE while having writeable mappings.
    
    This breaks the contract that SEAL_WRITE provides and can be used by an
    attacker to pass a memfd that appears to be write sealed but can still be
    modified arbitrarily.
    
    Fix this by adding the implied seals before the call for
    mapping_deny_writable() is done.
    
    Link: https://lore.kernel.org/20260505133922.797635-1-pratyush@kernel.org
    Fixes: c4f75bc8bd6b ("mm/memfd: add write seals when apply SEAL_EXEC to executable memfd")
    Signed-off-by: Pratyush Yadav (Google) <pratyush@kernel.org>
    Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com>
    Acked-by: Jeff Xu <jeffxu@google.com>
    Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
    Cc: Brendan Jackman <jackmanb@google.com>
    Cc: Greg Thelen <gthelen@google.com>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Kees Cook <kees@kernel.org>
    Cc: "David Hildenbrand (Arm)" <david@kernel.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/damon/sysfs-schemes: delete tried region in regions_rmdirs() [+ + +]
Author: SeongJae Park <sj@kernel.org>
Date:   Thu Jun 4 09:58:16 2026 -0400

    mm/damon/sysfs-schemes: delete tried region in regions_rmdirs()
    
    [ Upstream commit 441f92f7d386b85bad16de49db95a307cba048a2 ]
    
    DAMON sysfs maintains the DAMOS tried region directory objects via a
    linked list.  When the user requests refresh of the directories, DAMON
    sysfs removes all the region directories first, and then generate updated
    regions directory on the empty space.  The removal function
    (damon_sysfs_scheme_regions_rm_dirs()) only puts the kobj objects.
    Deletion of the container region object from the linked list is done
    inside the kobj release callback function.
    
    If somehow the callback invocation is delayed, the list will contain
    regions list that gonna be freed.  If the updated region directories
    creation is started in this situation, the list can be corrupted and
    use-after-free can happen.
    
    Because the kobj objects are managed by only DAMON sysfs, the issue cannot
    happen in normal situation.  But, such delays can be made on kernels that
    built with CONFIG_DEBUG_KOBJECT_RELEASE.  On the kernel, the issue can
    indeed be reproduced like below.
    
        # damo start --damos_action stat
        # cd /sys/kernel/mm/damon/admin/kdamonds/0/
        # for i in {1..10}; do echo update_schemes_tried_regions > state; done
        # dmesg | grep underflow
        [   89.296152] refcount_t: underflow; use-after-free.
    
    Fix the issue by removing the region object from the list when
    decrementing the reference count.
    
    Also update damos_sysfs_populate_region_dir() to add the region object to
    the list only after the kobject_init_and_add() is success, so that fail of
    kobject_init_and_add() is not leaving the deallocated object on the list.
    
    The issue was discovered [1] by Sashiko.
    
    Link: https://lore.kernel.org/20260518152559.93038-1-sj@kernel.org
    Link: https://lore.kernel.org/20260513011920.119183-1-sj@kernel.org [1]
    Fixes: 9277d0367ba1 ("mm/damon/sysfs-schemes: implement scheme region directory")
    Signed-off-by: SeongJae Park <sj@kernel.org>
    Cc: <stable@vger.kernel.org> # 6.2.x
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/memfd: fix spelling and grammatical issues [+ + +]
Author: Liu Ye <liuye@kylinos.cn>
Date:   Thu Jun 4 09:54:20 2026 -0400

    mm/memfd: fix spelling and grammatical issues
    
    [ Upstream commit 33c9b01ed2fcbc101cdfeb497f4581e981e7c1e7 ]
    
    The comment "If a private mapping then writability is irrelevant" contains
    a typo.  It should be "If a private mapping then writability is
    irrelevant".  The comment "SEAL_EXEC implys SEAL_WRITE, making W^X from
    the start." contains a typo.  It should be "SEAL_EXEC implies SEAL_WRITE,
    making W^X from the start."
    
    Link: https://lkml.kernel.org/r/20250206060958.98010-1-liuye@kylinos.cn
    Signed-off-by: Liu Ye <liuye@kylinos.cn>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Stable-dep-of: 3b041514cb6e ("memfd: deny writeable mappings when implying SEAL_WRITE")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/memory: fix spurious warning when unmapping device-private/exclusive pages [+ + +]
Author: Alistair Popple <apopple@nvidia.com>
Date:   Fri May 29 13:47:59 2026 -0400

    mm/memory: fix spurious warning when unmapping device-private/exclusive pages
    
    [ Upstream commit be3f38d05cc5a7c3f13e51994c5dd043ab604d28 ]
    
    Device private and exclusive entries are only supported for anonymous
    folios.  This condition is tested in __migrate_device_pages() and
    make_device_exclusive() using folio_test_anon().  However the unmap path
    tests this assumption using vma_is_anonymous().
    
    This is wrong because whilst anonymous VMAs can only contain folios where
    folio_test_anon() is true the opposite relation does not hold.  A folio
    for which folio_test_anon() is true does not imply vma_is_anonymous() is
    true.  Such a condition can occur if for example a folio is part of a
    private filebacked mapping.
    
    In this case vma_is_anonymous() is false as the mapping is filebacked, but
    folio_test_anon() may be true, thus permitting devices to migrate the
    folio to device private memory.  This can lead to the following spurious
    warnings during process teardown:
    
    [  772.737706] ------------[ cut here ]------------
    [  772.739201] WARNING: mm/memory.c:1754 at unmap_page_range.cold+0x26/0x18a, CPU#17: hmm-tests/2041
    [  772.742050] Modules linked in: test_hmm nvidia_uvm(O) nvidia(O)
    [  772.743959] CPU: 17 UID: 0 PID: 2041 Comm: hmm-tests Tainted: G        W  O        7.0.0+ #387 PREEMPT(full)
    [  772.747104] Tainted: [W]=WARN, [O]=OOT_MODULE
    [  772.748509] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.17.0-0-gb52ca86e094d-prebuilt.qemu.org 04/01/2014
    [  772.752117] RIP: 0010:unmap_page_range.cold+0x26/0x18a
    [  772.753780] Code: 7e fe ff ff 48 89 4c 24 78 4c 89 44 24 38 e8 f2 ff b1 00 48 8b 4c 24 78 4c 8b 44 24 38 48 8b 44 24 18 48 83 78 48 00 74 04 90 <0f> 0b 90 48 89 ca b8 ff ff 37 00 48 c1 ea 03 48 c1 e0 2a 80 3c 02
    [  772.759602] RSP: 0018:ffff888112607550 EFLAGS: 00010286
    [  772.761310] RAX: ffff88811bbf4dc0 RBX: dffffc0000000000 RCX: ffffea03e9bfffd8
    [  772.763583] RDX: 1ffff1102377e9c1 RSI: 0000000000000008 RDI: ffff88811bbf4e08
    [  772.765914] RBP: 0000000000000006 R08: ffff8881059f7448 R09: ffffed10224c0e68
    [  772.768184] R10: ffff888112607347 R11: 0000000000000001 R12: 0000000000000001
    [  772.770461] R13: ffffea03e9bfffc0 R14: ffff888112607908 R15: ffffea03e9bfffc0
    [  772.772782] FS:  00007f327caa2780(0000) GS:ffff888427b7d000(0000) knlGS:0000000000000000
    [  772.775328] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [  772.777187] CR2: 00007f327ca89000 CR3: 00000001994d5000 CR4: 00000000000006f0
    [  772.779135] Call Trace:
    [  772.779792]  <TASK>
    [  772.780317]  ? dmirror_interval_invalidate+0x1a3/0x290 [test_hmm]
    [  772.781873]  ? vm_normal_page_pud+0x2b0/0x2b0
    [  772.782992]  ? __rwlock_init+0x150/0x150
    [  772.784006]  ? lock_release+0x216/0x2b0
    [  772.785008]  ? __mmu_notifier_invalidate_range_start+0x505/0x6e0
    [  772.786522]  ? lock_release+0x216/0x2b0
    [  772.787498]  ? unmap_single_vma+0xb6/0x210
    [  772.788573]  unmap_vmas+0x27d/0x520
    [  772.789506]  ? unmap_single_vma+0x210/0x210
    [  772.790607]  ? mas_update_gap.part.0+0x620/0x620
    [  772.791834]  unmap_region+0x19e/0x350
    [  772.792769]  ? remove_vma+0x130/0x130
    [  772.793684]  ? mas_alloc_nodes+0x1f2/0x300
    [  772.794730]  vms_complete_munmap_vmas+0x8c1/0xe20
    [  772.795926]  ? unmap_region+0x350/0x350
    [  772.796917]  do_vmi_align_munmap+0x36a/0x4e0
    [  772.798018]  ? lock_release+0x216/0x2b0
    [  772.799024]  ? vma_shrink+0x620/0x620
    [  772.799983]  do_vmi_munmap+0x150/0x2c0
    [  772.800939]  __vm_munmap+0x161/0x2c0
    [  772.801872]  ? expand_downwards+0xd60/0xd60
    [  772.802948]  ? clockevents_program_event+0x1ef/0x540
    [  772.804217]  ? lock_release+0x216/0x2b0
    [  772.805158]  __x64_sys_munmap+0x59/0x80
    [  772.805776]  do_syscall_64+0xfc/0x670
    [  772.806336]  ? irqentry_exit+0xda/0x580
    [  772.806976]  entry_SYSCALL_64_after_hwframe+0x4b/0x53
    [  772.807772] RIP: 0033:0x7f327cbb2717
    [  772.808323] Code: 73 01 c3 48 8b 0d f9 76 0d 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 0b 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d c9 76 0d 00 f7 d8 64 89 01 48
    [  772.811337] RSP: 002b:00007ffde7f57d38 EFLAGS: 00000202 ORIG_RAX: 000000000000000b
    [  772.812564] RAX: ffffffffffffffda RBX: 00007f327cc9c000 RCX: 00007f327cbb2717
    [  772.813733] RDX: 0000000000000000 RSI: 0000000000400000 RDI: 00007f327c289000
    [  772.814867] RBP: 0000000000421360 R08: 000000000000001a R09: 0000000000000000
    [  772.815991] R10: 0000000000000003 R11: 0000000000000202 R12: 00007ffde7f57d74
    [  772.817121] R13: 00007f327c689010 R14: 0000000000100000 R15: 00007f327c289000
    [  772.818272]  </TASK>
    [  772.818614] irq event stamp: 0
    [  772.819159] hardirqs last  enabled at (0): [<0000000000000000>] 0x0
    [  772.820174] hardirqs last disabled at (0): [<ffffffff82a57ab3>] copy_process+0x19f3/0x6440
    [  772.821511] softirqs last  enabled at (0): [<ffffffff82a57b00>] copy_process+0x1a40/0x6440
    [  772.822869] softirqs last disabled at (0): [<0000000000000000>] 0x0
    [  772.823871] ---[ end trace 0000000000000000 ]---
    
    Fix this by using the same check for folio_test_anon() in
    zap_nonpresent_ptes(). Also add a hmm-test case for this.
    
    Link: https://lore.kernel.org/20260501065116.2057242-1-apopple@nvidia.com
    Fixes: 999dad824c39 ("mm/shmem: persist uffd-wp bit across zapping for file-backed")
    Signed-off-by: Alistair Popple <apopple@nvidia.com>
    Reported-by: Arsen Arsenović <aarsenovic@baylibre.com>
    Reviewed-by: Balbir Singh <balbirs@nvidia.com>
    Cc: David Hildenbrand <david@kernel.org>
    Cc: Jason Gunthorpe <jgg@ziepe.ca>
    Cc: John Hubbard <jhubbard@nvidia.com>
    Cc: Leon Romanovsky <leon@kernel.org>
    Cc: Liam R. Howlett <liam@infradead.org>
    Cc: Lorenzo Stoakes <ljs@kernel.org>
    Cc: Peter Xu <peterx@redhat.com>
    Cc: Matthew Brost <matthew.brost@intel.com>
    Cc: Michal Hocko <mhocko@suse.com>
    Cc: Mike Rapoport <rppt@kernel.org>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Suren Baghdasaryan <surenb@google.com>
    Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
    Cc: Vlastimil Babka <vbabka@kernel.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    [ applied the change in `zap_pte_range()` instead of `zap_nonpresent_ptes()` ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/page_alloc: clear page->private in free_pages_prepare() [+ + +]
Author: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Date:   Fri May 29 13:02:30 2026 +0800

    mm/page_alloc: clear page->private in free_pages_prepare()
    
    [ Upstream commit ac1ea219590c09572ed5992dc233bbf7bb70fef9 ]
    
    Several subsystems (slub, shmem, ttm, etc.) use page->private but don't
    clear it before freeing pages.  When these pages are later allocated as
    high-order pages and split via split_page(), tail pages retain stale
    page->private values.
    
    This causes a use-after-free in the swap subsystem.  The swap code uses
    page->private to track swap count continuations, assuming freshly
    allocated pages have page->private == 0.  When stale values are present,
    swap_count_continued() incorrectly assumes the continuation list is valid
    and iterates over uninitialized page->lru containing LIST_POISON values,
    causing a crash:
    
      KASAN: maybe wild-memory-access in range [0xdead000000000100-0xdead000000000107]
      RIP: 0010:__do_sys_swapoff+0x1151/0x1860
    
    Fix this by clearing page->private in free_pages_prepare(), ensuring all
    freed pages have clean state regardless of previous use.
    
    Link: https://lkml.kernel.org/r/20260207173615.146159-1-mikhail.v.gavrilov@gmail.com
    Fixes: 3b8000ae185c ("mm/vmalloc: huge vmalloc backing pages should be split rather than compound")
    Signed-off-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
    Suggested-by: Zi Yan <ziy@nvidia.com>
    Acked-by: Zi Yan <ziy@nvidia.com>
    Acked-by: David Hildenbrand (Arm) <david@kernel.org>
    Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
    Cc: Brendan Jackman <jackmanb@google.com>
    Cc: Chris Li <chrisl@kernel.org>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Kairui Song <ryncsn@gmail.com>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Michal Hocko <mhocko@suse.com>
    Cc: Nicholas Piggin <npiggin@gmail.com>
    Cc: Suren Baghdasaryan <surenb@google.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    [backport: context only]
    Signed-off-by: Li Wang <li.wang@windriver.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
mm: perform all memfd seal checks in a single place [+ + +]
Author: Lorenzo Stoakes <ljs@kernel.org>
Date:   Thu Jun 4 09:54:19 2026 -0400

    mm: perform all memfd seal checks in a single place
    
    [ Upstream commit fa00b8ef1803fe133b4897c25227aa0d298dd093 ]
    
    We no longer actually need to perform these checks in the f_op->mmap()
    hook any longer.
    
    We already moved the operation which clears VM_MAYWRITE on a read-only
    mapping of a write-sealed memfd in order to work around the restrictions
    imposed by commit 5de195060b2e ("mm: resolve faulty mmap_region() error
    path behaviour").
    
    There is no reason for us not to simply go ahead and additionally check to
    see if any pre-existing seals are in place here rather than defer this to
    the f_op->mmap() hook.
    
    By doing this we remove more logic from shmem_mmap() which doesn't belong
    there, as well as doing the same for hugetlbfs_file_mmap().  We also
    remove dubious shared logic in mm.h which simply does not belong there
    either.
    
    It makes sense to do these checks at the earliest opportunity, we know
    these are shmem (or hugetlbfs) mappings whose relevant VMA flags will not
    change from the invoking do_mmap() so there is simply no need to wait.
    
    This also means the implementation of further memfd seal flags can be done
    within mm/memfd.c and also have the opportunity to modify VMA flags as
    necessary early in the mapping logic.
    
    [lorenzo.stoakes@oracle.com: fix typos in !memfd inline stub]
      Link: https://lkml.kernel.org/r/7dee6c5d-480b-4c24-b98e-6fa47dbd8a23@lucifer.local
    Link: https://lkml.kernel.org/r/20241206212846.210835-1-lorenzo.stoakes@oracle.com
    Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
    Tested-by: Isaac J. Manjarres <isaacmanjarres@google.com>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Jann Horn <jannh@google.com>
    Cc: Kalesh Singh <kaleshsingh@google.com>
    Cc: Liam R. Howlett <Liam.Howlett@Oracle.com>
    Cc: Muchun Song <muchun.song@linux.dev>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Jeff Xu <jeffxu@chromium.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Stable-dep-of: 3b041514cb6e ("memfd: deny writeable mappings when implying SEAL_WRITE")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mptcp: cleanup fallback dummy mapping generation [+ + +]
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Sat May 30 07:50:51 2026 -0400

    mptcp: cleanup fallback dummy mapping generation
    
    [ Upstream commit 2834f8edd74d5dda368087a654c0e52b141e9893 ]
    
    MPTCP currently access ack_seq outside the msk socket log scope to
    generate the dummy mapping for fallback socket. Soon we are going
    to introduce backlog usage and even for fallback socket the ack_seq
    value will be significantly off outside of the msk socket lock scope.
    
    Avoid relying on ack_seq for dummy mapping generation, using instead
    the subflow sequence number. Note that in case of disconnect() and
    (re)connect() we must ensure that any previous state is re-set.
    
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Reviewed-by: Geliang Tang <geliang@kernel.org>
    Tested-by: Geliang Tang <geliang@kernel.org>
    Reviewed-by: Mat Martineau <martineau@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://patch.msgid.link/20251121-net-next-mptcp-memcg-backlog-imp-v1-6-1f34b6c1e0b1@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: 0981f90e1a05 ("mptcp: reset rcv wnd on disconnect")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mptcp: do not drop partial packets [+ + +]
Author: Shardul Bankar <shardul.b@mpiricsoftware.com>
Date:   Sat May 30 10:19:32 2026 -0400

    mptcp: do not drop partial packets
    
    [ Upstream commit 50c2d91c5dfa0e465826ec1f8dbad9cdc254bd85 ]
    
    When a packet arrives with map_seq < ack_seq < end_seq, the beginning
    of the packet has already been acknowledged but the end contains new
    data. Currently the entire packet is dropped as "old data," forcing
    the sender to retransmit.
    
    Instead, skip the already-acked bytes by adjusting the skb offset and
    enqueue only the new portion. Update bytes_received and ack_seq to
    reflect the new data consumed.
    
    A previous attempt at this fix has been sent by Paolo Abeni [1], but had
    issues [2]: it also added a zero-window check and changed rcv_wnd_sent
    initialization, which caused test regressions. This version addresses
    only the partial packet handling without modifying receive window
    accounting.
    
    Fixes: ab174ad8ef76 ("mptcp: move ooo skbs into msk out of order queue.")
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/c9b426a4e163aa3c4fe8b80c79f1a610f47ae7d8.1763075056.git.pabeni@redhat.com [1]
    Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/600 [2]
    Signed-off-by: Shardul Bankar <shardul.b@mpiricsoftware.com>
    [pabeni@redhat.com: update map]
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://patch.msgid.link/20260515-net-mptcp-misc-fixes-7-1-rc4-v2-1-701e96419f2f@kernel.org
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mptcp: handle first subflow closing consistently [+ + +]
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Sat May 30 10:19:31 2026 -0400

    mptcp: handle first subflow closing consistently
    
    [ Upstream commit 0eeb372deebce6c25b9afc09e35d6c75a744299a ]
    
    Currently, as soon as the PM closes a subflow, the msk stops accepting
    data from it, even if the TCP socket could be still formally open in the
    incoming direction, with the notable exception of the first subflow.
    
    The root cause of such behavior is that code currently piggy back two
    separate semantic on the subflow->disposable bit: the subflow context
    must be released and that the subflow must stop accepting incoming
    data.
    
    The first subflow is never disposed, so it also never stop accepting
    incoming data. Use a separate bit to mark the latter status and set such
    bit in __mptcp_close_ssk() for all subflows.
    
    Beyond making per subflow behaviour more consistent this will also
    simplify the next patch.
    
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Reviewed-by: Mat Martineau <martineau@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://patch.msgid.link/20251121-net-next-mptcp-memcg-backlog-imp-v1-11-1f34b6c1e0b1@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: 50c2d91c5dfa ("mptcp: do not drop partial packets")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mptcp: introduce the mptcp_init_skb helper [+ + +]
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Sat May 30 10:19:30 2026 -0400

    mptcp: introduce the mptcp_init_skb helper
    
    [ Upstream commit 9a0afe0db46720ce1a009c7dac168aa0584bd732 ]
    
    Factor out all the skb initialization step in a new helper and
    use it. Note that this change moves the MPTCP CB initialization
    earlier: we can do such step as soon as the skb leaves the
    subflow socket receive queues.
    
    Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Reviewed-by: Geliang Tang <geliang@kernel.org>
    Tested-by: Geliang Tang <geliang@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://patch.msgid.link/20250927-net-next-mptcp-rcv-path-imp-v1-4-5da266aa9c1a@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: 50c2d91c5dfa ("mptcp: do not drop partial packets")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mptcp: pm: fix ADD_ADDR timer infinite retry on option space insufficient [+ + +]
Author: Li Xiasong <lixiasong1@huawei.com>
Date:   Fri May 29 20:50:21 2026 -0400

    mptcp: pm: fix ADD_ADDR timer infinite retry on option space insufficient
    
    [ Upstream commit 51e398a3b8961b26a8c0a4ba9a777c5339791707 ]
    
    When TCP option space is insufficient (e.g., when sending ADD_ADDR with an
    IPv6 address and port while tcp_timestamps is enabled), the original code
    jumped to out_unlock without clearing the addr_signal flag. This caused
    mptcp_pm_add_timer to keep rescheduling indefinitely, not sending ADD_ADDR,
    preventing subsequent addresses in the endpoint list from being announced.
    
    Handle this case by clearing the ADD_ADDR signal and skipping the matching
    ADD_ADDR retransmission entry. The skip path cancels the matching timer
    (with id check) and advances PM state progression, preserving forward
    progress to subsequent PM work.
    
    This cancellation is inherently best-effort. A concurrent add_timer
    callback may already be running and may acquire pm.lock before the
    cancel path updates entry state. In that case, one final ADD_ADDR
    transmit attempt can still be executed.
    
    Once the cancel path sets entry->retrans_times to ADD_ADDR_RETRANS_MAX,
    the callback-side retrans_times check suppresses further ADD_ADDR
    retransmissions.
    
    Note that when an ADD_ADDR is being prepared, a pure-ACK is queued. On
    the output side, it means that it is fine to skip non-pure-ACK packets,
    when drop_other_suboptions is set: a pure-ACK will be processed soon
    after.
    
    Fixes: 00cfd77b9063 ("mptcp: retransmit ADD_ADDR when timeout")
    Cc: stable@vger.kernel.org
    Signed-off-by: Li Xiasong <lixiasong1@huawei.com>
    Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://patch.msgid.link/20260515-net-mptcp-misc-fixes-7-1-rc4-v2-2-701e96419f2f@kernel.org
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mptcp: reset rcv wnd on disconnect [+ + +]
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Sat May 30 07:50:52 2026 -0400

    mptcp: reset rcv wnd on disconnect
    
    [ Upstream commit 0981f90e1a05773a4c29c6e720f5ea1e3c8f1876 ]
    
    If the MPTCP socket fallback to TCP before the MP handshake completion,
    the IASN remain 0, and the rcv_wnd_sent field is not explicitly
    initialized, just incremented over time with the data transfer.
    
    At disconnect time such value is not cleared. If the next connection falls
    back to TCP before the MP handshake completion, the data transfer will
    keep incrementing the receive window end sequence starting from the last
    value used in the previous connection: the announced window will be
    unrelated from the actual receiver buffer size and likely too big.
    
    Address the issue zeroing the field at disconnect time.
    
    Fixes: b29fcfb54cd7 ("mptcp: full disconnect implementation")
    Cc: stable@vger.kernel.org
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://patch.msgid.link/20260515-net-mptcp-misc-fixes-7-1-rc4-v2-4-701e96419f2f@kernel.org
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
net/handshake: Drain pending requests at net namespace exit [+ + +]
Author: Chuck Lever <chuck.lever@oracle.com>
Date:   Mon May 25 12:51:22 2026 -0400

    net/handshake: Drain pending requests at net namespace exit
    
    [ Upstream commit ea5fe6a73ca57e5150b8a38b341aef2636eb72f0 ]
    
    The arguments to list_splice_init() in handshake_net_exit() are
    reversed. The call moves the local empty "requests" list onto
    hn->hn_requests, leaving the local list empty, so the subsequent
    drain loop runs zero iterations. Pending handshake requests that
    had not yet been accepted are not torn down when the net namespace
    is destroyed; each one keeps a reference on a socket file and on
    the handshake_req allocation.
    
    Pass the source and destination in the documented order
    (list_splice_init(list, head) moves list onto head) so the pending
    list is transferred to the local scratch list and drained through
    handshake_complete().
    
    Fixing the splice direction exposes a list-corruption race. After
    the splice each req->hr_list still has non-empty link pointers,
    threading the stack-local scratch list rather than hn_requests.
    A concurrent handshake_req_cancel() -- for example, from sunrpc's
    TLS timeout on a kernel socket whose netns reference was not
    taken -- finds the request through the rhashtable, calls
    remove_pending(), and sees !list_empty(&req->hr_list).
    __remove_pending_locked() then list_del_init()s an entry off the
    scratch list while the drain iterates, corrupting it. The same
    call arriving after the drain loop has run list_del() on an
    entry hits LIST_POISON instead.
    
    Have remove_pending() check HANDSHAKE_F_NET_DRAINING under
    hn_lock and report not-found when drain is in progress. The
    drain has already taken ownership; handshake_complete()'s existing
    test_and_set on HANDSHAKE_F_REQ_COMPLETED still arbitrates
    between drain and cancel for who calls the consumer's hp_done. Use
    list_del_init() rather than list_del() in the drain so req->hr_list
    does not carry LIST_POISON after drain releases the entry.
    
    The DRAINING guard in remove_pending() makes cancel return false,
    but cancel still falls through to test_and_set_bit on
    HANDSHAKE_F_REQ_COMPLETED and drops the request's hr_file reference.
    Without another pin, if that is the last reference, sk_destruct frees
    the request while it is still linked on the drain loop's local list.
    Pin each request's hr_file under hn_lock before releasing the list,
    and drop that drain pin after the loop finishes with the request.
    
    Fixes: 3b3009ea8abb ("net/handshake: Create a NETLINK service for handling handshake requests")
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Reviewed-by: Hannes Reinecke <hare@kernel.org>
    Link: https://patch.msgid.link/20260525-handshake-file-pin-v3-8-66c616906ead@oracle.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/handshake: Pass negative errno through handshake_complete() [+ + +]
Author: Chuck Lever <chuck.lever@oracle.com>
Date:   Mon May 25 12:51:17 2026 -0400

    net/handshake: Pass negative errno through handshake_complete()
    
    [ Upstream commit 6b22d433aa13f68e3cd9534ca9a5f4277bfa01c2 ]
    
    handshake_complete() declares status as unsigned int and
    tls_handshake_done() negates that value (-status) before handing
    it to the TLS consumer. Consumers match on negative errno
    constants -- xs_tls_handshake_done() has
    
            switch (status) {
            case 0:
            case -EACCES:
            case -ETIMEDOUT:
                    lower_transport->xprt_err = status;
                    break;
            default:
                    lower_transport->xprt_err = -EACCES;
            }
    
    so the API as designed expects callers to pass positive errno
    values that the tlshd shim then negates.
    
    Three internal callers in handshake_nl_accept_doit(), the
    net-exit drain, and a kunit test follow kernel convention and
    pass negative errnos -- -EIO, -ETIMEDOUT, -ETIMEDOUT. The
    implicit conversion to unsigned int turns -ETIMEDOUT into
    0xFFFFFF92; the subsequent -status in tls_handshake_done()
    wraps back to 110, the consumer's switch falls through, and
    the xprt reports -EACCES on what should be -ETIMEDOUT or -EIO.
    
    Fix the API rather than the call sites. The natural kernel
    convention is negative errno in, negative errno out. Change
    handshake_complete() and hp_done to take int status, drop the
    negation in tls_handshake_done(), and negate once in
    handshake_nl_done_doit() where status arrives from the wire
    as an unsigned netlink attribute. The three internal callers
    were already correct under that convention and need no change.
    
    At the same wire boundary, declare MAX_ERRNO as the netlink
    policy upper bound for HANDSHAKE_A_DONE_STATUS. Attribute
    validation rejects out-of-range values before
    handshake_nl_done_doit() runs, and negating a bounded u32 there
    stays within int range -- closing the UBSAN-visible signed-
    integer overflow that an unconstrained u32 would invoke.
    
    Fixes: 3b3009ea8abb ("net/handshake: Create a NETLINK service for handling handshake requests")
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Reviewed-by: Hannes Reinecke <hare@kernel.org>
    Link: https://patch.msgid.link/20260525-handshake-file-pin-v3-3-66c616906ead@oracle.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/handshake: Take a long-lived file reference at submit [+ + +]
Author: Chuck Lever <chuck.lever@oracle.com>
Date:   Mon May 25 12:51:18 2026 -0400

    net/handshake: Take a long-lived file reference at submit
    
    [ Upstream commit 09dba37eee70d0596e26645015f1aa95a9848e9d ]
    
    handshake_nl_accept_doit() needs the file pointer backing
    req->hr_sk->sk_socket to survive the window between
    handshake_req_next() and the subsequent FD_PREPARE() and get_file().
    The submit-side sock_hold() does not provide that.  sk_refcnt keeps
    struct sock alive, but struct socket is owned by sock->file: when
    the consumer fputs the last file reference, sock_release() tears
    the socket down regardless of any sock_hold.
    
    Add an hr_file pointer to struct handshake_req and acquire an
    explicit reference on sock->file during handshake_req_submit().
    handshake_complete() and handshake_req_cancel() release the
    reference on the completion-bit-winning path.
    
    The submit error path must also release the file reference, but
    after rhashtable insertion a concurrent handshake_req_cancel() can
    discover the request and race the error path.  Gate the error-path
    cleanup -- sk_destruct restoration, fput, and request destruction
    -- with test_and_set_bit(HANDSHAKE_F_REQ_COMPLETED), the same
    serialization handshake_complete() and handshake_req_cancel()
    already use.  When cancel has already claimed ownership, the submit
    error path returns without touching the request; socket teardown
    handles final destruction.
    
    The accept-side dereferences are not yet retargeted; that change
    comes in the next patch.
    
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Link: https://patch.msgid.link/20260525-handshake-file-pin-v3-4-66c616906ead@oracle.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Stable-dep-of: ea5fe6a73ca5 ("net/handshake: Drain pending requests at net namespace exit")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/handshake: Use spin_lock_bh for hn_lock [+ + +]
Author: Chuck Lever <chuck.lever@oracle.com>
Date:   Mon May 25 12:51:15 2026 -0400

    net/handshake: Use spin_lock_bh for hn_lock
    
    [ Upstream commit cc993e0927ec8bd98ea33377ada03295fcda0f24 ]
    
    nvmet_tcp_state_change(), a socket callback that runs in BH context,
    can reach handshake_req_cancel() via nvmet_tcp_schedule_release_queue()
    and tls_handshake_cancel().  handshake_req_cancel() acquires
    hn->hn_lock with plain spin_lock().  If a process-context thread on
    the same CPU holds hn->hn_lock when a softirq invokes the cancel path,
    the lock attempt deadlocks.  This is the only caller that invokes
    tls_handshake_cancel() from BH context; every other consumer calls it
    from process context.
    
    Deferring the cancel to process context in the NVMe target is not
    straightforward: nvmet_tcp_schedule_release_queue() must call
    tls_handshake_cancel() atomically with its state transition to
    DISCONNECTING.  If the cancel were deferred, the handshake completion
    callback could fire in the window before the cancel runs, observe the
    unexpected state, and return without dropping its kref on the queue.
    Reworking that interlock is considerably more invasive than hardening
    the handshake lock.  Convert all hn->hn_lock acquisitions from
    spin_lock/spin_unlock to spin_lock_bh/spin_unlock_bh so the lock is
    never taken with softirqs enabled.
    
    Fixes: 675b453e0241 ("nvmet-tcp: enable TLS handshake upcall")
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Reviewed-by: Hannes Reinecke <hare@kernel.org>
    Link: https://patch.msgid.link/20260525-handshake-file-pin-v3-1-66c616906ead@oracle.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net/iucv: fix locking in .getsockopt [+ + +]
Author: Breno Leitao <leitao@debian.org>
Date:   Thu May 21 07:11:45 2026 -0700

    net/iucv: fix locking in .getsockopt
    
    [ Upstream commit 3589d20a666caf30ad100c960a2de7de390fce88 ]
    
    Mirror iucv_sock_setsockopt() and wrap the whole switch in
    lock_sock()/release_sock(). The pre-existing SO_MSGLIMIT-only lock
    becomes redundant and is removed.
    
    Any AF_IUCV HIPER user can potentially crash the kernel by racing
    recvmsg() with getsockopt(SO_MSGSIZE): the SO_MSGSIZE arm dereferences
    iucv->hs_dev->mtu after iucv_sock_close() (called from the racing
    recvmsg()) has set hs_dev to NULL, producing a NULL pointer dereference
    oops.
    
    Suggested-by: Stanislav Fomichev <sdf.kernel@gmail.com>
    Fixes: 51363b8751a6 ("af_iucv: allow retrieval of maximum message size")
    Signed-off-by: Breno Leitao <leitao@debian.org>
    Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
    Tested-by: Alexandra Winter <wintera@linux.ibm.com>
    Link: https://patch.msgid.link/20260521-af_iucv_fix2-v1-1-f16b1c510aa9@debian.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net/sched: act_mirred: add loop detection [+ + +]
Author: Eric Dumazet <edumazet@google.com>
Date:   Tue Oct 14 17:19:04 2025 +0000

    net/sched: act_mirred: add loop detection
    
    [ Upstream commit fe946a751d9b52b7c45ca34899723b314b79b249 ]
    
    Commit 0f022d32c3ec ("net/sched: Fix mirred deadlock on device recursion")
    added code in the fast path, even when act_mirred is not used.
    
    Prepare its revert by implementing loop detection in act_mirred.
    
    Adds an array of device pointers in struct netdev_xmit.
    
    tcf_mirred_is_act_redirect() can detect if the array
    already contains the target device.
    
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
    Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com>
    Tested-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Link: https://patch.msgid.link/20251014171907.3554413-4-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: e80ad525fc7e ("net/sched: act_mirred: Fix return code in early mirred redirect error paths")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/sched: act_mirred: Fix blockcast recursion bypass leading to stack overflow [+ + +]
Author: Kito Xu (veritas501) <hxzene@gmail.com>
Date:   Mon May 25 08:25:53 2026 -0400

    net/sched: act_mirred: Fix blockcast recursion bypass leading to stack overflow
    
    commit a005fa5d7502eefec7ee6e1c01adadc06de2f9ad upstream.
    
    tcf_mirred_act() checks sched_mirred_nest against MIRRED_NEST_LIMIT (4)
    to prevent deep recursion.  However, when the action uses blockcast
    (tcfm_blockid != 0), the function returns at the tcf_blockcast() call
    BEFORE reaching the counter increment.  As a result, the recursion
    counter never advances and the limit check is entirely bypassed.
    
    When two devices share a TC egress block with a mirred blockcast rule,
    a packet egressing on device A is mirrored to device B via blockcast;
    device B's egress TC re-enters tcf_mirred_act() via blockcast and
    mirrors back to A, creating an unbounded recursion loop:
    
      tcf_mirred_act -> tcf_blockcast -> tcf_mirred_to_dev -> dev_queue_xmit
      -> sch_handle_egress -> tcf_classify -> tcf_mirred_act -> (repeat)
    
    This recursion continues until the kernel stack overflows.
    
    The bug is reachable from an unprivileged user via
    unshare(CLONE_NEWUSER | CLONE_NEWNET): user namespaces grant
    CAP_NET_ADMIN in the new network namespace, which is sufficient to
    create dummy devices, attach clsact qdiscs with shared blocks, and
    install mirred blockcast filters.
    
     BUG: TASK stack guard page was hit at ffffc90000b7fff8
     Oops: stack guard page: 0000 [#1] SMP KASAN NOPTI
     CPU: 2 UID: 1000 PID: 169 Comm: poc Not tainted 7.0.0-rc7-next-20260410
     RIP: 0010:xas_find+0x17/0x480
     Call Trace:
      xa_find+0x17b/0x1d0
      tcf_mirred_act+0x640/0x1060
      tcf_action_exec+0x400/0x530
      basic_classify+0x128/0x1d0
      tcf_classify+0xd83/0x1150
      tc_run+0x328/0x620
      __dev_queue_xmit+0x797/0x3100
      tcf_mirred_to_dev+0x7b1/0xf70
      tcf_mirred_act+0x68a/0x1060
      [repeating ~30+ times until stack overflow]
     Kernel panic - not syncing: Fatal exception in interrupt
    
    Fix this by incrementing sched_mirred_nest before calling
    tcf_blockcast() and decrementing it on return, mirroring the
    non-blockcast path.  This ensures subsequent recursive entries see the
    updated counter and are correctly limited by MIRRED_NEST_LIMIT.
    
    Fixes: fe946a751d9b ("net/sched: act_mirred: add loop detection")
    Signed-off-by: Kito Xu (veritas501) <hxzene@gmail.com>
    Link: https://patch.msgid.link/20260525122556.973584-7-jhs@mojatatu.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net/sched: act_mirred: Fix return code in early mirred redirect error paths [+ + +]
Author: Victor Nogueira <victor@mojatatu.com>
Date:   Mon May 25 08:25:54 2026 -0400

    net/sched: act_mirred: Fix return code in early mirred redirect error paths
    
    [ Upstream commit e80ad525fc7e8c933ad78478c5dda286cfd55c60 ]
    
    Since retval is set as TC_ACT_STOLEN in the mirred redirect case, returning
    retval in cases where redirect failed will make the callers not register
    the skb as being dropped.
    
    Fix this by returning TC_ACT_SHOT instead in such scenarios.
    
    Fixes: 16085e48cb48 ("net/sched: act_mirred: Create function tcf_mirred_to_dev and improve readability")
    Reported-by: Sashiko <sashiko-bot@kernel.org>
    Closes: https://sashiko.dev/#/patchset/20260413082027.2244884-1-hxzene%40gmail.com
    Signed-off-by: Victor Nogueira <victor@mojatatu.com>
    Link: https://patch.msgid.link/20260525122556.973584-8-jhs@mojatatu.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/sched: act_mirred: Move the recursion counter struct netdev_xmit [+ + +]
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date:   Mon May 12 11:27:31 2025 +0200

    net/sched: act_mirred: Move the recursion counter struct netdev_xmit
    
    [ Upstream commit 7fe70c06a182a140be9996b02256d907e114479a ]
    
    mirred_nest_level is a per-CPU variable and relies on disabled BH for its
    locking. Without per-CPU locking in local_bh_disable() on PREEMPT_RT
    this data structure requires explicit locking.
    
    Move mirred_nest_level to struct netdev_xmit as u8, provide wrappers.
    
    Cc: Jamal Hadi Salim <jhs@mojatatu.com>
    Cc: Cong Wang <xiyou.wangcong@gmail.com>
    Cc: Jiri Pirko <jiri@resnulli.us>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Reviewed-by: Juri Lelli <juri.lelli@redhat.com>
    Link: https://patch.msgid.link/20250512092736.229935-11-bigeasy@linutronix.de
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Stable-dep-of: e80ad525fc7e ("net/sched: act_mirred: Fix return code in early mirred redirect error paths")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/sched: cls_fw: fix NULL dereference of "old" filters before change() [+ + +]
Author: Davide Caratti <dcaratti@redhat.com>
Date:   Wed Apr 8 17:24:36 2026 +0200

    net/sched: cls_fw: fix NULL dereference of "old" filters before change()
    
    [ Upstream commit 65782b2db7321d5f97c16718c4c7f6c7205a56be ]
    
    Like pointed out by Sashiko [1], since commit ed76f5edccc9 ("net: sched:
    protect filter_chain list with filter_chain_lock mutex") TC filters are
    added to a shared block and published to datapath before their ->change()
    function is called. This is a problem for cls_fw: an invalid filter
    created with the "old" method can still classify some packets before it
    is destroyed by the validation logic added by Xiang.
    Therefore, insisting with repeated runs of the following script:
    
     # ip link add dev crash0 type dummy
     # ip link set dev crash0 up
     # mausezahn  crash0 -c 100000 -P 10 \
     > -A 4.3.2.1 -B 1.2.3.4 -t udp "dp=1234" -q &
     # sleep 1
     # tc qdisc add dev crash0 egress_block 1 clsact
     # tc filter add block 1 protocol ip prio 1 matchall \
     > action skbedit mark 65536 continue
     # tc filter add block 1 protocol ip prio 2 fw
     # ip link del dev crash0
    
    can still make fw_classify() hit the WARN_ON() in [2]:
    
     WARNING: ./include/net/pkt_cls.h:88 at fw_classify+0x244/0x250 [cls_fw], CPU#18: mausezahn/1399
     Modules linked in: cls_fw(E) act_skbedit(E)
     CPU: 18 UID: 0 PID: 1399 Comm: mausezahn Tainted: G            E       7.0.0-rc6-virtme #17 PREEMPT(full)
     Tainted: [E]=UNSIGNED_MODULE
     Hardware name: Red Hat KVM, BIOS 1.16.3-2.el9 04/01/2014
     RIP: 0010:fw_classify+0x244/0x250 [cls_fw]
     Code: 5c 49 c7 45 00 00 00 00 00 41 5d 41 5e 41 5f 5d c3 cc cc cc cc 5b b8 ff ff ff ff 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc 90 <0f> 0b 90 eb a0 0f 1f 80 00 00 00 00 90 90 90 90 90 90 90 90 90 90
     RSP: 0018:ffffd1b7026bf8a8 EFLAGS: 00010202
     RAX: ffff8c5ac9c60800 RBX: ffff8c5ac99322c0 RCX: 0000000000000004
     RDX: 0000000000000001 RSI: ffff8c5b74d7a000 RDI: ffff8c5ac8284f40
     RBP: ffffd1b7026bf8d0 R08: 0000000000000000 R09: ffffd1b7026bf9b0
     R10: 00000000ffffffff R11: 0000000000000000 R12: 0000000000010000
     R13: ffffd1b7026bf930 R14: ffff8c5ac8284f40 R15: 0000000000000000
     FS:  00007fca40c37740(0000) GS:ffff8c5b74d7a000(0000) knlGS:0000000000000000
     CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
     CR2: 00007fca40e822a0 CR3: 0000000005ca0001 CR4: 0000000000172ef0
     Call Trace:
      <TASK>
      tcf_classify+0x17d/0x5c0
      tc_run+0x9d/0x150
      __dev_queue_xmit+0x2ab/0x14d0
      ip_finish_output2+0x340/0x8f0
      ip_output+0xa4/0x250
      raw_sendmsg+0x147d/0x14b0
      __sys_sendto+0x1cc/0x1f0
      __x64_sys_sendto+0x24/0x30
      do_syscall_64+0x126/0xf80
      entry_SYSCALL_64_after_hwframe+0x77/0x7f
     RIP: 0033:0x7fca40e822ba
     Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb b8 0f 1f 00 f3 0f 1e fa 41 89 ca 64 8b 04 25 18 00 00 00 85 c0 75 15 b8 2c 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 7e c3 0f 1f 44 00 00 41 54 48 83 ec 30 44 89
     RSP: 002b:00007ffc248a42c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
     RAX: ffffffffffffffda RBX: 000055ef233289d0 RCX: 00007fca40e822ba
     RDX: 000000000000001e RSI: 000055ef23328c30 RDI: 0000000000000003
     RBP: 000055ef233289d0 R08: 00007ffc248a42d0 R09: 0000000000000010
     R10: 0000000000000000 R11: 0000000000000246 R12: 000000000000001e
     R13: 00000000000186a0 R14: 0000000000000000 R15: 00007fca41043000
      </TASK>
     irq event stamp: 1045778
     hardirqs last  enabled at (1045784): [<ffffffff864ec042>] __up_console_sem+0x52/0x60
     hardirqs last disabled at (1045789): [<ffffffff864ec027>] __up_console_sem+0x37/0x60
     softirqs last  enabled at (1045426): [<ffffffff874d48c7>] __alloc_skb+0x207/0x260
     softirqs last disabled at (1045434): [<ffffffff874fe8f8>] __dev_queue_xmit+0x78/0x14d0
    
    Then, because of the value in the packet's mark, dereference on 'q->handle'
    with NULL 'q' occurs:
    
     BUG: kernel NULL  pointer dereference, address: 0000000000000038
     [...]
     RIP: 0010:fw_classify+0x1fe/0x250 [cls_fw]
     [...]
    
    Skip "old-style" classification on shared blocks, so that the NULL
    dereference is fixed and WARN_ON() is not hit anymore in the short
    lifetime of invalid cls_fw "old-style" filters.
    
    [1] https://sashiko.dev/#/patchset/20260331050217.504278-1-xmei5%40asu.edu
    [2] https://elixir.bootlin.com/linux/v7.0-rc6/source/include/net/pkt_cls.h#L86
    
    Fixes: faeea8bbf6e9 ("net/sched: cls_fw: fix NULL pointer dereference on shared blocks")
    Fixes: ed76f5edccc9 ("net: sched: protect filter_chain list with filter_chain_lock mutex")
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: Davide Caratti <dcaratti@redhat.com>
    Link: https://patch.msgid.link/e39cbd3103a337f1e515d186fe697b4459d24757.1775661704.git.dcaratti@redhat.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/sched: Fix ethx:ingress -> ethy:egress -> ethx:ingress mirred loop [+ + +]
Author: Jamal Hadi Salim <jhs@mojatatu.com>
Date:   Mon May 25 08:25:52 2026 -0400

    net/sched: Fix ethx:ingress -> ethy:egress -> ethx:ingress mirred loop
    
    [ Upstream commit db875221ab08d213a83bf30196ae8b64d55a3403 ]
    
    When mirred redirects to ingress (from either ingress or egress) the loop
    state from sched_mirred_dev array dev is lost because of 1) the packet
    deferral into the backlog and 2) the fact the sched_mirred_dev array is
    cleared. In such cases, if there was a loop we won't discover it.
    
    Here's a simple test to reproduce:
    ip a add dev port0 10.10.10.11/24
    
    tc qdisc add dev port0 clsact
    tc filter add dev port0 egress protocol ip \
       prio 10 matchall action mirred ingress redirect dev port1
    
    tc qdisc add dev port1 clsact
    tc filter add dev port1 ingress protocol ip \
       prio 10 matchall action mirred egress redirect dev port0
    
    ping -c 1 -W0.01 10.10.10.10
    
    Fixes: fe946a751d9b ("net/sched: act_mirred: add loop detection")
    Tested-by: Victor Nogueira <victor@mojatatu.com>
    Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
    Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Link: https://patch.msgid.link/20260525122556.973584-6-jhs@mojatatu.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Stable-dep-of: e80ad525fc7e ("net/sched: act_mirred: Fix return code in early mirred redirect error paths")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/sched: fix packet loop on netem when duplicate is on [+ + +]
Author: Jamal Hadi Salim <jhs@mojatatu.com>
Date:   Mon May 25 08:25:51 2026 -0400

    net/sched: fix packet loop on netem when duplicate is on
    
    [ Upstream commit 9552b11e3edabc97cfcd9f29103d5afbce7ae183 ]
    
    When netem duplicates a packet it re-enqueues the copy at the root qdisc.
    If another netem sits in the tree the copy can be duplicated
    again, recursing until the stack or memory is exhausted.
    
    The original duplication guard temporarily zeroed q->duplicate around
    the re-enqueue, but that does not cover all cases because it is
    per-qdisc state shared across all concurrent enqueue paths
    and is not safe without additional locking.
    
    Use the skb tc_depth field introduced in an earlier patch:
     - increment it on the duplicate before re-enqueue
     - skip duplication for any skb whose tc_depth is already non-zero.
    
    This marks the packet itself rather than mutating qdisc state,
    therefore it is safe regardless of tree topology or concurrency.
    
    Fixes: 0afb51e72855 ("[PKT_SCHED]: netem: reinsert for duplication")
    Reported-by: William Liu <will@willsroot.io>
    Reported-by: Savino Dicanosa <savy@syst3mfailure.io>
    Closes: https://lore.kernel.org/netdev/8DuRWwfqjoRDLDmBMlIfbrsZg9Gx50DHJc1ilxsEBNe2D6NMoigR_eIRIG0LOjMc3r10nUUZtArXx4oZBIdUfZQrwjcQhdinnMis_0G7VEk=@willsroot.io/
    Co-developed-by: Victor Nogueira <victor@mojatatu.com>
    Signed-off-by: Victor Nogueira <victor@mojatatu.com>
    Reviewed-by: William Liu <will@willsroot.io>
    Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
    Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Link: https://patch.msgid.link/20260525122556.973584-5-jhs@mojatatu.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/sched: Revert "net/sched: Restrict conditions for adding duplicating netems to qdisc tree" [+ + +]
Author: Jamal Hadi Salim <jhs@mojatatu.com>
Date:   Mon May 25 08:25:49 2026 -0400

    net/sched: Revert "net/sched: Restrict conditions for adding duplicating netems to qdisc tree"
    
    [ Upstream commit eda0b7f203bb166c98d1418b204135bd566ac83b ]
    
    This reverts commit ec8e0e3d7adef940cdf9475e2352c0680189d14e.
    
    The original patch rejects any tree containing two netems when
    either has duplication set, even when they sit on unrelated classes
    of the same classful parent. That broke configurations that have
    worked since netem was introduced.
    
    The re-entrancy problem the original commit was trying to solve is
    handled by later patch using tc_depth flag.
    
    Doing this revert will (re)expose the original bug with multiple
    netem duplication. When this patch is backported make sure
    and get the full series.
    
    Fixes: ec8e0e3d7ade ("net/sched: Restrict conditions for adding duplicating netems to qdisc tree")
    Reported-by: Ji-Soo Chung <jschung2@proton.me>
    Reported-by: Gerlinde <lrGerlinde@mailfence.com>
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220774
    Reported-by: zyc zyc <zyc199902@zohomail.cn>
    Closes: https://lore.kernel.org/all/19adda5a1e2.12410b78222774.9191120410578703463@zohomail.cn/
    Reported-by: Manas Ghandat <ghandatmanas@gmail.com>
    Closes: https://lore.kernel.org/netdev/f69b2c8f-8325-4c2e-a011-6dbc089f30e4@gmail.com/
    Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
    Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Link: https://patch.msgid.link/20260525122556.973584-3-jhs@mojatatu.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/sched: sch_sfb: Replace direct dequeue call with peek and qdisc_dequeue_peeked [+ + +]
Author: Victor Nogueria <victor@mojatatu.com>
Date:   Thu Apr 30 11:29:56 2026 -0400

    net/sched: sch_sfb: Replace direct dequeue call with peek and qdisc_dequeue_peeked
    
    [ Upstream commit 1b9bc71153b01dbde8045b9edede4240f4f5520e ]
    
    When sfb has children (eg qfq qdisc) whose peek() callback is
    qdisc_peek_dequeued(), we could get a kernel panic. When the parent of such
    qdiscs (eg illustrated in patch #3 as tbf) wants to retrieve an skb from
    its child (sfb in this case), it will do the following:
     1a. do a peek() - and when sensing there's an skb the child can offer, then
         - the child in this case(sfb) calls its child's (qfq) peek.
            qfq does the right thing and will return the gso_skb queue packet.
            Note: if there wasnt a gso_skb entry then qfq will store it there.
     1b. invoke a dequeue() on the child (sfb). And herein lies the problem.
         - sfb will call the child's dequeue() which will essentially just
           try to grab something of qfq's queue.
    
    [  127.594489][  T453] KASAN: null-ptr-deref in range [0x0000000000000048-0x000000000000004f]
    [  127.594741][  T453] CPU: 2 UID: 0 PID: 453 Comm: ping Not tainted 7.1.0-rc1-00035-gac961974495b-dirty #793 PREEMPT(full)
    [  127.595059][  T453] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
    [  127.595254][  T453] RIP: 0010:qfq_dequeue+0x35c/0x1650 [sch_qfq]
    [  127.595461][  T453] Code: 00 fc ff df 80 3c 02 00 0f 85 17 0e 00 00 4c 8d 73 48 48 89 9d b8 02 00 00 48 b8 00 00 00 00 00 fc ff df 4c 89 f2 48 c1 ea 03 <80> 3c 02 00 0f 85 76 0c 00 00 48 b8 00 00 00 00 00 fc ff df 4c 8b
    [  127.596081][  T453] RSP: 0018:ffff88810e5af440 EFLAGS: 00010216
    [  127.596337][  T453] RAX: dffffc0000000000 RBX: 0000000000000000 RCX: dffffc0000000000
    [  127.596623][  T453] RDX: 0000000000000009 RSI: 0000001880000000 RDI: ffff888104fd82b0
    [  127.596917][  T453] RBP: ffff888104fd8000 R08: ffff888104fd8280 R09: 1ffff110211893a3
    [  127.597165][  T453] R10: 1ffff110211893a6 R11: 1ffff110211893a7 R12: 0000001880000000
    [  127.597404][  T453] R13: ffff888104fd82b8 R14: 0000000000000048 R15: 0000000040000000
    [  127.597644][  T453] FS:  00007fc380cbfc40(0000) GS:ffff88816f2a8000(0000) knlGS:0000000000000000
    [  127.597956][  T453] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [  127.598160][  T453] CR2: 00005610aa9890a8 CR3: 000000010369e000 CR4: 0000000000750ef0
    [  127.598390][  T453] PKRU: 55555554
    [  127.598509][  T453] Call Trace:
    [  127.598629][  T453]  <TASK>
    [  127.598718][  T453]  ? mark_held_locks+0x40/0x70
    [  127.598890][  T453]  ? srso_alias_return_thunk+0x5/0xfbef5
    [  127.599053][  T453]  sfb_dequeue+0x88/0x4d0
    [  127.599174][  T453]  ? ktime_get+0x137/0x230
    [  127.599328][  T453]  ? srso_alias_return_thunk+0x5/0xfbef5
    [  127.599480][  T453]  ? qdisc_peek_dequeued+0x7b/0x350 [sch_qfq]
    [  127.599670][  T453]  ? srso_alias_return_thunk+0x5/0xfbef5
    [  127.599831][  T453]  tbf_dequeue+0x6b1/0x1098 [sch_tbf]
    [  127.599988][  T453]  __qdisc_run+0x169/0x1900
    
    The right thing to do in #1b is to grab the skb off gso_skb queue.
    This patchset fixes that issue by changing #1b to use qdisc_dequeue_peeked()
    method instead.
    
    Fixes: e13e02a3c68d ("net_sched: SFB flow scheduler")
    Signed-off-by: Victor Nogueria <victor@mojatatu.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Link: https://patch.msgid.link/20260430152957.194015-3-jhs@mojatatu.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net/smc: Do not re-initialize smc hashtables [+ + +]
Author: Alexandra Winter <wintera@linux.ibm.com>
Date:   Thu May 21 16:56:39 2026 +0200

    net/smc: Do not re-initialize smc hashtables
    
    [ Upstream commit 9e4389b0038781f19f97895186ed941ff8ac1678 ]
    
    INIT_HLIST_HEAD(&smc_v*_hashinfo.ht) are called after smc_nl_init(),
    proto_register() and sock_register(). This can lead to smc_v*_hashinfo.ht
    being reset even though hash entries already exist and are being used,
    possibly resulting in a corrupted list.
    
    Remove unnecessary and dangerous re-initialisation of smc_v*_hashinfo.ht in
    smc_init(); it is implicitly initialised to zero anyhow. Add
    HLIST_HEAD_INIT to the definitions for clarity.
    
    Fixes: f16a7dd5cf27 ("smc: netlink interface for SMC sockets")
    Suggested-by: Halil Pasic <pasic@linux.ibm.com>
    Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
    Acked-by: Halil Pasic <pasic@linux.ibm.com>
    Reviewed-by: Mahanta Jambigi <mjambigi@linux.ibm.com>
    Link: https://patch.msgid.link/20260521145639.10317-1-wintera@linux.ibm.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net: Avoid checksumming unreadable skb tail on trim [+ + +]
Author: Björn Töpel <bjorn@kernel.org>
Date:   Fri May 22 14:06:40 2026 +0200

    net: Avoid checksumming unreadable skb tail on trim
    
    [ Upstream commit 2e357f002c61fd76fd8f12468744a06a5ec48eaa ]
    
    pskb_trim_rcsum_slow() keeps CHECKSUM_COMPLETE valid by subtracting
    the checksum of the bytes removed from the skb tail. That assumes the
    removed bytes can be read.
    
    io_uring zcrx skbs may contain unreadable net_iov frags. With fbnic
    header/data split, small TCP/IPv4 packets can carry Ethernet padding
    in such a frag. ip_rcv_core() trims the skb to iph->tot_len before TCP
    sees it, and the CHECKSUM_COMPLETE adjustment then calls
    skb_checksum() on the padding.
    
    This is exposed by IPv4 because small TCP/IPv4 frames can be shorter
    than the Ethernet minimum payload. TCP/IPv6 frames are large enough in
    the normal zcrx path, so they do not hit the same padding trim.
    
    Keep the existing checksum adjustment for readable skbs. If the
    remaining packet is fully linear, drop CHECKSUM_COMPLETE and let the
    stack validate the packet after trimming. If unreadable payload would
    remain, fail the trim; the checksum cannot be adjusted without reading
    the trimmed tail.
    
    Also clear skb->unreadable when trimming removes all frags.
    
    Fixes: 65249feb6b3d ("net: add support for skbs with unreadable frags")
    Signed-off-by: Björn Töpel <bjorn@kernel.org>
    Reviewed-by: Breno Leitao <leitao@debian.org>
    Link: https://patch.msgid.link/20260522120643.242974-1-bjorn@kernel.org
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: cpsw_new: Fix potential unregister of netdev that has not been registered yet [+ + +]
Author: Kevin Hao <haokexin@gmail.com>
Date:   Mon Jun 1 15:37:08 2026 +0800

    net: cpsw_new: Fix potential unregister of netdev that has not been registered yet
    
    [ Upstream commit 9d724b34fbe13b71865ad0906a4be97571f19cf5 ]
    
    If an error occurs during register_netdev() for the first MAC in
    cpsw_register_ports(), even though cpsw->slaves[0].ndev is set to NULL,
    cpsw->slaves[1].ndev would remain unchanged. This could later cause
    cpsw_unregister_ports() to attempt unregistering the second MAC.
    To address this, add a check for ndev->reg_state before calling
    unregister_netdev(). With this change, setting cpsw->slaves[i].ndev
    to NULL becomes unnecessary and can be removed accordingly.
    
    Fixes: ed3525eda4c4 ("net: ethernet: ti: introduce cpsw switchdev based driver part 1 - dual-emac")
    Signed-off-by: Kevin Hao <haokexin@gmail.com>
    Cc: stable@vger.kernel.org
    Reviewed-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
    Link: https://patch.msgid.link/20260205-cpsw-error-path-v1-2-6e58bae6b299@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Wenshan Lan <jetlan9@163.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: ethtool: Add new parameters and a function to support EPL [+ + +]
Author: Danielle Ratson <danieller@nvidia.com>
Date:   Wed Oct 9 13:53:46 2024 +0300

    net: ethtool: Add new parameters and a function to support EPL
    
    [ Upstream commit edc344568922eb9588e77ba49de1ef0cb9a2ff1c ]
    
    In the CMIS specification for pluggable modules, LPL (Local Payload) and
    EPL (Extended Payload) are two types of data payloads used for managing
    various functions and features of the module.
    
    EPL payloads are used for more complex and extensive management
    functions that require a larger amount of data, so writing firmware
    blocks using EPL is much more efficient.
    
    Currently, only LPL payload is supported for writing firmware blocks to
    the module.
    
    Add EPL related parameters to the function ethtool_cmis_cdb_compose_args()
    and add a specific function for calculating the maximum allowable length
    extension for EPL. Both will be used in the next patch to add support for
    writing firmware blocks using EPL.
    
    Signed-off-by: Danielle Ratson <danieller@nvidia.com>
    Reviewed-by: Petr Machata <petrm@nvidia.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Stable-dep-of: 12c2496a71f8 ("ethtool: cmis: validate start_cmd_payload_size from module")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: ethtool: Add support for writing firmware blocks using EPL payload [+ + +]
Author: Danielle Ratson <danieller@nvidia.com>
Date:   Wed Oct 9 13:53:47 2024 +0300

    net: ethtool: Add support for writing firmware blocks using EPL payload
    
    [ Upstream commit 9a3b0d078bd825613c0821bf7bf5a2e1d8d60057 ]
    
    In the CMIS specification for pluggable modules, LPL (Local Payload) and
    EPL (Extended Payload) are two types of data payloads used for managing
    various functions and features of the module.
    
    EPL payloads are used for more complex and extensive management
    functions that require a larger amount of data, so writing firmware
    blocks using EPL is much more efficient.
    
    Currently, only LPL payload is supported for writing firmware blocks to
    the module.
    
    Add support for writing firmware block using EPL payload, both to
    support modules that supports only EPL write mechanism, and to optimize
    the flashing process of modules that support LPL and EPL.
    
    Signed-off-by: Danielle Ratson <danieller@nvidia.com>
    Reviewed-by: Petr Machata <petrm@nvidia.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Stable-dep-of: 12c2496a71f8 ("ethtool: cmis: validate start_cmd_payload_size from module")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: hsr: defer node table free until after RCU readers [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
Date:   Fri May 29 19:39:22 2026 -0400

    net: hsr: defer node table free until after RCU readers
    
    [ Upstream commit aaec7096f9961eb223b5b149abe9495525c205d9 ]
    
    HSR node-list and node-status generic-netlink operations run under
    rcu_read_lock(). They walk hsr->node_db through hsr_get_next_node() and
    hsr_get_node_data(), but RTM_DELLINK teardown removes the same node table
    with plain list_del() and frees each node immediately.
    
    That lets a generic-netlink reader hold a struct hsr_node pointer across
    hsr_dellink(). In a KASAN build, widening the reader window after
    hsr_get_next_node() obtains the node reproduces a slab-use-after-free
    when the reader copies node->macaddress_A; the freeing stack is
    hsr_del_nodes() from hsr_dellink().
    
    Use list_del_rcu() and defer the free through the existing
    hsr_free_node_rcu() callback. This matches the lifetime rule used by the
    HSR prune paths, which already delete nodes with list_del_rcu() and
    call_rcu().
    
    Fixes: b9a1e627405d ("hsr: implement dellink to clean up resources")
    Cc: stable@vger.kernel.org # v5.3+
    Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
    Link: https://patch.msgid.link/20260513233838.3064715-2-michael.bommarito@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    [ replaced `list_del`+`call_rcu(hsr_free_node_rcu)` with `list_del_rcu`+`kfree_rcu(node, rcu_head)` ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: hsr: fix potential OOB access in supervision frame handling [+ + +]
Author: Luka Gejak <luka.gejak@linux.dev>
Date:   Sat May 23 15:03:30 2026 +0200

    net: hsr: fix potential OOB access in supervision frame handling
    
    [ Upstream commit f229426072fc865654a60978bb7fda790a051ff3 ]
    
    Ensure the entire TLV header is linearized before access by adding
    sizeof(struct hsr_sup_tlv) to the pskb_may_pull() calls. Without this,
    a truncated frame could cause an out-of-bounds access.
    
    Fixes: eafaa88b3eb7 ("net: hsr: Add support for redbox supervision frames")
    Signed-off-by: Luka Gejak <luka.gejak@linux.dev>
    Reviewed-by: Fernando Fernandez Mancera <fmancera@suse.de>
    Link: https://patch.msgid.link/20260523130330.61880-1-luka.gejak@linux.dev
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: Introduce skb tc depth field to track packet loops [+ + +]
Author: Jamal Hadi Salim <jhs@mojatatu.com>
Date:   Mon May 25 08:25:48 2026 -0400

    net: Introduce skb tc depth field to track packet loops
    
    [ Upstream commit 98b34f3e8c3492cfc89ff943c9d92b4d52863d1d ]
    
    Add a 2-bit per-skb tc depth field to track packet loops across the stack.
    
    The previous per-CPU loop counters like MIRRED_NEST_LIMIT
    assume a single call stack and lose state in two cases:
    1) When a packet is queued and reprocessed later (e.g., egress->ingress
       via backlog), the per-cpu state is gone by the time it is dequeued.
    2) With XPS/RPS a packet may arrive on one CPU and be processed on
       another.
    
    A per-skb field solves both by travelling with the packet itself.
    
    The field fits in existing padding, using 2 bits that were previously a
    hole:
    
    pahole before(-) and after (+) diff looks like:
       __u8       slow_gro:1;           /*   132: 3  1 */
       __u8       csum_not_inet:1;      /*   132: 4  1 */
       __u8       unreadable:1;         /*   132: 5  1 */
     + __u8       tc_depth:2;           /*   132: 6  1 */
    
     - /* XXX 2 bits hole, try to pack */
       /* XXX 1 byte hole, try to pack */
    
       __u16      tc_index;             /*   134     2 */
    
    There used to be a ttl field which was removed as part of tc_verd in commit
    aec745e2c520 ("net-tc: remove unused tc_verd fields").  It was already
    unused by that time, due to remove earlier in commit c19ae86a510c ("tc: remove
    unused redirect ttl").
    
    The first user of this field is netem, which increments tc_depth on
    duplicated packets before re-enqueueing them at the root qdisc.  On
    re-entry, netem skips duplication for any skb with tc_depth already set,
    bounding recursion to a single level regardless of tree topology.
    
    The other user is mirred which increments it on each pass
    and limits to depth to MIRRED_DEFER_LIMIT (3).
    
    The new field was called ttl in earlier versions of this patch
    but renamed to tc_depth to avoid confusion with IP ttl.
    
    Note (looking at you Sashiko! Dont ignore me and continue bringing this up):
    1. Since both mirred and netem utilize the same 2-bit tc_depth field it is
       possible when netem and mirred are used together that netem qdisc to skip
       the duplication step. This is a known trade-off, as a 2-bit field cannot
       independently track both features' recursion depths and it is not considered
       sane to have a setup that addresses both features on at the same time.
    
    2. skb_scrub_packet does not clear tc_depth. This means a packet's loop history
      is preserved even across namespaces. While this might be restrictive for
      some topologies, it is also design intent to provide robustness against loops
      across namespaces.
    
    Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
    Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Link: https://patch.msgid.link/20260525122556.973584-2-jhs@mojatatu.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Stable-dep-of: e80ad525fc7e ("net/sched: act_mirred: Fix return code in early mirred redirect error paths")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: mana: Add NULL guards in teardown path to prevent panic on attach failure [+ + +]
Author: Dipayaan Roy <dipayanroy@linux.microsoft.com>
Date:   Mon May 25 01:08:24 2026 -0700

    net: mana: Add NULL guards in teardown path to prevent panic on attach failure
    
    [ Upstream commit 17bfe0a8c014ee1d542ad352cd6a0a505361664a ]
    
    When queue allocation fails partway through, the error cleanup frees
    and NULLs apc->tx_qp and apc->rxqs. Multiple teardown paths such as
    mana_remove(), mana_change_mtu() recovery, and internal error handling
    in mana_alloc_queues() can subsequently call into functions that
    dereference these pointers without NULL checks:
    
    - mana_chn_setxdp() dereferences apc->rxqs[0], causing a NULL pointer
      dereference panic (CR2: 0000000000000000 at mana_chn_setxdp+0x26).
    - mana_destroy_vport() iterates apc->rxqs without a NULL check.
    - mana_fence_rqs() iterates apc->rxqs without a NULL check.
    - mana_dealloc_queues() iterates apc->tx_qp without a NULL check.
    
    Add NULL guards for apc->rxqs in mana_fence_rqs(),
    mana_destroy_vport(), and before the mana_chn_setxdp() call. Add a
    NULL guard for apc->tx_qp in mana_dealloc_queues() to skip TX queue
    draining when TX queues were never allocated or already freed.
    
    Fixes: ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)")
    Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
    Signed-off-by: Dipayaan Roy <dipayanroy@linux.microsoft.com>
    Link: https://patch.msgid.link/20260525081129.1230035-2-dipayanroy@linux.microsoft.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: mctp: ensure our nlmsg responses are initialised [+ + +]
Author: Jeremy Kerr <jk@codeconstruct.com.au>
Date:   Tue Jun 2 15:35:48 2026 +0800

    net: mctp: ensure our nlmsg responses are initialised
    
    [ Upstream commit a6a9bc544b675d8b5180f2718ec985ad267b5cbf ]
    
    Syed Faraz Abrar (@farazsth98) from Zellic, and Pumpkin (@u1f383) from
    DEVCORE Research Team working with Trend Micro Zero Day Initiative
    report that a RTM_GETNEIGH will return uninitalised data in the pad
    bytes of the ndmsg data.
    
    Ensure we're initialising the netlink data to zero, in the link, addr
    and neigh response messages.
    
    Fixes: 831119f88781 ("mctp: Add neighbour netlink interface")
    Fixes: 06d2f4c583a7 ("mctp: Add netlink route management")
    Fixes: 583be982d934 ("mctp: Add device handling and netlink interface")
    Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20260209-dev-mctp-nlmsg-v1-1-f1e30c346a43@codeconstruct.com.au
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Li hongliang <1468888505@139.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: netlink: don't set nsid on local notifications [+ + +]
Author: Ilya Maximets <i.maximets@ovn.org>
Date:   Wed May 20 19:22:36 2026 +0200

    net: netlink: don't set nsid on local notifications
    
    [ Upstream commit 88b126b39f9757e9debc322d4679239e9af089c7 ]
    
    In most cases, notifications on sockets with NETLINK_LISTEN_ALL_NSID
    do not contain NSID in their ancillary data in case the event is local
    to the listener.
    
    However, when a self-referential NSID is allocated for a namespace,
    every local notification starts sending this ID to the user space.
    
    This is problematic, because the listener cannot tell if those
    notifications are local or not anymore without making extra requests
    to figure out if the provided NSID is local or not.  The listener
    can also not figure out the local NSID beforehand as it can be
    allocated at any point in time by other processes, changing the
    structure of the future notifications for everyone.
    
    The value is practically not useful, since it's the namespace's own
    ID that the application has to obtain from other sources in order to
    figure out if it's the same or not.  So, for the application it's
    just an extra busy work with no benefits.  Moreover, applications
    that do not know about this quirk may be mishandling notifications
    with NSID set as notifications from remote namespaces.  This is the
    case for ovs-vswitchd and the iproute2's 'ip monitor' that stops
    printing 'current' and starts printing the nsid number mid-session.
    
    Lack of clear documentation for this behavior is also not helping.
    
    A search though open-source projects doesn't reveal any projects
    that use NETNSA_NSID_NOT_ASSIGNED and rely on metadata to contain
    self-referential NSIDs (expected, since the value is not useful).
    Quite the opposite, as already mentioned, there are few applications
    that rely on NSID to not be present in local events.
    
    Since the value is not useful and actively harmful in some cases,
    let's not report it for local events, making the notifications more
    consistent.
    
    Also adding some blank lines for readability.
    
    Fixes: 59324cf35aba ("netlink: allow to listen "all" netns")
    Reported-by: Matteo Perin <matteo.perin@canonical.com>
    Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
    Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
    Link: https://patch.msgid.link/20260520172317.175168-3-i.maximets@ovn.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: netlink: fix sending unassigned nsid after assigned one [+ + +]
Author: Ilya Maximets <i.maximets@ovn.org>
Date:   Wed May 20 19:22:35 2026 +0200

    net: netlink: fix sending unassigned nsid after assigned one
    
    [ Upstream commit 70f8592ee90585272018a725054b6eb2ab7e99ca ]
    
    If the current skb is not shared, it is re-used directly for all the
    sockets subscribed to the notification.  If we have remote all-nsid
    socket receiving a message first, then the 'nsid_is_set' will be
    set to 'true'.  If the nsid is NOT_ASSIGNED for the next socket in
    the list, the 'nsid_is_set' will remain 'true' and the negative value
    is be delivered to the user space.  All subsequent nsid values will be
    delivered as well, since there is no code path that sets the flag
    back to 'false'.
    
    Fix that by always dropping the flag to 'false' first.
    
    Fixes: 7212462fa6fd ("netlink: don't send unknown nsid")
    Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
    Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
    Link: https://patch.msgid.link/20260520172317.175168-2-i.maximets@ovn.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: skbuff: fix missing zerocopy reference in pskb_carve helpers [+ + +]
Author: Minh Nguyen <minhnguyen.080505@gmail.com>
Date:   Tue May 26 11:12:39 2026 +0700

    net: skbuff: fix missing zerocopy reference in pskb_carve helpers
    
    commit 98d0912e9f841e5529a5b89a972805f34cb1c69d upstream.
    
    pskb_carve_inside_header() and pskb_carve_inside_nonlinear() both copy
    the old skb_shared_info header into a new buffer via memcpy(), which
    includes the destructor_arg pointer (uarg) for MSG_ZEROCOPY skbs.
    Neither function calls net_zcopy_get() for the new shinfo, creating an
    unaccounted holder: every skb_shared_info with destructor_arg set will
    call skb_zcopy_clear() once when freed, but the corresponding
    net_zcopy_get() was never called for the new copy. Repeated calls
    drive uarg->refcnt to zero prematurely, freeing ubuf_info_msgzc while
    TX skbs still hold live destructor_arg pointers.
    
    KASAN reports use-after-free on a freed ubuf_info_msgzc:
    
      BUG: KASAN: slab-use-after-free in skb_release_data+0x77b/0x810
      Read of size 8 at addr ffff88801574d3e8 by task poc/220
    
      Call Trace:
       skb_release_data+0x77b/0x810
       kfree_skb_list_reason+0x13e/0x610
       skb_release_data+0x4cd/0x810
       sk_skb_reason_drop+0xf3/0x340
       skb_queue_purge_reason+0x282/0x440
       rds_tcp_inc_free+0x1e/0x30
       rds_recvmsg+0x354/0x1780
       __sys_recvmsg+0xdf/0x180
    
      Allocated by task 219:
       msg_zerocopy_realloc+0x157/0x7b0
       tcp_sendmsg_locked+0x2892/0x3ba0
    
      Freed by task 219:
       ip_recv_error+0x74a/0xb10
       tcp_recvmsg+0x475/0x530
    
    The skb consuming the late access still referenced the same uarg via
    shinfo->destructor_arg copied by pskb_carve_inside_nonlinear() without
    a refcount bump. This has been verified to be reliably exploitable: a
    working proof-of-concept achieves full root privilege escalation from
    an unprivileged local user on a default kernel configuration.
    
    The fix follows the pattern of pskb_expand_head() which has the same
    memcpy/cloned structure. For pskb_carve_inside_header(), net_zcopy_get()
    is placed after skb_orphan_frags() succeeds, so the orphan error path
    needs no cleanup. For pskb_carve_inside_nonlinear(), net_zcopy_get() is
    placed after all failure points and just before skb_release_data(), so
    no error path needs cleanup at all -- matching pskb_expand_head() more
    closely and avoiding the need for a balancing net_zcopy_put().
    
    Fixes: 6fa01ccd8830 ("skbuff: Add pskb_extract() helper function")
    Cc: stable@vger.kernel.org
    Assisted-by: Claude:claude-sonnet-4-6
    Signed-off-by: Minh Nguyen <minhnguyen.080505@gmail.com>
    Reviewed-by: Willem de Bruijn <willemb@google.com>
    Link: https://patch.msgid.link/20260526041240.329462-1-minhnguyen.080505@gmail.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: skbuff: fix pskb_carve leaking zcopy pages [+ + +]
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Thu May 28 19:43:53 2026 +0100

    net: skbuff: fix pskb_carve leaking zcopy pages
    
    [ Upstream commit ff6e798c2eac3ebd0501ad7e796f583fab928de8 ]
    
    When SKBFL_MANAGED_FRAG_REFS is set, frag pages are not refcounted but
    their lifetime is controlled by the attached ubuf_info. To make a copy
    of the skb_shared_info, we either should clear the flag and reference
    the frags, or keep the flag and have frags unreferenced.
    
    pskb_carve_inside_header() and pskb_carve_inside_nonlinear() don't
    follow the rule and thus can leak page references. Let's clear
    SKBFL_MANAGED_FRAG_REFS from the original skb to fix it. It's the
    simplest way to address it, but there are more performant ways to do
    that if it ever becomes a problem.
    
    Link: https://lore.kernel.org/all/20260523085809.26331-1-nvminh232@clc.fitus.edu.vn/
    Fixes: 753f1ca4e1e50 ("net: introduce managed frags infrastructure")
    Reported-by: Minh Nguyen <minhnguyen.080505@gmail.com>
    Reported-by: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Reviewed-by: Willem de Bruijn <willemb@google.com>
    Link: https://patch.msgid.link/1e2086aa69217d7f9c8da3d38f5be7160f1b4cd1.1779993185.git.asml.silence@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
netfilter: conntrack: tcp: do not force CLOSE on invalid-seq RST without direction check [+ + +]
Author: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
Date:   Mon May 11 10:43:14 2026 -0400

    netfilter: conntrack: tcp: do not force CLOSE on invalid-seq RST without direction check
    
    commit bed6e04be8e6b9133d8b16d5a42d0e0ce674fa9a upstream.
    
    An unintended behavior in the TCP conntrack state machine allows a
    connection to be forced into the CLOSE state using an RST packet with an
    invalid sequence number.
    
    Specifically, after a SYN packet is observed, an RST with an invalid SEQ
    can transition the conntrack entry to TCP_CONNTRACK_CLOSE, regardless of
    whether the RST corresponds to the expected reply direction. The relevant
    code path assumes the RST is a response to an outgoing SYN, but does not
    validate packet direction or ensure that a matching SYN was actually sent
    in the opposite direction.
    
    As a result, a crafted packet sequence consisting of a SYN followed by an
    invalid-sequence RST can prematurely terminate an active NAT entry. This
    makes connection teardown easier than intended.
    
    So, tighten the state transition logic to ensure that RST-triggered
    CLOSE transitions only occur when the RST is a valid response to a
    previously observed SYN in the correct direction.
    
    Cc: stable@vger.kernel.org
    Fixes: 9fb9cbb1082d ("[NETFILTER]: Add nf_conntrack subsystem.")
    Signed-off-by: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

netfilter: ebtables: fix OOB read in compat_mtw_from_user [+ + +]
Author: Florian Westphal <fw@strlen.de>
Date:   Tue May 19 22:52:07 2026 +0200

    netfilter: ebtables: fix OOB read in compat_mtw_from_user
    
    [ Upstream commit f438d1786d657d57790c5d138d6db3fc9fdac392 ]
    
    Luxiao Xu says:
    
     The function compat_mtw_from_user() converts ebtables extensions from
     32-bit user structures to kernel native structures. However, it lacks
     proper validation of the user-supplied match_size/target_size.
    
     When certain extensions are processed, the kernel-side translation
     logic may perform memory accesses based on the extension's expected
     size. If the user provides a size smaller than what the extension
     requires, it results in an out-of-bounds read as reported by KASAN.
    
     This fix introduces a check to ensure match_size is at least as large
     as the extension's required compatsize. This covers matches, watchers,
     and targets, while maintaining compatibility with standard targets.
    
    AFAIU this is relevant for matches that need to go though
    match->compat_from_user() call.  Those that use plain memcpy with the
    user-provided size are ok because the caller checks that size vs the
    start of the next rule entry offset (which itself is checked vs. total
    size copied from userspace).
    
    The ->compat_from_user() callbacks assume they can read compatsize bytes,
    so they need this extra check.
    
    Based on an earlier patch from Luxiao Xu.
    
    Fixes: 81e675c227ec ("netfilter: ebtables: add CONFIG_COMPAT support")
    Reported-by: Yuan Tan <yuantan098@gmail.com>
    Reported-by: Yifan Wu <yifanwucs@gmail.com>
    Reported-by: Juefei Pu <tomapufckgml@gmail.com>
    Reported-by: Xin Liu <bird@lzu.edu.cn>
    Signed-off-by: Luxiao Xu <rakukuip@gmail.com>
    Signed-off-by: Ren Wei <n05ec@lzu.edu.cn>
    Reviewed-by: Fernando Fernandez Mancera <fmancera@suse.de>
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

netfilter: synproxy: refresh tcphdr after skb_ensure_writable [+ + +]
Author: Chris Mason <clm@meta.com>
Date:   Tue May 19 12:36:14 2026 -0700

    netfilter: synproxy: refresh tcphdr after skb_ensure_writable
    
    [ Upstream commit 92170e6afe927ab2792a3f71902845789c8e31b1 ]
    
    synproxy_tstamp_adjust() rewrites the TCP timestamp option in place
    and then patches the TCP checksum via inet_proto_csum_replace4() on
    the caller-supplied tcphdr pointer.  Both ipv4_synproxy_hook() and
    ipv6_synproxy_hook() obtain that pointer with skb_header_pointer()
    before calling in, so it may either alias skb->head directly or
    point at the caller's on-stack _tcph buffer.
    
    Between obtaining the pointer and using it, the function calls
    skb_ensure_writable(skb, optend), which on a cloned or non-linear
    skb invokes pskb_expand_head() and frees the old skb->head.  After
    that point the cached th is stale:
    
        caller (ipv[46]_synproxy_hook)
          th = skb_header_pointer(skb, ..., &_tcph)
          synproxy_tstamp_adjust(skb, protoff, th, ...)
            skb_ensure_writable(skb, optend)
              pskb_expand_head()        /* kfree(old skb->head) */
            ...
            inet_proto_csum_replace4(&th->check, ...)
                                        /* writes into freed head, or
                                           into the caller's stack copy
                                           leaving the on-wire checksum
                                           stale */
    
    The option bytes are written through skb->data and are fine; only
    the checksum update goes through th and so lands in the wrong
    place.  The result is either a write into freed slab memory or a
    packet leaving with a checksum that does not match its payload.
    
    Fix by re-deriving th from skb->data + protoff immediately after
    skb_ensure_writable() succeeds, so the subsequent checksum update
    targets the linear, writable header.
    
    Fixes: 48b1de4c110a ("netfilter: add SYNPROXY core/target")
    Assisted-by: kres (claude-opus-4-7)
    Signed-off-by: Chris Mason <clm@meta.com>
    Reviewed-by: Fernando Fernandez Mancera <fmancera@suse.de>
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

netfilter: xt_cpu: prefer raw_smp_processor_id [+ + +]
Author: Florian Westphal <fw@strlen.de>
Date:   Tue May 19 20:10:08 2026 +0200

    netfilter: xt_cpu: prefer raw_smp_processor_id
    
    [ Upstream commit c376f07e16c02239ed44cabb97145d03f65b4d15 ]
    
    With PREEMPT_RCU we get splat:
    
    BUG: using smp_processor_id() in preemptible [..]
    caller is cpu_mt+0x53/0xd0 net/netfilter/xt_cpu.c:37
    CPU: 1 .. Comm: syz.3.1377 #0 PREEMPT(full)
    Call Trace:
     <TASK>
     dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
     check_preemption_disabled+0xd3/0xe0 lib/smp_processor_id.c:47
     cpu_mt+0x53/0xd0 net/netfilter/xt_cpu.c:37
     [..]
    
    Just use raw version instead.
    This is similar to 14d14a5d2957 ("netfilter: nft_meta: use raw_smp_processor_id()").
    
    Fixes: 0ca743a55991 ("netfilter: nf_tables: add compatibility layer for x_tables")
    Reported-by: syzbot+690d3e3ffa7335ac10eb@syzkaller.appspotmail.com
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
nfc: hci: fix out-of-bounds read in HCP header parsing [+ + +]
Author: Ashutosh Desai <ashutoshdesai993@gmail.com>
Date:   Tue May 5 17:07:12 2026 +0000

    nfc: hci: fix out-of-bounds read in HCP header parsing
    
    commit f040e590c035bfd9553fe79ee9585caf1b14d67b upstream.
    
    Both nfc_hci_recv_from_llc() and nci_hci_data_received_cb() read
    packet->header from skb->data at function entry without first checking
    that the buffer holds at least one byte. A malicious NFC peer can send
    a 0-byte HCP frame that passes through the SHDLC layer and reaches
    these functions, causing an out-of-bounds heap read of packet->header.
    The same 0-byte frame, if queued as a non-final fragment, also causes
    the reassembly loop to underflow msg_len to UINT_MAX, triggering
    skb_over_panic() when the reassembled skb is written.
    
    Fix this by adding a pskb_may_pull() check at the entry of each
    function before packet->header is first accessed. The existing
    pskb_may_pull() checks before the reassembled hcp_skb is cast to
    struct hcp_packet remain in place to guard the 2-byte HCP message
    header.
    
    Fixes: 8b8d2e08bf0d ("NFC: HCI support")
    Fixes: 11f54f228643 ("NFC: nci: Add HCI over NCI protocol support")
    Cc: stable@vger.kernel.org
    Reviewed-by: Simon Horman <horms@kernel.org>
    Signed-off-by: Ashutosh Desai <ashutoshdesai993@gmail.com>
    Link: https://patch.msgid.link/20260505170712.96560-1-ashutoshdesai993@gmail.com
    Signed-off-by: David Heidelberg <david@ixit.cz>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

nfc: llcp: Fix use-after-free in llcp_sock_release() [+ + +]
Author: Lee Jones <lee@kernel.org>
Date:   Wed Apr 29 13:40:41 2026 +0000

    nfc: llcp: Fix use-after-free in llcp_sock_release()
    
    [ Upstream commit f4268b466190dae95a7585f69b4f1f8ad097632c ]
    
    llcp_sock_release() unconditionally unlinks the socket from the local
    sockets list.  However, if the socket is still in connecting state, it
    is on the connecting list.
    
    Fix this by checking the socket state and unlinking from the correct list.
    
    Fixes: b4011239a08e ("NFC: llcp: Fix non blocking sockets connections")
    Signed-off-by: Lee Jones <lee@kernel.org>
    Link: https://patch.msgid.link/20260429134115.3558604-1-lee@kernel.org
    Signed-off-by: David Heidelberg <david@ixit.cz>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

nfc: llcp: Fix use-after-free race in nfc_llcp_recv_cc() [+ + +]
Author: Lee Jones <lee@kernel.org>
Date:   Wed Apr 29 13:40:42 2026 +0000

    nfc: llcp: Fix use-after-free race in nfc_llcp_recv_cc()
    
    [ Upstream commit b493ea2765cc17cb8aa7e7544a4b6dcb05b6ed77 ]
    
    A race condition exists in the NFC LLCP connection state machine where
    the connection acceptance packet (CC) can be processed concurrently with
    socket release.  This can lead to a use-after-free of the socket object.
    
    When nfc_llcp_recv_cc() moves the socket from the connecting_sockets
    list to the sockets list, it does so without holding the socket lock.
    If llcp_sock_release() is executing concurrently, it might have already
    unlinked the socket and dropped its references, which can result in
    nfc_llcp_recv_cc() linking a freed socket into the live list.
    
    Fix this by holding lock_sock() during the state transition and list
    movement in nfc_llcp_recv_cc().  After acquiring the lock, check if
    the socket is still hashed to ensure it hasn't already been unlinked
    and marked for destruction by the release path.  This aligns the locking
    pattern with recv_hdlc() and recv_disc().
    
    Fixes: a69f32af86e3 ("NFC: Socket linked list")
    Signed-off-by: Lee Jones <lee@kernel.org>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20260429134115.3558604-2-lee@kernel.org
    Signed-off-by: David Heidelberg <david@ixit.cz>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

nfc: nxp-nci: i2c: use rising-edge IRQ on ACPI systems [+ + +]
Author: Carl Lee <carl.lee@amd.com>
Date:   Sat May 16 19:55:18 2026 +0800

    nfc: nxp-nci: i2c: use rising-edge IRQ on ACPI systems
    
    [ Upstream commit f23bf992d65a42007c517b060ca35cebdea3525a ]
    
    Some ACPI-based platforms report incorrect IRQ trigger types (e.g.
    IRQF_TRIGGER_HIGH), which can lead to interrupt storms.
    
    Use the historically working rising-edge trigger on ACPI systems to
    avoid this regression.
    
    Device Tree-based systems continue to use the firmware-provided
    trigger type.
    
    Fixes: 57be33f85e36 ("nfc: nxp-nci: remove interrupt trigger type")
    Signed-off-by: Carl Lee <carl.lee@amd.com>
    Tested-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
    Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
    Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
    Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca>
    Tested-by: Luca Stefani <luca.stefani.ge1@gmail.com>
    Link: https://patch.msgid.link/20260516-nfc-nxp-nci-i2c-restore-irq-trigger-fallback-v3-1-37ba4b6e9086@amd.com
    Signed-off-by: David Heidelberg <david@ixit.cz>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
nvme-tcp: store negative errno in queue->tls_err [+ + +]
Author: Chuck Lever <chuck.lever@oracle.com>
Date:   Mon May 25 12:51:16 2026 -0400

    nvme-tcp: store negative errno in queue->tls_err
    
    [ Upstream commit 9015985b5eb1a90eb86caf5bce1dfcf1aa38f8ad ]
    
    nvme_tcp_tls_done() assigns queue->tls_err in three branches.  The
    ENOKEY lookup failure and the EOPNOTSUPP initializer both store
    negative errnos.  The third branch, reached when the handshake
    layer reports a non-zero status, stores -status.
    
    The handshake layer delivers status to the consumer callback as a
    negative errno; the other in-tree consumers --
    xs_tls_handshake_done() and the nvmet target callback -- treat
    their status argument that way.  The extra negation in
    nvme_tcp_tls_done() flips the sign, leaving tls_err as a positive
    value (for instance, +EIO), which nvme_tcp_start_tls() then
    returns to its caller.
    
    Drop the extra negation so queue->tls_err uniformly carries a
    negative errno on failure.
    
    Fixes: be8e82caa685 ("nvme-tcp: enable TLS handshake upcall")
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Reviewed-by: Hannes Reinecke <hare@kernel.org>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Link: https://patch.msgid.link/20260525-handshake-file-pin-v3-2-66c616906ead@oracle.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
octeontx2-pf: avoid double free of pool->stack on AQ init failure [+ + +]
Author: Dawei Feng <dawei.feng@seu.edu.cn>
Date:   Sat May 30 13:03:20 2026 -0400

    octeontx2-pf: avoid double free of pool->stack on AQ init failure
    
    [ Upstream commit 9b244c242bec48b37e82b89787afd6a4c43457e1 ]
    
    otx2_pool_aq_init() frees pool->stack when mailbox sync or retry
    allocation fails, but leaves the pointer unchanged. Later,
    otx2_sq_aura_pool_init() unwinds the partial setup through
    otx2_aura_pool_free(), which frees pool->stack again. The CN20K-specific
    cn20k_pool_aq_init() implementation has the same bug in
    its corresponding error path.
    
    Set pool->stack to NULL immediately after the local free so the shared
    cleanup path does not free the same stack again while cleaning up
    partially initialized pool state.
    
    The bug was first flagged by an experimental analysis tool we are
    developing for kernel memory-management bugs while analyzing
    v6.13-rc1. The tool is still under development and is not yet publicly
    available. Manual inspection confirms that the bug is still present in
    v7.1-rc3.
    
    Runtime validation was not performed because reproducing this path
    requires OcteonTX2/CN20K hardware.
    
    Fixes: caa2da34fd25 ("octeontx2-pf: Initialize and config queues")
    Fixes: d322fbd17203 ("octeontx2-pf: Initialize cn20k specific aura and pool contexts")
    Cc: stable@vger.kernel.org
    Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
    Signed-off-by: Dawei Feng <dawei.feng@seu.edu.cn>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20260515151826.1005397-1-dawei.feng@seu.edu.cn
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
parport: Fix race between port and client registration [+ + +]
Author: Ben Hutchings <benh@debian.org>
Date:   Tue May 5 20:45:12 2026 +0200

    parport: Fix race between port and client registration
    
    commit ef15ccbb3e8640a723c42ad90eaf81d66ae02017 upstream.
    
    The parport subsystem registers port devices before they are fully
    initialised, resulting in a race condition where client drivers such
    as lp can attach to ports that are not completely initialised or even
    being torn down.
    
    When the port and client drivers are built as modules and loaded
    around the same time during boot, this occasionally results in a
    crash.  I was able to make this happen reliably in a VM with a
    PC-style parallel port by patching parport_pc to fail probing:
    
    > --- a/drivers/parport/parport_pc.c
    > +++ b/drivers/parport/parport_pc.c
    > @@ -2069,7 +2069,7 @@ static struct parport *__parport_pc_probe_port(unsigned long int base,
    >       if (!p)
    >               goto out3;
    >
    > -     base_res = request_region(base, 3, p->name);
    > +     base_res = NULL;
    >       if (!base_res)
    >               goto out4;
    >
    
    and then running:
    
        while true; do
            modprobe lp & modprobe parport_pc
            wait
            rmmod lp parport_pc
        done
    
    for a few seconds.
    
    In the long term I think port registration should be changed to put
    the call to device_add() inside parport_announce_port(), but since the
    latter currently cannot fail this will require changing all port
    drivers.
    
    For now, add a flag to indicate whether a port has been "announced"
    and only try to attach client drivers to ports when the flag is set.
    
    Fixes: 6fa45a226897 ("parport: add device-model to parport subsystem")
    Closes: https://bugs.debian.org/1130365
    Closes: https://lore.kernel.org/all/6ba903ad-9897-42bb-8c2d-337385cc3746@molgen.mpg.de/
    Cc: stable <stable@kernel.org>
    Signed-off-by: Ben Hutchings <benh@debian.org>
    Acked-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
    Link: https://patch.msgid.link/afo6uBv68GDevbMD@decadent.org.uk
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
perf: Fix dangling cgroup pointer in cpuctx [+ + +]
Author: Yeoreum Yun <yeoreum.yun@arm.com>
Date:   Thu May 28 23:06:57 2026 -0700

    perf: Fix dangling cgroup pointer in cpuctx
    
    [ Upstream commit 3b7a34aebbdf2a4b7295205bf0c654294283ec82 ]
    
    Commit a3c3c6667("perf/core: Fix child_total_time_enabled accounting
    bug at task exit") moves the event->state update to before
    list_del_event(). This makes the event->state test in list_del_event()
    always false; never calling perf_cgroup_event_disable().
    
    As a result, cpuctx->cgrp won't be cleared properly; causing havoc.
    
    Fixes: a3c3c6667("perf/core: Fix child_total_time_enabled accounting bug at task exit")
    Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Tested-by: David Wang <00107082@163.com>
    Link: https://lore.kernel.org/all/aD2TspKH%2F7yvfYoO@e129823.arm.com/
    Signed-off-by: Ian Klatzco <iklatzco@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
phy: mscc: Use PHY_ID_MATCH_EXACT for VSC8584, VSC8582, VSC8575, VSC856X [+ + +]
Author: Horatiu Vultur <horatiu.vultur@microchip.com>
Date:   Thu Oct 23 21:13:49 2025 +0200

    phy: mscc: Use PHY_ID_MATCH_EXACT for VSC8584, VSC8582, VSC8575, VSC856X
    
    [ Upstream commit 1bc80d673087e5704adbb3ee8e4b785c14899cce ]
    
    As the PHYs VSC8584, VSC8582, VSC8575 and VSC856X exists only as rev B,
    we can use PHY_ID_MATCH_EXACT to match exactly on revision B of the PHY.
    Because of this change then there is not need the check if it is a
    different revision than rev B in the function vsc8584_probe() as we
    already know that this will never happen.
    These changes are a preparation for the next patch because in that patch
    we will make the PHYs VSC8574 and VSC8572 to use vsc8584_probe() and
    these PHYs have multiple revision.
    
    Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
    Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
    Link: https://patch.msgid.link/20251023191350.190940-2-horatiu.vultur@microchip.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
platform/x86/intel/vsec: Fix enable_cnt imbalance on PCIe error recovery [+ + +]
Author: Lukas Wunner <lukas@wunner.de>
Date:   Fri May 29 17:42:44 2026 -0400

    platform/x86/intel/vsec: Fix enable_cnt imbalance on PCIe error recovery
    
    [ Upstream commit 348ccc754d8939e21ca5956ff45720b81d6e407f ]
    
    After a PCIe Uncorrectable Error has been reported by a device with
    Intel Vendor Specific Extended Capabilities and has been recovered
    through a Secondary Bus Reset, its driver calls intel_vsec_pci_probe()
    to rescan and reinitialize VSECs.
    
    intel_vsec_pci_probe() invokes pcim_enable_device() and thereby adds
    another devm action which calls pcim_disable_device() on driver unbind.
    
    So once the driver unbinds, pcim_disable_device() will be called as many
    times as an Uncorrectable Error occurred, plus one.  This will lead to
    an enable_cnt imbalance on driver unbind.
    
    Additionally, since commit dc957ab6aa05 ("platform/x86/intel/vsec: Add
    private data for per-device data"), a devm_kzalloc() allocation is
    leaked on every Uncorrectable Error.
    
    Avoid by splitting the VSEC rescan out of intel_vsec_pci_probe() into a
    separate helper and calling that on PCIe error recovery.
    
    Fixes: 936874b77dd0 ("platform/x86/intel/vsec: Add PCI error recovery support to Intel PMT")
    Signed-off-by: Lukas Wunner <lukas@wunner.de>
    Cc: stable@vger.kernel.org  # v6.0+
    Link: https://patch.msgid.link/bd594d09fa866dc51dddc9a447c3b23f9b1402cc.1778736835.git.lukas@wunner.de
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Linux: remove pointless includes of [+ + +]
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Sun Jun 2 23:58:44 2024 -0400

    remove pointless includes of <linux/fdtable.h>
    
    [ Upstream commit be5498cac2ddb112c5bd7433d5e834a1a2493427 ]
    
    some of those used to be needed, some had been cargo-culted for
    no reason...
    
    Reviewed-by: Christian Brauner <brauner@kernel.org>
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
    Stable-dep-of: ea5fe6a73ca5 ("net/handshake: Drain pending requests at net namespace exit")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ring-buffer: Flush and stop persistent ring buffer on panic [+ + +]
Author: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Date:   Fri May 29 21:02:19 2026 -0400

    ring-buffer: Flush and stop persistent ring buffer on panic
    
    [ Upstream commit a494d3c8d5392bcdff83c2a593df0c160ff9f322 ]
    
    On real hardware, panic and machine reboot may not flush hardware cache
    to memory. This means the persistent ring buffer, which relies on a
    coherent state of memory, may not have its events written to the buffer
    and they may be lost. Moreover, there may be inconsistency with the
    counters which are used for validation of the integrity of the
    persistent ring buffer which may cause all data to be discarded.
    
    To avoid this issue, stop recording of the ring buffer on panic and
    flush the cache of the ring buffer's memory.
    
    Fixes: e645535a954a ("tracing: Add option to use memmapped memory for trace boot instance")
    Cc: stable@vger.kernel.org
    Cc: Will Deacon <will@kernel.org>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Cc: Ian Rogers <irogers@google.com>
    Link: https://patch.msgid.link/177751969602.2136606.12031934362587643488.stgit@mhiramat.tok.corp.google.com
    Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Acked-by: Catalin Marinas <catalin.marinas@arm.com>
    Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
rxrpc: Fix DATA decrypt vs splice() by copying data to buffer in recvmsg [+ + +]
Author: David Howells <dhowells@redhat.com>
Date:   Fri May 29 17:42:07 2026 -0400

    rxrpc: Fix DATA decrypt vs splice() by copying data to buffer in recvmsg
    
    [ Upstream commit d2bc90cf6c75cb96d2ce549be6c35efa3099d25b ]
    
    This improves the fix for CVE-2026-43500.
    
    Fix the pagecache corruption from in-place decryption of a DATA packet
    transmitted locally by splice() by getting rid of the packet sharing in the
    I/O thread and unconditionally extracting the packet content into a bounce
    buffer in which the buffer is decrypted.  recvmsg() (or the kernel
    equivalent) then copies the data from the bounce buffer to the destination
    buffer.  The sk_buff then remains unmodified.
    
    This has an additional advantage in that the packet is then arranged in the
    buffer with the correct alignment required for the crypto algorithms to
    process directly.  The performance of the crypto does seem to be a little
    faster and, surprisingly, the unencrypted performance doesn't seem to
    change much - possibly due to removing complexity from the I/O thread.
    
    Yet another advantage is that the I/O thread doesn't have to copy packets
    which would slow down packet distribution, ACK generation, etc..
    
    The buffer belongs to the call and is allocated initially at 2K,
    sufficiently large to hold a whole jumbo subpacket, but the buffer will be
    increased in size if needed.  However, to take this work, MSG_PEEK may
    cause a later packet to be decrypted into the buffer, in which case the
    earlier one will need re-decrypting for a subsequent recvmsg().
    
    Note that rx_pkt_offset may legitimately see 0 as a valid offset now, so
    switch to using USHRT_MAX to indicate an invalid offset.
    
    Note also that I would generally prefer to replace the buffers of the
    current sk_buff with a new kmalloc'd buffer of the right size, ditching the
    old data and frags as this makes the handling of MSG_PEEK easier and
    removes the re-decryption issue, but this looks like quite a complicated
    thing to achieve.  skb_morph() looks half way to what I want, but I don't
    want to have to allocate a new sk_buff.
    
    Fixes: d0d5c0cd1e71 ("rxrpc: Use skb_unshare() rather than skb_cow_data()")
    Reported-by: Hyunwoo Kim <imv4bel@gmail.com>
    Closes: https://lore.kernel.org/r/afKV2zGR6rrelPC7@v4bel/
    Signed-off-by: David Howells <dhowells@redhat.com>
    cc: Simon Horman <horms@kernel.org>
    cc: Jiayuan Chen <jiayuan.chen@linux.dev>
    cc: linux-afs@lists.infradead.org
    Reviewed-by: Jeffrey Altman <jaltman@auristor.com>
    Tested-by: Marc Dionne <marc.dionne@auristor.com>
    Link: https://patch.msgid.link/20260515230516.2718212-3-dhowells@redhat.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: 8bfab4b6ffc2 ("rxrpc: Fix RESPONSE packet verification to extract skb to a linear buffer")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

rxrpc: Fix RESPONSE packet verification to extract skb to a linear buffer [+ + +]
Author: David Howells <dhowells@redhat.com>
Date:   Fri May 29 17:42:08 2026 -0400

    rxrpc: Fix RESPONSE packet verification to extract skb to a linear buffer
    
    [ Upstream commit 8bfab4b6ffc2fe92da86300728fc8c3c7ebffb56 ]
    
    This improves the fix for CVE-2026-43500.
    
    Fix the verification of RESPONSE packets to avoid the problem of
    overwriting a RESPONSE packet sent via splice to a local address by
    extracting the contents of the UDP packet into a kmalloc'd linear buffer
    rather than decrypting the data in place in the sk_buff (which may corrupt
    the original buffer).
    
    Fixes: 24481a7f5733 ("rxrpc: Fix conn-level packet handling to unshare RESPONSE packets")
    Reported-by: Hyunwoo Kim <imv4bel@gmail.com>
    Closes: https://lore.kernel.org/r/afKV2zGR6rrelPC7@v4bel/
    Signed-off-by: David Howells <dhowells@redhat.com>
    cc: Simon Horman <horms@kernel.org>
    cc: Jiayuan Chen <jiayuan.chen@linux.dev>
    cc: linux-afs@lists.infradead.org
    cc: stable@kernel.org
    Reviewed-by: Jeffrey Altman <jaltman@auristor.com>
    Tested-by: Marc Dionne <marc.dionne@auristor.com>
    Link: https://patch.msgid.link/20260515230516.2718212-4-dhowells@redhat.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
s390/cio: Restore GFP_DMA for CHSC allocation [+ + +]
Author: Peter Oberparleiter <oberpar@linux.ibm.com>
Date:   Tue Jun 2 17:48:55 2026 +0200

    s390/cio: Restore GFP_DMA for CHSC allocation
    
    [ Upstream commit ea34567db0a6b3a7ce78ba421592344315c8f90e ]
    
    Re-add GFP_DMA when allocating memory for CHSC control blocks.
    On some supported machines, CHSC cannot access memory outside
    the DMA zone, causing CHSC command failures.
    
    Cc: stable@vger.kernel.org
    Fixes: a3a64a4def8d ("s390/cio: remove unneeded DMA zone allocation")
    Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
    Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
    Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
    [ adjusted context to account for missing commit bf4afc53b77ae ]
    Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
scsi: core: Run queues for all non-SDEV_DEL devices from scsi_run_host_queues [+ + +]
Author: David Jeffery <djeffery@redhat.com>
Date:   Fri May 15 14:09:41 2026 -0400

    scsi: core: Run queues for all non-SDEV_DEL devices from scsi_run_host_queues
    
    [ Upstream commit 7205b58702273baf21d6ba7992e6ba15852325f7 ]
    
    While a SCSI host is in a recovery state, scsi_mq_requeue_cmd() will not
    set the requeue list for a requeued command to be kicked in the future.
    The expectation is a call to scsi_run_host_queues() will kick all SCSI
    devices once the recovery state is cleared.
    
    However, scsi_run_host_queues() uses shost_for_each_device() which uses
    scsi_device_get() and so will ignore devices in a partially removed
    state like SDEV_CANCEL. But these devices may also have requeued
    requests, leaving their requests stuck from not being kicked and causing
    the removal process of the device to hang.
    
    scsi_run_host_queues() needs to run against more devices than the macro
    shost_for_each_device() allows. Instead of using the too limiting
    scsi_device_get() state checks, only ignore devices in SDEV_DEL state or
    when unable to acquire a reference. Attempt to run the queues for all
    other devices when scsi_run_host_queues() is called.
    
    Fixes: 8b566edbdbfb ("scsi: core: Only kick the requeue list if necessary")
    Signed-off-by: David Jeffery <djeffery@redhat.com>
    Reviewed-by: Bart Van Assche <bvanassche@acm.org>
    Link: https://patch.msgid.link/20260515180941.9698-1-djeffery@redhat.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: fcoe: Reject FIP descriptors with zero fip_dlen in CVL walker [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
Date:   Mon May 18 10:43:07 2026 -0400

    scsi: fcoe: Reject FIP descriptors with zero fip_dlen in CVL walker
    
    commit 9eed1bd59937e6828b00d2f2dfef631d964f3636 upstream.
    
    drivers/scsi/fcoe/fcoe_ctlr.c::fcoe_ctlr_recv_clr_vlink() advanced the
    descriptor cursor by an attacker-supplied fip_dlen without ever
    requiring dlen >= sizeof(struct fip_desc) in the default branch.  The
    named descriptor cases (FIP_DT_MAC, FIP_DT_NAME, FIP_DT_VN_ID) checked
    their per-type minimum lengths, but a FIP_DT_NON_CRITICAL descriptor
    (fip_dtype >= 128, which the standard requires receivers to silently
    ignore) skipped that check entirely.
    
    An unauthenticated L2 peer on the FCoE control VLAN could hang
    fcoe_ctlr_recv_work on an fcoe, qedf, or bnx2fc initiator indefinitely
    by emitting one FIP CVL frame whose single descriptor had fip_dtype ==
    FIP_DT_NON_CRITICAL and fip_dlen == 0: the cursor advanced zero bytes
    per iteration and the loop condition rlen >= sizeof(*desc) stayed true
    forever, blocking every subsequent FIP frame on that controller.
    
    Tighten the outer dlen guard to also reject dlen < sizeof(struct
    fip_desc), so a malformed descriptor whose length cannot even cover the
    descriptor header is rejected before the switch.  This is the same
    lower-bound the named cases already apply and is the minimum scope that
    closes the loop.
    
    Fixes: 97c8389d54b9 ("[SCSI] fcoe, libfcoe: Add support for FIP. FCoE discovery and keep-alive.")
    Cc: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4-7
    Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
    Reviewed-by: Hannes Reinecke <hare@kernel.org>
    Link: https://patch.msgid.link/20260518144307.2820961-1-michael.bommarito@gmail.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

scsi: scsi_transport_fc: Widen FPIN pname walker counter to u32 [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
Date:   Wed May 20 09:30:15 2026 -0400

    scsi: scsi_transport_fc: Widen FPIN pname walker counter to u32
    
    commit a9a39233ec1fc9f97ea1340a4d09bb7ec2be5153 upstream.
    
    An adjacent Fibre Channel fabric actor that can deliver an FPIN ELS
    frame to an lpfc or qla2xxx Linux initiator can trigger a non-return in
    the generic FC transport. This is not a local userspace or IP network
    path; the attacker must be able to inject fabric traffic, for example as
    a compromised switch or fabric controller, or as a same-zone N_Port on a
    fabric that permits source spoofing.
    
    The Link-Integrity and Peer-Congestion FPIN walkers used a u8 loop
    counter against the 32-bit on-wire pname_count field, and did not bound
    pname_count by the descriptor body already validated by the TLV walker.
    A pname_count of 256 therefore wraps the counter and keeps the loop
    condition true indefinitely.
    
    Factor the shared pname_list[] walk into one helper, widen the counter
    to u32, and clamp pname_count against the entries that fit in the
    descriptor body before iterating.
    
    Fixes: 3dcfe0de5a97 ("scsi: fc: Parse FPIN packets and update statistics")
    Cc: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4-7
    Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: John Garry <john.g.garry@oracle.com>
    Link: https://patch.msgid.link/20260520133015.1018937-1-michael.bommarito@gmail.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

scsi: target: iscsi: Bound iscsi_encode_text_output() appends to rsp_buf [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
Date:   Mon May 11 14:49:14 2026 -0400

    scsi: target: iscsi: Bound iscsi_encode_text_output() appends to rsp_buf
    
    commit bf33e01f88388c43e285492a63e539df6ffed64c upstream.
    
    iscsi_encode_text_output() concatenates "key=value\0" records into
    login->rsp_buf, an 8192-byte kzalloc(MAX_KEY_VALUE_PAIRS) buffer
    allocated in iscsit_alloc_login_setup_buffer(). The three sprintf() call
    sites in this function (lines 1398, 1411, 1424 in v7.1-rc2) never check
    the remaining buffer capacity:
    
            *length += sprintf(output_buf, "%s=%s", er->key, er->value);
            *length += 1;
            output_buf = textbuf + *length;
    
    The 8192-byte ceiling at iscsi_target_check_login_request() bounds the
    *input* Login PDU payload, but a single PDU can carry up to 2048 minimal
    four-byte "a=b\0" pairs, each unknown key expanding to a 16-byte
    "a=NotUnderstood\0" output record via iscsi_add_notunderstood_response().
    2048 * 16 = 32 KiB of output into an 8 KiB buffer, producing a ~24 KiB
    heap overrun in the kmalloc-8k slab.
    
    The fix introduces a static iscsi_encode_text_record() helper that uses
    snprintf() with a per-call bounds check against the remaining buffer,
    and threads a u32 textbuf_size parameter through
    iscsi_encode_text_output(). Both call sites in
    iscsi_target_handle_csg_zero() (PHASE_SECURITY) and
    iscsi_target_handle_csg_one() (PHASE_OPERATIONAL) pass
    MAX_KEY_VALUE_PAIRS. On overflow the encoder logs the condition, calls
    iscsi_release_extra_responses() to drop queued records, and returns -1;
    both caller sites now emit ISCSI_STATUS_CLS_INITIATOR_ERR /
    ISCSI_LOGIN_STATUS_INIT_ERR via iscsit_tx_login_rsp() before returning,
    so the initiator sees an explicit failed-login response rather than a
    silent connection drop. (Prior to this patch only the PHASE_OPERATIONAL
    caller did that; the PHASE_SECURITY caller is converted to the same
    shape.)
    
    Fixes: e48354ce078c ("iscsi-target: Add iSCSI fabric support for target v4.1")
    Cc: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4-7
    Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
    Tested-by: John Garry <john.g.garry@oracle.com>
    Reviewed-by: John Garry <john.g.garry@oracle.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

scsi: target: iscsi: Fix CRC overread and double-free in iscsit_handle_text_cmd() [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
Date:   Fri Jun 5 22:47:23 2026 -0400

    scsi: target: iscsi: Fix CRC overread and double-free in iscsit_handle_text_cmd()
    
    [ Upstream commit 778c2ab142c625a8a8afa570e0f9b7873f445d99 ]
    
    Two latent bugs in the Text-phase handler, both present since the
    original LIO integration in commit e48354ce078c ("iscsi-target: Add
    iSCSI fabric support for target v4.1"):
    
    1) DataDigest CRC buffer overread (4 bytes past text_in).
    
       text_in is kzalloc()'d at ALIGN(payload_length, 4).  rx_size is then
       incremented by ISCSI_CRC_LEN to make room for the received DataDigest
       in the iovec, but the same (now-bumped) rx_size is passed as the
       buffer length to iscsit_crc_buf():
    
           if (conn->conn_ops->DataDigest) {
                   ...
                   rx_size += ISCSI_CRC_LEN;
           }
           ...
           if (conn->conn_ops->DataDigest) {
                   data_crc = iscsit_crc_buf(text_in, rx_size, 0, NULL);
    
       iscsit_crc_buf() walks rx_size bytes of text_in with crc32c(), so
       when DataDigest is negotiated it reads 4 bytes past the end of the
       text_in allocation.  KASAN reproduces this directly on the unpatched
       mainline tree as slab-out-of-bounds in crc32c() called from the Text
       PDU path.  The OOB bytes feed crc32c() and are then compared against
       the initiator-supplied checksum, so the value does not flow back to
       the attacker, but the kernel does read past the buffer on every Text
       PDU with DataDigest=CRC32C.
    
       Fix by passing the actual padded payload length
       (ALIGN(payload_length, 4)) that was used for the kzalloc().
    
    2) Stale cmd->text_in_ptr re-free (double-free) on ERL>0 bad DataDigest
       drop.
    
       On DataDigest mismatch with ErrorRecoveryLevel > 0 the handler
       silently drops the PDU and lets the initiator plug the CmdSN gap:
    
                   kfree(text_in);
                   return 0;
    
       cmd->text_in_ptr still points at the freed buffer.  The next Text
       Request on the same ITT re-enters iscsit_setup_text_cmd(), which
       unconditionally does
    
           kfree(cmd->text_in_ptr);
           cmd->text_in_ptr = NULL;
    
       freeing the same pointer a second time.  Session teardown via
       iscsit_release_cmd() has the same shape and hits the same double-free
       if the connection is dropped before a second Text Request arrives.
    
       On an unmodified mainline tree the bug-1 CRC overread fires first on
       the initial valid Text Request and perturbs the subsequent state, so
       #4 was isolated by building a kernel with only the bug-1 hunk of this
       patch applied plus temporary printk() observability around the three
       relevant kfree() sites.  The observability prints are not part of
       this patch.  On that build, a three-PDU Text Request sequence after
       login produces two back-to-back splats:
    
           BUG: KASAN: double-free in iscsit_setup_text_cmd+0x??
           BUG: KASAN: double-free in iscsit_release_cmd+0x??
    
       showing the same pointer freed in the ERL>0 drop path and again in
       iscsit_setup_text_cmd() (next Text Request on the same ITT) and once
       more in iscsit_release_cmd() (session teardown).  On distro kernels
       with CONFIG_SLAB_FREELIST_HARDENED=y (default) the double-free
       becomes a remote kernel BUG(); on non-hardened kernels it corrupts
       the slab freelist.
    
       Fix by clearing cmd->text_in_ptr after the kfree() in the ERL>0 drop
       path.  With both hunks applied #4 is directly observable on the stock
       tree without observability printks; fixing bug-1 alone would mask #4
       less, not more, so the hunks are submitted together.
    
    Both fixes are one-liners.  The Text PDU state machine is unchanged and
    the wire protocol is unaffected.
    
    Fixes: e48354ce078c ("iscsi-target: Add iSCSI fabric support for target v4.1")
    Cc: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4-7
    Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
    Tested-by: John Garry <john.g.garry@oracle.com>
    Reviewed-by: John Garry <john.g.garry@oracle.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

scsi: target: iscsi: Validate CHAP_R length before base64 decode [+ + +]
Author: Alexandru Hossu <hossu.alexandru@gmail.com>
Date:   Thu May 21 17:11:21 2026 +0200

    scsi: target: iscsi: Validate CHAP_R length before base64 decode
    
    commit 85db7391310b1304d2dc8ae3b0b12105a9567147 upstream.
    
    chap_server_compute_hash() allocates client_digest as
    kzalloc(chap->digest_size) and then, for BASE64-encoded responses,
    passes chap_r directly to chap_base64_decode() without checking whether
    the input length could produce more than digest_size bytes of output.
    
    chap_base64_decode() writes to the destination unconditionally as long
    as there is input to consume. With MAX_RESPONSE_LENGTH set to 128 and
    the "0b" prefix stripped by extract_param(), up to 127 base64 characters
    can reach the decoder. 127 characters decode to 95 bytes. For SHA-256
    (digest_size=32) this overflows client_digest by 63 bytes; for MD5
    (digest_size=16) the overflow is 79 bytes.
    
    The length check at line 344 fires after the write has already happened.
    
    The HEX branch in the same switch statement already validates the length
    up front. Apply the same approach to the BASE64 branch: strip trailing
    base64 padding characters, then reject any input whose data length
    exceeds DIV_ROUND_UP(digest_size * 4, 3) before calling the decoder.
    
    Stripping trailing '=' before the comparison handles both padded and
    unpadded encodings. chap_base64_decode() already returns early on '=',
    so the full original string is still passed to the decoder unchanged.
    
    The mutual CHAP path decodes CHAP_C into initiatorchg_binhex, which is
    kzalloc(CHAP_CHALLENGE_STR_LEN). extract_param() caps initiatorchg at
    CHAP_CHALLENGE_STR_LEN characters, so at most CHAP_CHALLENGE_STR_LEN-1
    base64 characters reach the decoder. The maximum decoded size,
    DIV_ROUND_UP((CHAP_CHALLENGE_STR_LEN-1) * 3, 4), is less than
    CHAP_CHALLENGE_STR_LEN, so no overflow is possible there. A comment is
    added at the call site to document this.
    
    Fixes: 1e5733883421 ("scsi: target: iscsi: Support base64 in CHAP")
    Cc: stable@vger.kernel.org
    Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>
    Reviewed-by: David Disseldorp <ddiss@suse.de>
    Link: https://patch.msgid.link/20260521151121.808477-1-hossu.alexandru@gmail.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
sctp: fix race between sctp_wait_for_connect and peeloff [+ + +]
Author: Zhenghang Xiao <kipreyyy@gmail.com>
Date:   Wed May 27 11:24:11 2026 +0800

    sctp: fix race between sctp_wait_for_connect and peeloff
    
    [ Upstream commit f14fe6395a8b3d961a61e138ad7b36ba3626dd4e ]
    
    sctp_wait_for_connect() drops and re-acquires the socket lock while
    waiting for the association to reach ESTABLISHED state. During this
    window, another thread can peeloff the association to a new socket via
    getsockopt(SCTP_SOCKOPT_PEELOFF), changing asoc->base.sk. After
    re-acquiring the old socket lock, sctp_wait_for_connect() returns
    success without noticing the migration — the caller then accesses
    the association under the wrong lock in sctp_datamsg_from_user().
    
    Add the same sk != asoc->base.sk check that sctp_wait_for_sndbuf()
    already has, returning an error if the association was migrated while
    we slept.
    
    Fixes: 668c9beb9020 ("sctp: implement assign_number for sctp_stream_interleave")
    Signed-off-by: Zhenghang Xiao <kipreyyy@gmail.com>
    Acked-by: Xin Long <lucien.xin@gmail.com>
    Link: https://patch.msgid.link/20260527032411.60959-1-kipreyyy@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
selftests: mptcp: drop nanoseconds width specifier [+ + +]
Author: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Date:   Fri May 29 20:25:46 2026 -0400

    selftests: mptcp: drop nanoseconds width specifier
    
    [ Upstream commit 01ff78e4b3d98689184c52d97f9575dfbdc3b10f ]
    
    Using the format specifier +%s%3N with GNU date is honoured, and only
    prints 3 digits of the nanoseconds portion of the seconds since epoch,
    which corresponds to the milliseconds.
    
    The uutils implementation of date currently does not honour this, and
    always prints all 9 digits. This is a known issue [1], but can be worked
    around by adapting this test to use nanoseconds instead of microseconds,
    and then divide it by 1e6.
    
    This fix is similar to what has been done on systemd side [2], and it is
    needed to run the selftests on Ubuntu 26.04, containing uutils 0.8.0.
    
    Note that the Fixes tag is there even if this patch doesn't fix an issue
    in the kernel selftests, but it is useful for those using uutils 0.8.0.
    
    Fixes: 048d19d444be ("mptcp: add basic kselftest for mptcp")
    Cc: stable@vger.kernel.org
    Link: https://github.com/uutils/coreutils/issues/11658 [1]
    Link: https://github.com/systemd/systemd/pull/41627 [2]
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://patch.msgid.link/20260515-net-mptcp-misc-fixes-7-1-rc4-v2-6-701e96419f2f@kernel.org
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    [ kept `timeout ${timeout_test}` wrapper in do_transfer() ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
serdev: Provide a bustype shutdown function [+ + +]
Author: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Date:   Fri May 29 15:27:54 2026 -0400

    serdev: Provide a bustype shutdown function
    
    [ Upstream commit 6d71c62b13c33ea858ab298fe20beaec5736edc7 ]
    
    To prepare serdev driver to migrate away from struct device_driver::shutdown
    (and then eventually remove that callback) create a serdev driver shutdown
    callback and migration code to keep the existing behaviour. Note this
    introduces a warning for each driver at register time that isn't converted
    yet to that callback.
    
    Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
    Link: https://patch.msgid.link/ab518883e3ed0976a19cb5b5b5faf42bd3a655b7.1765526117.git.u.kleine-koenig@baylibre.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: 375ba7484132 ("Bluetooth: hci_qca: Convert timeout from jiffies to ms")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
serial: altera_jtaguart: handle uart_add_one_port() failures [+ + +]
Author: Myeonghun Pak <mhun512@gmail.com>
Date:   Tue May 12 15:56:57 2026 +0900

    serial: altera_jtaguart: handle uart_add_one_port() failures
    
    commit ea66be25f0e934f49d24cd0c5845d13cdba3520b upstream.
    
    altera_jtaguart_probe() maps the register window before registering the
    UART port, but it ignores failures from uart_add_one_port(). If port
    registration fails, probe still returns success and the mapping remains
    live until a later remove path that is not part of probe failure cleanup.
    
    Return the uart_add_one_port() error and unmap the register window on
    that failure path.
    
    This issue was identified during our ongoing static-analysis research while
    reviewing kernel code.
    
    Fixes: 5bcd601049c6 ("serial: Add driver for the Altera JTAG UART")
    Cc: stable <stable@kernel.org>
    Co-developed-by: Ijae Kim <ae878000@gmail.com>
    Signed-off-by: Ijae Kim <ae878000@gmail.com>
    Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
    Link: https://patch.msgid.link/20260512065837.79528-1-mhun512@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

serial: dz: Convert to use a platform device [+ + +]
Author: Maciej W. Rozycki <macro@orcam.me.uk>
Date:   Wed May 6 23:42:48 2026 +0100

    serial: dz: Convert to use a platform device
    
    commit 5d7a49d60b8fda66da60e240fd7315232fa1754f upstream.
    
    Prevent a crash from happening as the first serial port is initialised:
    
      Console: switching to colour frame buffer device 160x64
      tgafb: SFB+ detected, rev=0x02
      fb0: Digital ZLX-E1 frame buffer device at 0x1e000000
      DECstation DZ serial driver version 1.04
      CPU 0 Unable to handle kernel paging request at virtual address 000000bc, epc == 8048b3a4, ra == 80470a78
      Oops[#1]:
      CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.19.0-dirty #35 NONE
      $ 0   : 00000000 1000ac00 00000004 804707ac
      $ 4   : 00000000 80e20850 80e20858 81000030
      $ 8   : 00000000 8072c81c 00000008 fefefeff
      $12   : 6c616972 00000006 80c5917f 69726420
      $16   : 80e20800 00000000 808f8968 80e20800
      $20   : 00000000 807f5a90 808b0094 808d3bc8
      $24   : 00000018 80479030
      $28   : 80c2e000 80c2fd70 00000069 80470a78
      Hi    : 00000004
      Lo    : 00000000
      epc   : 8048b3a4 __dev_fwnode+0x0/0xc
      ra    : 80470a78 serial_base_ctrl_add+0xa0/0x168
      Status: 1000ac04      IEp
      Cause : 30000008 (ExcCode 02)
      BadVA : 000000bc
      PrId  : 00000220 (R3000)
      Modules linked in:
      Process swapper/0 (pid: 1, threadinfo=(ptrval), task=(ptrval), tls=00000000)
      Stack : 00400044 00400040 8046f4cc 00000000 808a6148 808a0000 808f8968 8086983c
              808e0000 8046fc84 1000ac01 00000028 80e20700 802ba3f8 80e20700 80d34a94
              80c1b900 80e20700 80e20700 80e20700 80e20700 80444650 00000000 00000000
              00000000 807f5a90 808b0094 80447080 00400040 808e0000 80d34a94 808a6148
              80d34a94 00000004 80e20700 00000000 8076974c 80469810 80c2fe3c 1000ac01
              ...
      Call Trace:
      [<8048b3a4>] __dev_fwnode+0x0/0xc
      [<80470a78>] serial_base_ctrl_add+0xa0/0x168
      [<8046fc84>] serial_core_register_port+0x1c8/0x974
      [<808c6af0>] dz_init+0x74/0xc8
      [<800470e0>] do_one_initcall+0x44/0x2d4
      [<808b111c>] kernel_init_freeable+0x258/0x308
      [<8072e434>] kernel_init+0x20/0x114
      [<80049cd0>] ret_from_kernel_thread+0x14/0x1c
    
      Code: 27bd0018  03e00008  2402ffea <8c8200bc> 03e00008  00000000  27bdffc0  afbe0038  afb30024
    
      ---[ end trace 0000000000000000 ]---
    
    -- where a pointer is dereferenced that has been derived from a null
    pointer to the port's parent device.
    
    Since no device is available with legacy probing and it's not anymore a
    preferable way to discover devices anyway, switch the driver to using a
    platform device and use it as the port's parent device.  Update resource
    handling accordingly and only request the actual span of addresses used
    within the slot, which will have had its resource already requested by
    generic platform device code.
    
    Use platform_driver_probe() not just because the DZ device is fixed with
    solder on board and not straightforward to remove, but foremost because
    the associated TTY's major device number is the same as used by the zs
    driver and the first driver to claim it will prevent the other one from
    using it.  Either one DZ device or some SCC devices will be present in a
    given system but never both at a time, and therefore we want the major
    device number to be claimed by the first driver to actually successfully
    bind to its device and platform_driver_probe() is a way to fulfil that.
    
    An unfortunate consequence of the switch to a platform device is we now
    hand the console over from the bootconsole much later in the bootstrap.
    The firmware console handler appears good enough though to work so late
    and in particular with interrupts enabled.
    
    Conversely only starting the console port so late lets the reset code
    fully utilise our delay handlers, so switch from udelay() to fsleep()
    for transmitter draining so as to avoid busy-waiting for an excessive
    amount of time.
    
    Fixes: 84a9582fd203 ("serial: core: Start managing serial controllers to enable runtime PM")
    Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
    Cc: stable@vger.kernel.org # needs to use .remove_new for <= 6.10
    Link: https://patch.msgid.link/alpine.DEB.2.21.2605062326540.46195@angie.orcam.me.uk
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

serial: dz: Fix bootconsole handover lockup [+ + +]
Author: Maciej W. Rozycki <macro@orcam.me.uk>
Date:   Wed May 6 23:42:35 2026 +0100

    serial: dz: Fix bootconsole handover lockup
    
    commit 7f127b2208e5e2b817243cad41fe4211a6d5a7a3 upstream.
    
    Calling dz_reset() in the course of setting up the serial device causes
    line parameters to be reset and the transmitter disabled.  We've been
    lucky in that no message is usually produced to the kernel log between
    this call and the later call to uart_set_options() in the course of
    console setup done by dz_serial_console_init(), or the system would hang
    as the console output handler in the firmware tried to access a port the
    transmitter of which has been disabled and line parameters messed up.
    
    This will change with the next change to the driver, so fix dz_reset()
    such that line parameters are set for 9600n8 console operation as with
    the system firmware and the transmitter re-enabled after reset.  This
    also means dz_pm() serves no purpose anymore, so drop it.
    
    Fixes: e6ee512f5a77 ("dz.c: Resource management")
    Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
    Cc: stable@vger.kernel.org # v2.6.25+
    Link: https://patch.msgid.link/alpine.DEB.2.21.2605062302010.46195@angie.orcam.me.uk
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

serial: dz: Fix bootconsole message clobbering at chip reset [+ + +]
Author: Maciej W. Rozycki <macro@orcam.me.uk>
Date:   Wed May 6 23:42:31 2026 +0100

    serial: dz: Fix bootconsole message clobbering at chip reset
    
    commit ca904f4b42355287bc5ce8b7550ebe909cda4c2c upstream.
    
    In the DZ interface as implemented by the DC7085 gate array the serial
    transmitters are double buffered, meaning that at the time a transmitter
    is ready to accept the next character there is one in the transmit shift
    register still being sent to the line.  Issuing a master clear at this
    time causes this character to be lost, so wait an extra amount of time
    sufficient for the transmit shift register to drain at 9600bps, which is
    the baud rate setting used by the firmware console.
    
    Mind the specified 1.4us TRDY recovery time in the course and continue
    using iob() as the completion barrier, since the platforms involved use
    a write buffer that can delay and combine writes, and reorder them with
    respect to reads regardless of the MMIO locations accessed and we still
    lack a platform-independent handler for that.
    
    When called from dz_serial_console_init() this is too early for fsleep()
    to work and even before lpj has been calculated and therefore the delay
    is actually not sufficient for the transmitter to drain and is merely a
    placeholder now.  This will be addressed in a follow-up change.
    
    Fixes: e6ee512f5a77 ("dz.c: Resource management")
    Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
    Cc: stable@vger.kernel.org # v2.6.25+
    Link: https://patch.msgid.link/alpine.DEB.2.21.2605062259080.46195@angie.orcam.me.uk
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

serial: fsl_lpuart: fix rx buffer and DMA map leaks in start_rx_dma [+ + +]
Author: Shitalkumar Gandhi <shital.gandhi45@gmail.com>
Date:   Mon Apr 20 19:29:03 2026 +0530

    serial: fsl_lpuart: fix rx buffer and DMA map leaks in start_rx_dma
    
    commit 9a9254c4a2a3ca2b3da16d173f3b0dd01f397ff6 upstream.
    
    lpuart_start_rx_dma() allocates sport->rx_ring.buf with kzalloc() and
    then maps a scatterlist via dma_map_sg().  On three subsequent error
    paths the function returns directly without releasing those resources:
    
      - when dma_map_sg() returns 0 (-EINVAL):
          ring->buf is leaked.
      - when dmaengine_slave_config() fails:
          ring->buf and the DMA mapping are leaked.
      - when dmaengine_prep_dma_cyclic() returns NULL:
          ring->buf and the DMA mapping are leaked.
    
    The sole cleanup path, lpuart_dma_rx_free(), is only reached when
    lpuart_dma_rx_use is set, and the caller lpuart_rx_dma_startup() clears
    that flag on failure of lpuart_start_rx_dma().  So these resources are
    permanently leaked on every failure in this function.  Repeated port
    open/close or termios changes under error conditions will slowly consume
    memory and leave stale streaming DMA mappings behind.
    
    Fix it by introducing two error labels that unmap the scatterlist and
    free the ring buffer as appropriate.  While here, replace the misleading
    -EFAULT (bad userspace pointer) returned when dmaengine_prep_dma_cyclic()
    fails with the more accurate -ENOMEM, matching how other dmaengine users
    in the tree treat this failure.
    
    No functional change on the success path.
    
    Fixes: 5887ad43ee02 ("tty: serial: fsl_lpuart: Use cyclic DMA for Rx")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Shitalkumar Gandhi <shitalkumar.gandhi@cambiumnetworks.com>
    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Link: https://patch.msgid.link/20260420135903.2062024-1-shitalkumar.gandhi@cambiumnetworks.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

serial: qcom-geni: fix UART_RX_PAR_EN bit position [+ + +]
Author: Prasanna S <prasanna.s@oss.qualcomm.com>
Date:   Tue Apr 28 09:56:13 2026 +0530

    serial: qcom-geni: fix UART_RX_PAR_EN bit position
    
    commit ca2584d841b69391ffc4144840563d2e1a0018df upstream.
    
    UART_RX_PAR_EN is incorrectly defined as bit 3, which triggers false
    framing errors (S_GP_IRQ_1_EN) and causes received data to be dropped
    when parity is enabled and the parity bit is 0.
    
    Define UART_RX_PAR_EN as bit 4 of the SE_UART_RX_TRANS_CFG register, as
    specified in the reference manual.
    
    Fixes: c4f528795d1a ("tty: serial: msm_geni_serial: Add serial driver support for GENI based QUP")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Prasanna S <prasanna.s@oss.qualcomm.com>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Link: https://patch.msgid.link/20260428-serial-bit-correct-v1-1-9131ad5b97d8@oss.qualcomm.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

serial: qcom_geni: fix kfifo underflow when flush precedes DMA completion IRQ [+ + +]
Author: Viken Dadhaniya <viken.dadhaniya@oss.qualcomm.com>
Date:   Wed May 6 10:15:21 2026 +0530

    serial: qcom_geni: fix kfifo underflow when flush precedes DMA completion IRQ
    
    commit 452d6fa37ae9b021f4f6d397dbae077f7296f6f4 upstream.
    
    When uart_flush_buffer() runs before the DMA completion IRQ is delivered,
    the following race can occur (all steps serialized by uart_port_lock):
    
      1. DMA starts: tx_remaining = N, kfifo contains N bytes
      2. DMA completes in hardware; IRQ is pending but not yet delivered
      3. uart_flush_buffer() acquires the port lock and calls kfifo_reset(),
         making kfifo_len() = 0 while tx_remaining remains N
      4. uart_flush_buffer() releases the port lock
      5. DMA IRQ fires; handle_tx_dma() acquires the port lock and calls
         uart_xmit_advance(uport, tx_remaining) on an empty kfifo
    
    uart_xmit_advance() increments kfifo->out by tx_remaining. Since
    kfifo_reset() already set both in and out to 0, out wraps past in,
    causing kfifo_len() to return UART_XMIT_SIZE - tx_remaining. The next
    start_tx_dma() call then submits a DMA transfer of stale buffer data.
    
    Fix this by snapshotting kfifo_len() at the start of handle_tx_dma()
    and skipping uart_xmit_advance() when fifo_len < tx_remaining, which
    indicates the kfifo was reset by a preceding flush.
    
    Fixes: 2aaa43c70778 ("tty: serial: qcom-geni-serial: add support for serial engine DMA")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Viken Dadhaniya <viken.dadhaniya@oss.qualcomm.com>
    Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
    Link: https://patch.msgid.link/20260506-serial-dma-stale-tx-buf-v1-1-e3ccb360d719@oss.qualcomm.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

serial: sh-sci: fix memory region release in error path [+ + +]
Author: Hongling Zeng <zenghongling@kylinos.cn>
Date:   Tue Apr 21 14:57:37 2026 +0800

    serial: sh-sci: fix memory region release in error path
    
    commit 92b1ea22454b08a39baef3a7290fb3ec50366616 upstream.
    
    The sci_request_port() function uses request_mem_region() to reserve
    I/O memory, but in the error path when sci_remap_port() fails, it
    incorrectly calls release_resource() instead of release_mem_region().
    
    This mismatch can cause resource accounting issues. Fix it by using
    the correct release function, consistent with sci_release_port().
    
    Fixes: e2651647080930a1 ("serial: sh-sci: Handle port memory region reservations.")
    Cc: stable <stable@kernel.org>
    Reported-by: kernel test robot <lkp@intel.com>
    Reported-by: Dan Carpenter <error27@gmail.com>
    Closes: https://lore.kernel.org/r/202604032356.SzEjYkBC-lkp@intel.com/
    Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
    Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Link: https://patch.msgid.link/20260421065737.724187-1-zenghongling@kylinos.cn
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

serial: zs: Convert to use a platform device [+ + +]
Author: Maciej W. Rozycki <macro@orcam.me.uk>
Date:   Wed May 6 23:42:52 2026 +0100

    serial: zs: Convert to use a platform device
    
    commit 7cac59d08a73cb866ec51a483a6f3fe0f531947c upstream.
    
    Prevent a crash from happening as the first serial port is initialised:
    
      Console: switching to mono frame buffer device 160x64
      fb0: PMAG-AA frame buffer device at tc0
      DECstation Z85C30 serial driver version 0.10
      CPU 0 Unable to handle kernel paging request at virtual address 0000002c, epc == 803ab00c, ra == 803aafe0
      Oops[#1]:
      CPU: 0 PID: 1 Comm: swapper Not tainted 6.4.0-rc3-00031-g84a9582fd203-dirty #57
      $ 0   : 00000000 10012c00 803aaeb0 00000000
      $ 4   : 80e12f60 80e12f50 80e12f58 81000030
      $ 8   : 00000000 805ff37c 00000000 33433538
      $12   : 65732030 00000006 80c2915d 6c616972
      $16   : 80e12f00 807b7630 00000000 00000000
      $20   : 00000004 00000348 000001a0 807623b8
      $24   : 00000018 00000000
      $28   : 80c24000 80c25d60 8078b148 803aafe0
      Hi    : 00000000
      Lo    : 00000000
      epc   : 803ab00c serial_base_ctrl_add+0x78/0xf4
      ra    : 803aafe0 serial_base_ctrl_add+0x4c/0xf4
      Status: 10012c03      KERNEL EXL IE
      Cause : 00000008 (ExcCode 02)
      BadVA : 0000002c
      PrId  : 00000440 (R4400SC)
      Modules linked in:
      Process swapper (pid: 1, threadinfo=(ptrval), task=(ptrval), tls=00000000)
      Stack : 80760000 00000cc0 00400044 00400040 803aa02c 80d61ab8 00000000 807b7630
              80760000 807623b8 807b7628 803aa644 80386998 00000000 80e17780 80220f68
              80e17780 80d61ab8 80c17d80 80e17780 80e17780 8063c798 80e17780 80383fa0
              00000010 80e17780 00000000 80386998 807a0000 00000000 00400040 8038f848
              807623b8 80d61ab8 00000004 80e17780 00000000 803a68e4 80c25e2c 803bb884
              ...
      Call Trace:
      [<803ab00c>] serial_base_ctrl_add+0x78/0xf4
      [<803aa644>] serial_core_register_port+0x174/0x69c
      [<8077e9ac>] zs_init+0xc8/0xfc
      [<800404d4>] do_one_initcall+0x40/0x2ac
      [<8076cecc>] kernel_init_freeable+0x1e4/0x270
      [<80605bec>] kernel_init+0x20/0x108
      [<800431e8>] ret_from_kernel_thread+0x14/0x1c
    
      Code: 2442aeb0  ae120024  ae0200d0 <8c67002c> 50e00001  8c670000  3c06806e  3c05806e  afb30010
    
      ---[ end trace 0000000000000000 ]---
    
    (report at the offending commit) -- where a pointer is dereferenced that
    has been derived from a null pointer to the port's parent device.
    
    Since no device is available with legacy probing and it's not anymore a
    preferable way to discover devices anyway, switch the driver to using a
    platform device and use it as the port's parent device.  Update resource
    handling accordingly and only request the actual span of addresses used
    within the slot, which will have had its resource already requested by
    generic platform device code.
    
    Use platform_driver_probe() not just because SCC devices are fixed with
    solder on board and not straightforward to remove, but foremost because
    the associated TTY's major device number is the same as used by the dz
    driver and the first driver to claim it will prevent the other one from
    using it.  Either one DZ device or some SCC devices will be present in a
    given system but never both at a time, and therefore we want the major
    device number to be claimed by the first driver to actually successfully
    bind to its device and platform_driver_probe() is a way to fulfil that.
    
    An unfortunate consequence of the switch to a platform device is we now
    hand the console over from the bootconsole much later in the bootstrap.
    The firmware console handler appears good enough though to work so late
    and in particular with interrupts enabled.
    
    Since there is one way only remaining to reach zs_reset() now, remove
    the port initialisation marker as no longer needed and go through the
    channel reset unconditionally.
    
    Fixes: 84a9582fd203 ("serial: core: Start managing serial controllers to enable runtime PM")
    Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
    Cc: stable@vger.kernel.org # needs to use .remove_new for <= 6.10
    Link: https://patch.msgid.link/alpine.DEB.2.21.2605062328480.46195@angie.orcam.me.uk
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

serial: zs: Fix bootconsole handover lockup [+ + +]
Author: Maciej W. Rozycki <macro@orcam.me.uk>
Date:   Wed May 6 23:42:39 2026 +0100

    serial: zs: Fix bootconsole handover lockup
    
    commit 6c05cf72e13314ce9b770b5951695dc5a2152920 upstream.
    
    Calling zs_reset() in the course of setting up the serial device causes
    line parameters to be reset and the transmitter disabled.  We've been
    lucky in that no message is usually produced to the kernel log between
    this call and the later call to uart_set_options() in the course of
    console setup done by zs_serial_console_init(), or the system would hang
    as the console output handler in the firmware tried to access a port the
    transmitter of which has been disabled and line parameters messed up.
    
    This will change with the next change to the driver, so fix zs_reset()
    such that line parameters are set for 9600n8 console operation as with
    the system firmware and the transmitter re-enabled after reset.  This
    also means zs_pm() serves no purpose anymore, so drop it.
    
    Fixes: 8b4a40809e53 ("zs: move to the serial subsystem")
    Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
    Cc: stable@vger.kernel.org # v2.6.23+
    Link: https://patch.msgid.link/alpine.DEB.2.21.2605062308040.46195@angie.orcam.me.uk
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

serial: zs: Fix swapped RI/DSR modem line transition counting [+ + +]
Author: Maciej W. Rozycki <macro@orcam.me.uk>
Date:   Fri Apr 10 18:19:31 2026 +0100

    serial: zs: Fix swapped RI/DSR modem line transition counting
    
    commit d15cd40cb1858f75846eaafa9a6bca841b790a92 upstream.
    
    Fix a thinko in the status interrupt handler that has caused counters
    for the RI and DSR modem line transitions to be used for the other line
    each.
    
    Fixes: 8b4a40809e53 ("zs: move to the serial subsystem")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
    Link: https://patch.msgid.link/alpine.DEB.2.21.2604101747110.29980@angie.orcam.me.uk
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

serial: zs: Switch to using channel reset [+ + +]
Author: Maciej W. Rozycki <macro@orcam.me.uk>
Date:   Wed May 6 23:42:43 2026 +0100

    serial: zs: Switch to using channel reset
    
    commit 8572955630f30948837088aa98bcbe0532d1ceac upstream.
    
    Switch the driver to using the channel reset rather than hardware reset,
    simplifying handling by removing an interference between channels that
    causes the other channel to become uninitialised afterwards.
    
    There is little difference between the two kinds of reset in terms of
    register settings that result, and we initialise the whole register set
    right away anyway.  However this prevents a hang from happening should
    the console output handler in the firmware try to access the other port
    whose transmitter has been disabled and line parameters messed up.
    
    For example this will happen if the keyboard port (port A) is chosen for
    the system console, unusually but not insanely for a headless system, as
    the port is wired to a standard DA-15 connector and an adapter can be
    easily made.  Or with the next change in place this would happen for the
    regular console port (port B), since the keyboard port (port A) will be
    initialised first.
    
    Just remove the unnecessary complication then, a channel reset is good
    enough.  We still need the initialisation marker, now per channel rather
    than per SCC, as for the console port zs_reset() will be called twice:
    once early on via zs_serial_console_init() for the console setup only,
    and then again via zs_config_port() as the port is associated with a TTY
    device.
    
    Fixes: 8b4a40809e53 ("zs: move to the serial subsystem")
    Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
    Cc: stable@vger.kernel.org # v2.6.23+
    Link: https://patch.msgid.link/alpine.DEB.2.21.2605062323430.46195@angie.orcam.me.uk
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
thunderbolt: property: Cap recursion depth in __tb_property_parse_dir() [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
Date:   Fri Jun 5 15:33:10 2026 -0400

    thunderbolt: property: Cap recursion depth in __tb_property_parse_dir()
    
    [ Upstream commit 928abe19fbf0127003abcb1ea69cabc1c897d0ab ]
    
    A DIRECTORY entry's value field is used as the dir_offset for a
    recursive call into __tb_property_parse_dir() with no depth counter.
    A crafted peer that chains DIRECTORY entries into a back-reference
    loop drives the parser until the kernel stack is exhausted and the
    guard page fires.  Any untrusted XDomain peer (cable, dock, in-line
    inspector, adjacent host) that reaches the PROPERTIES_REQUEST
    control-plane exchange can trigger this without authentication.
    
    Thread a depth counter through tb_property_parse() and
    __tb_property_parse_dir(), and reject blocks that exceed
    TB_PROPERTY_MAX_DEPTH = 8.  That is comfortably larger than any
    observed legitimate XDomain layout.
    
    Operators who do not need XDomain host-to-host discovery can disable
    the path entirely with thunderbolt.xdomain=0 on the kernel command
    line.
    
    Fixes: cdae7c07e3e3 ("thunderbolt: Add support for XDomain properties")
    Cc: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4-6
    Assisted-by: Codex:gpt-5-4
    Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
    Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

thunderbolt: property: Reject dir_len < 4 to prevent size_t underflow [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
Date:   Sun May 10 19:16:57 2026 -0400

    thunderbolt: property: Reject dir_len < 4 to prevent size_t underflow
    
    commit de21b59c29e31c5108ddc04210631bbfab81b997 upstream.
    
    On the non-root path, __tb_property_parse_dir() takes dir_len from
    entry->length (u16 widened to size_t).  Two distinct OOB conditions
    follow when entry->length < 4:
    
    1. The non-root path begins with kmemdup(&block[dir_offset],
       sizeof(*dir->uuid), ...) which always reads 4 dwords from
       dir_offset.  tb_property_entry_valid() only enforces
       dir_offset + entry->length <= block_len, so a crafted entry
       with dir_offset close to the end of the property block and
       entry->length in 0..3 passes that gate but lets the UUID copy
       run off the block (e.g. dir_offset = 497, dir_len = 3 in a
       500-dword block reads block[497..501]).
    
    2. After the kmemdup, content_len = dir_len - 4 underflows size_t
       to ~SIZE_MAX, nentries becomes SIZE_MAX / 4, and the entry
       walk runs OOB on each iteration until an entry fails
       validation or the kernel oopses on an unmapped page.
    
    Reject dir_len < 4 on the non-root path *before* the UUID kmemdup,
    which closes both holes.
    
    Also move INIT_LIST_HEAD(&dir->properties) up to immediately after
    the dir allocation so the new error-return path (and the existing
    uuid-alloc failure path) calling tb_property_free_dir() sees a
    walkable list rather than the zero-initialized NULL next/prev that
    list_for_each_entry_safe() would oops on.
    
    Fixes: cdae7c07e3e3 ("thunderbolt: Add support for XDomain properties")
    Cc: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4-6
    Assisted-by: Codex:gpt-5-4
    Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
    Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

thunderbolt: property: Reject u32 wrap in tb_property_entry_valid() [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
Date:   Sun May 10 19:16:56 2026 -0400

    thunderbolt: property: Reject u32 wrap in tb_property_entry_valid()
    
    commit 01deda0152066c6c955f0619114ea6afa070aaec upstream.
    
    entry->value is u32 and entry->length is u16; the sum is performed in
    u32 and wraps.  A malicious XDomain peer can pick
    value = 0xffffff00, length = 0x100 so the sum 0x100000000 wraps to 0
    and passes the > block_len check.  tb_property_parse() then passes
    entry->value to parse_dwdata() as a dword offset into the property
    block, reading attacker-directed memory far past the allocation.
    
    For TEXT-typed entries with the "deviceid" or "vendorid" keys this
    lands in xd->device_name / xd->vendor_name and is readable back via
    the per-XDomain device_name / vendor_name sysfs attributes; the leak
    is NUL-bounded (kstrdup() stops at the first zero byte) and
    untargeted (the attacker picks a delta, not an absolute address).
    DATA-typed entries are parsed into property->value.data but not
    generically surfaced to userspace.
    
    Use check_add_overflow() so a wrapped sum is rejected.
    
    Fixes: cdae7c07e3e3 ("thunderbolt: Add support for XDomain properties")
    Cc: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4-6
    Assisted-by: Codex:gpt-5-4
    Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
    Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tty: serial: pch_uart: add check for dma_alloc_coherent() [+ + +]
Author: Zhaoyang Yu <2426767509@qq.com>
Date:   Thu Apr 9 13:41:58 2026 +0800

    tty: serial: pch_uart: add check for dma_alloc_coherent()
    
    commit 6fe472c1bbbe238e91141f7cabc1226e96a60d43 upstream.
    
    Add a check for dma_alloc_coherent() failure to prevent a potential
    NULL pointer dereference in dma_handle_rx(). Properly release DMA
    channels and the PCI device reference using a goto ladder if the
    allocation fails.
    
    Fixes: 3c6a483275f4 ("Serial: EG20T: add PCH_UART driver")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Zhaoyang Yu <2426767509@qq.com>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Link: https://patch.msgid.link/tencent_E328416B7CFD436F6029F2DF02AD7ED89C08@qq.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

tty: serial: samsung: Remove redundant port lock acquisition in rx helpers [+ + +]
Author: Tudor Ambarus <tudor.ambarus@linaro.org>
Date:   Fri May 15 12:41:21 2026 +0000

    tty: serial: samsung: Remove redundant port lock acquisition in rx helpers
    
    commit a3bb136bff5e6a5e48cdd813246c9c4686feaaa9 upstream.
    
    Sashiko identified a deadlock when the console flow is engaged [1].
    
    When console flow control is enabled (UPF_CONS_FLOW),
    s3c24xx_serial_stop_tx() calls s3c24xx_serial_rx_enable() and
    s3c24xx_serial_start_tx() calls s3c24xx_serial_rx_disable().
    
    The serial core framework invokes the .stop_tx() and .start_tx()
    callbacks with the port->lock spinlock already held. Furthermore, all
    internal driver paths that invoke stop_tx (such as the DMA TX
    completion handler s3c24xx_serial_tx_dma_complete() or the PIO TX IRQ
    handler s3c24xx_serial_tx_irq()) also acquire port->lock prior to
    calling it. (Note that s3c24xx_serial_start_tx() is only invoked by the
    serial core).
    
    However, s3c24xx_serial_rx_enable() and s3c24xx_serial_rx_disable()
    unconditionally attempt to acquire port->lock again using
    uart_port_lock_irqsave(). Since spinlocks are not recursive, this
    causes a deadlock on the same CPU when console flow control is engaged.
    
    Remove the redundant lock acquisition from both rx helper functions.
    
    Cc: stable <stable@kernel.org>
    Fixes: b497549a035c ("[ARM] S3C24XX: Split serial driver into core and per-cpu drivers")
    Reported-by: John Ogness <john.ogness@linutronix.de>
    Closes: https://sashiko.dev/#/patchset/20260506121606.5805-1-john.ogness%40linutronix.de [1]
    Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
    Link: https://patch.msgid.link/20260515-samsung-tty-flow-control-deadlock-v1-1-93255edbc9bc@linaro.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tun: free page on build_skb failure in tun_xdp_one() [+ + +]
Author: Weiming Shi <bestswngs@gmail.com>
Date:   Thu May 21 09:33:13 2026 -0700

    tun: free page on build_skb failure in tun_xdp_one()
    
    [ Upstream commit aa8963fdce667a42fb7f0bdd2909fadcab02f9a8 ]
    
    When build_skb() fails in tun_xdp_one(), the function sets ret to
    -ENOMEM and jumps to the out label, which returns without freeing the
    page that vhost_net_build_xdp() allocated for the frame. As with the
    short-frame rejection path, tun_sendmsg() discards the per-buffer error
    and still returns total_len, so vhost_tx_batch() takes the success path
    and never frees the page. Each build_skb() failure in a batch leaks one
    page-frag chunk.
    
    Free the page before taking the error path, matching the put_page() the
    other error exits of tun_xdp_one() already perform.
    
    Fixes: 043d222f93ab ("tuntap: accept an array of XDP buffs through sendmsg()")
    Reported-by: Xiang Mei <xmei5@asu.edu>
    Signed-off-by: Weiming Shi <bestswngs@gmail.com>
    Reviewed-by: Dongli Zhang <dongli.zhang@oracle.com>
    Reviewed-by: Willem de Bruijn <willemb@google.com>
    Link: https://patch.msgid.link/20260521163312.1479805-2-bestswngs@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

tun: free page on short-frame rejection in tun_xdp_one() [+ + +]
Author: Weiming Shi <bestswngs@gmail.com>
Date:   Wed May 20 09:00:21 2026 -0700

    tun: free page on short-frame rejection in tun_xdp_one()
    
    [ Upstream commit f4feb1e20058e407cb00f45aff47f5b7e19a6bbf ]
    
    tun_xdp_one() returns -EINVAL on a frame shorter than ETH_HLEN without
    freeing the page that vhost_net_build_xdp() allocated for it.
    tun_sendmsg() discards that -EINVAL and still returns total_len, so
    vhost_tx_batch() takes the success path and never frees the page; each
    short frame in a batch leaks one page-frag chunk.
    
    A local process that can open /dev/net/tun and /dev/vhost-net can hit
    this path: it attaches a tun/tap device as the vhost-net backend and
    feeds TX descriptors whose length minus the virtio-net header is below
    ETH_HLEN. Each kick leaks the page-frag chunks for that batch, and a
    tight submission loop exhausts host memory and triggers an OOM panic.
    Free the page before returning -EINVAL, matching the XDP-program error
    path in the same function.
    
    Fixes: 049584807f1d ("tun: add missing verification for short frame")
    Reported-by: Xiang Mei <xmei5@asu.edu>
    Signed-off-by: Weiming Shi <bestswngs@gmail.com>
    Reviewed-by: Dongli Zhang <dongli.zhang@oracle.com>
    Reviewed-by: Willem de Bruijn <willemb@google.com>
    Link: https://patch.msgid.link/20260520160020.375349-2-bestswngs@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
tunnels: do not assume transport header in iptunnel_pmtud_check_icmp() [+ + +]
Author: Eric Dumazet <edumazet@google.com>
Date:   Fri May 22 11:55:12 2026 +0000

    tunnels: do not assume transport header in iptunnel_pmtud_check_icmp()
    
    [ Upstream commit 509323077ef79a26ba0c60bb556e45c12c398b2d ]
    
    In some cases, iptunnel_pmtud_check_icmp() can be called while
    skb transport header is not set.
    
    This triggers an out-of-bound access, because
    (typeof(skb->transport_header))~0U is 65535.
    
    Access the icmp header based on IPv4 network header,
    after making sure icmp->type is present in skb linear part.
    
    Note that iptunnel_pmtud_check_icmpv6()) is fine.
    
    Fixes: 4cb47a8644cc ("tunnels: PMTU discovery support for directly bridged IP packets")
    Reported-by: Damiano Melotti <melotti@google.com>
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
    Link: https://patch.msgid.link/20260522115512.1519110-1-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

tunnels: load network headers after skb_cow() in iptunnel_pmtud_build_icmp[v6]() [+ + +]
Author: Eric Dumazet <edumazet@google.com>
Date:   Mon May 25 20:13:35 2026 +0000

    tunnels: load network headers after skb_cow() in iptunnel_pmtud_build_icmp[v6]()
    
    [ Upstream commit b4bc94353050b1fa7b702bd4c6600710dd926cff ]
    
    Sashiko found that iptunnel_pmtud_build_icmp() and
    iptunnel_pmtud_build_icmpv6() were caching ip_hdr() and ipv6_hdr()
    before an skb_cow() call which can reallocate skb->head.
    
    Fix this possible UAF by initializing the local variables
    after the skb_cow() call.
    
    Remove skb_reset_network_header() calls which were not needed.
    
    Fixes: 4cb47a8644cc ("tunnels: PMTU discovery support for directly bridged IP packets")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
    Link: https://patch.msgid.link/20260525201335.2361845-1-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
USB: cdc-acm: Fix bit overlap and move quirk definitions to header [+ + +]
Author: Wentao Guan <guanwentao@uniontech.com>
Date:   Fri May 22 17:13:58 2026 +0800

    USB: cdc-acm: Fix bit overlap and move quirk definitions to header
    
    commit 5eb070769ea5e18405535609d1d3f6886f3755bd upstream.
    
    The VENDOR_CLASS_DATA_IFACE and ALWAYS_POLL_CTRL quirk flags added in
    commit f58752ebcb35 ("USB: cdc-acm: Add quirks for Yoga Book 9 14IAH10
    INGENIC touchscreen") were placed inside the acm_ctrl_msg() function
    rather than in the header with the other quirk flags.  Then, their
    values (BIT(9) and BIT(10)) collided with NO_UNION_12 which is already
    BIT(9).
    
    Move the definitions to drivers/usb/class/cdc-acm.h where they belong
    and shift them to BIT(10) and BIT(11) to avoid the overlap.
    
    Fixes: f58752ebcb35 ("USB: cdc-acm: Add quirks for Yoga Book 9 14IAH10 INGENIC touchscreen")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
    Link: https://patch.msgid.link/20260522091357.1301196-1-guanwentao@uniontech.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
usb: cdns3: gadget: fix request skipping after clearing halt [+ + +]
Author: Yongchao Wu <yongchao.wu@autochips.com>
Date:   Thu May 14 00:00:12 2026 +0800

    usb: cdns3: gadget: fix request skipping after clearing halt
    
    commit c8778ff817a7047d6848fefba99dcb27b1bf01fe upstream.
    
    According to the cdns3 datasheet, the EPRST (Endpoint Reset) command
    causes the DMA engine to reposition its internal pointer to the next
    Transfer Descriptor (TD) if it was already processing one.
    
    This issue is consistently observed during the ADB identification
    process on macOS hosts, where the host issues a Clear_Halt. Although
    commit 4bf2dd65135a ("usb: cdns3: gadget: toggle cycle bit before reset
    endpoint") attempted to avoid DMA advance by toggling the cycle bit,
    trace logs show that on certain hosts like macOS, the DMA pointer
    (EP_TRADDR) still shifts after EPRST:
    
      cdns3_ctrl_req: Clear Endpoint Feature(Halt ep1out)
      cdns3_doorbell_epx: ep1out, ep_trbaddr f9c04030  <-- Should be f9c04000
      cdns3_gadget_giveback: ep1out: req: ... length: 16384/16384
    
    As shown above, the DMA pointer jumped to the next TD, causing
    the controller to skip the initial TRBs of the request. This leads to
    data misalignment and ADB protocol hangs on macOS.
    
    Fix this by manually restoring the EP_TRADDR register to the starting
    physical address of the current request after the EPRST operation is
    complete.
    
    Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver")
    Cc: stable <stable@kernel.org>
    Cc: Peter Chen <peter.chen@kernel.org>
    Signed-off-by: Yongchao Wu <yongchao.wu@autochips.com>
    Acked-by: Peter Chen <peter.chen@kernel.org>
    Link: https://patch.msgid.link/20260513160012.2547894-1-yongchao.wu@autochips.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: cdns3: plat: fix leaked usb2_phy initialization on usb3_phy acquisition failure [+ + +]
Author: Peter Chen <peter.chen@cixtech.com>
Date:   Wed May 13 16:53:09 2026 +0800

    usb: cdns3: plat: fix leaked usb2_phy initialization on usb3_phy acquisition failure
    
    commit e6970cda63fd4b4546aeed9d0e2f53a7c95cd09c upstream.
    
    Move usb2_phy initialization after usb3_phy acquisition.
    
    Fixes: f738957277ba ("usb: cdns3: Split core.c into cdns3-plat and core.c file")
    Cc: stable <stable@kernel.org>
    Reported-by: sashiko-bot <sashiko-bot@kernel.org>
    Closes: https://lore.kernel.org/linux-devicetree/agKaEePSFknhDBg2@nchen-desktop/T/#m21e1d9c1574eb127ce03c0c2a1a49002ce435b52
    Signed-off-by: Peter Chen <peter.chen@cixtech.com>
    Link: https://patch.msgid.link/20260513085310.2217547-2-peter.chen@cixtech.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: cdns3: plat: fix unbalanced pm_runtime_forbid() call permanently leaks the runtime PM usage counter across bind/unbind cycles [+ + +]
Author: Peter Chen <peter.chen@cixtech.com>
Date:   Wed May 13 16:53:10 2026 +0800

    usb: cdns3: plat: fix unbalanced pm_runtime_forbid() call permanently leaks the runtime PM usage counter across bind/unbind cycles
    
    commit ae6f3b82324e4f39ad8443c9020787e6fc889637 upstream.
    
    Call pm_runtime_allow(dev) conditionally at cdns3_plat_remove.
    
    Fixes: f738957277ba ("usb: cdns3: Split core.c into cdns3-plat and core.c file")
    Cc: stable <stable@kernel.org>
    Reported-by: sashiko-bot <sashiko-bot@kernel.org>
    Closes: https://lore.kernel.org/linux-devicetree/agKaEePSFknhDBg2@nchen-desktop/T/#m21e1d9c1574eb127ce03c0c2a1a49002ce435b52
    Signed-off-by: Peter Chen <peter.chen@cixtech.com>
    Link: https://patch.msgid.link/20260513085310.2217547-3-peter.chen@cixtech.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: chipidea: core: convert ci_role_switch to local variable [+ + +]
Author: Xu Yang <xu.yang_2@nxp.com>
Date:   Mon Apr 27 15:57:55 2026 +0800

    usb: chipidea: core: convert ci_role_switch to local variable
    
    commit 8f6aa392653e52a45858cff5c063df550028836b upstream.
    
    When a system contains multiple USB controllers, the global ci_role_switch
    variable may be overwritten by subsequent driver initialization code.
    
    This can cause issues in the following cases:
     - The 2nd ci_hdrc_probe() sees ci_role_switch.fwnode as non-NULL even
       though the "usb-role-switch" property is not present for the controller.
     - When the ci_hdrc device is unbound and bound again, ci_role_switch
       fwnode will not be reassigned, and the old value will be used instead.
    
    Convert ci_role_switch to a local variable to fix these issues.
    
    Fixes: 05559f10ed79 ("usb: chipidea: add role switch class support")
    Cc: stable <stable@kernel.org>
    Acked-by: Peter Chen <peter.chen@kernel.org>
    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
    Link: https://patch.msgid.link/20260427075755.3611217-1-xu.yang_2@nxp.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: core: Fix SuperSpeed root hub wMaxPacketSize [+ + +]
Author: Michal Pecio <michal.pecio@gmail.com>
Date:   Mon May 18 07:31:21 2026 +0200

    usb: core: Fix SuperSpeed root hub wMaxPacketSize
    
    commit d1e280334b7f0a1df441e08bd1f6a1bcc36b3bbb upstream.
    
    There is no good reason to have wBytesPerInterval < wMaxPacketSize -
    either one is too low or the other too high, and we may want to warn
    about such descriptors. Start with cleaning up our own root hubs.
    
    USB 3.2 section 10.15.1 sets wMaxPacketSize and wBytesPerInterval of
    SuperSpeed hub status endpoints at 2 bytes, so reduce wMaxPacketSize
    from its former value of 4, which was derived from USB 2.0 spec and
    the kernel's USB_MAXCHILDREN limit. They don't apply because USB 3.2
    10.15.2.1 specifies SuperSpeed hubs to have up to 15 ports.
    
    Suggested-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Signed-off-by: Michal Pecio <michal.pecio@gmail.com>
    Link: https://patch.msgid.link/20260518073121.7bc1da0f.michal.pecio@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: core: Fix up Interrupt IN endpoints with bogus wBytesPerInterval [+ + +]
Author: Michal Pecio <michal.pecio@gmail.com>
Date:   Mon May 18 07:32:07 2026 +0200

    usb: core: Fix up Interrupt IN endpoints with bogus wBytesPerInterval
    
    commit 727d045d064b7c9a24db3bce9c0485a382cb768b upstream.
    
    Tao Xue found that some common devices violate USB 3.x section 9.6.7
    by reporting wBytesPerInterval lower than the size of packets they
    actually send. I confirmed that AX88179 may set it to 0 and RTL8153
    CDC configuration sets it to 8 but sends both 8 and 16 byte packets:
    
    S Ii:11:007:3 -115:128 16 <
    C Ii:11:007:3 0:128 8 = a1000000 01000000
    S Ii:11:007:3 -115:128 16 <
    C Ii:11:007:3 0:128 16 = a12a0000 01000800 00000000 00000000
    
    Most xHCI host controllers neglect interrupt bandwidth reservations
    and let such devices exceed theirs, some fail the URB with EOVERFLOW.
    
    Assume that wBytesPerInterval lower than wMaxPacketSize is bogus and
    increase it to the worst case maximum on interrupt IN endpoints. This
    solves xHCI problems and appears to have no other effect. Interrupt
    transfers are not limited to one interval and drivers submit URBs of
    class defined size without looking at wBytesPerInterval. Any multi-
    interval transfer is considered terminated by a packet shorter than
    wMaxPacketSize regardless of wBytesPerInterval - see USB3 8.10.3.
    
    Stay in spec on OUT endpoints and isochronous. No buggy devices are
    known and we don't want to risk sending more data than the device
    is prepared to handle or confusing isoc drivers regarding altsetting
    capacities guaranteed by the device itself. And don't complain when
    wMaxPacketSize <= wBytesPerInterval < wMaxPacketSize * (bMaxBurst+1)
    because enabling this seems to be the exact goal of the spec.
    
    Reported-and-tested-by: Tao Xue <xuetao09@huawei.com>
    Closes: https://lore.kernel.org/linux-usb/20260402021400.28853-1-xuetao09@huawei.com/
    Cc: stable@vger.kernel.org
    Signed-off-by: Michal Pecio <michal.pecio@gmail.com>
    Link: https://patch.msgid.link/20260518073207.5b7d26e7.michal.pecio@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: dwc2: Fix use after free in debug code [+ + +]
Author: Dan Carpenter <error27@gmail.com>
Date:   Wed May 20 08:59:28 2026 +0300

    usb: dwc2: Fix use after free in debug code
    
    commit 9ea06a3fbf9f16e0d98c52cb3b99642be15ec281 upstream.
    
    We're not allowed to dereference "urb" after calling
    usb_hcd_giveback_urb() so save the urb->status ahead of time.
    
    Fixes: 7359d482eb4d ("staging: HCD files for the DWC2 driver")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Dan Carpenter <error27@gmail.com>
    Link: https://patch.msgid.link/ag1NwBpqT4IEQcdJ@stanley.mountain
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: dwc3: xilinx: fix error handling in zynqmp init error paths [+ + +]
Author: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Date:   Fri Jun 5 09:53:32 2026 -0400

    usb: dwc3: xilinx: fix error handling in zynqmp init error paths
    
    [ Upstream commit c1a0ecbf32c4b397353204e2ec94c5bb9f3300ed ]
    
    Fix error handling and resource cleanup i.e remove invalid
    phy_exit() after failed phy_init(), route failures through
    proper cleanup paths and return 0 explicitly on success.
    
    Fixes: 84770f028fab ("usb: dwc3: Add driver for Xilinx platforms")
    Cc: stable@vger.kernel.org
    Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
    Link: https://patch.msgid.link/20260519115529.2980421-1-radhey.shyam.pandey@amd.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: gadget: composite: fix integer underflow in WebUSB GET_URL handling [+ + +]
Author: Jeremy Erazo <mendozayt13@gmail.com>
Date:   Tue May 12 16:05:30 2026 +0000

    usb: gadget: composite: fix integer underflow in WebUSB GET_URL handling
    
    commit 6c5dbc104dadd79fc2923497c20bae759a18758c upstream.
    
    The WebUSB GET_URL handler in composite_setup() narrows
    landing_page_length to fit the host-supplied wLength using
    
            landing_page_length = w_length
                    - WEBUSB_URL_DESCRIPTOR_HEADER_LENGTH + landing_page_offset;
    
    If wLength is smaller than WEBUSB_URL_DESCRIPTOR_HEADER_LENGTH the
    unsigned subtraction wraps, and the subsequent
    
            memcpy(url_descriptor->URL,
                   cdev->landing_page + landing_page_offset,
                   landing_page_length - landing_page_offset);
    
    ends up copying close to UINT_MAX bytes from cdev->landing_page into
    cdev->req->buf.  KASAN reports a slab-out-of-bounds in composite_setup
    on the kmalloc-2k gadget_info allocation, and FORTIFY_SOURCE traps the
    memcpy as a 4294967293-byte field-spanning write into
    url_descriptor->URL (size 252).
    
    A USB host can reach this from a single SETUP packet against any
    gadget that has webusb/use=1 and a landingPage configured.
    
    Handle the small-wLength case before the math: when the host requested
    fewer bytes than the URL descriptor header, only the header is
    meaningful and no URL bytes need to be copied.  Setting
    landing_page_length to landing_page_offset makes the existing memcpy a
    no-op and leaves the descriptor returned to the host unchanged for all
    larger wLength values.
    
    Fixes: 93c473948c58 ("usb: gadget: add WebUSB landing page support")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Jeremy Erazo <mendozayt13@gmail.com>
    Link: https://patch.msgid.link/20260512160530.352318-1-mendozayt13@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: gadget: dummy_hcd: Reject hub port requests for non-existent ports [+ + +]
Author: Seungjin Bae <eeodqql09@gmail.com>
Date:   Mon May 18 19:43:14 2026 -0400

    usb: gadget: dummy_hcd: Reject hub port requests for non-existent ports
    
    commit 7d9633528dd40e33964d2dc74a5abbf5c4d116ce upstream.
    
    The `dummy_hub_control()` function handles USB hub class requests
    to the virtual root hub. The `GetPortStatus` case returns -EPIPE for
    requests with `wIndex != 1`, since the virtual root hub has only a
    single port. However, the `ClearPortFeature` and `SetPortFeature`
    cases lack the same check.
    
    Fix this by extending the `wIndex != 1` rejection to both cases,
    matching the existing behavior of `GetPortStatus`.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable <stable@kernel.org>
    Suggested-by: Alan Stern <stern@rowland.harvard.edu>
    Signed-off-by: Seungjin Bae <eeodqql09@gmail.com>
    Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
    Link: https://patch.msgid.link/20260518234314.1889396-1-eeodqql09@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: gadget: f_fs: copy only received bytes on short ep0 read [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
Date:   Sun Apr 19 12:03:59 2026 -0400

    usb: gadget: f_fs: copy only received bytes on short ep0 read
    
    commit 4e036c10e7f4df5d951c69cc3697bc8e209c6d02 upstream.
    
    ffs_ep0_read() allocates its control-OUT data buffer with
    kmalloc() (not kzalloc) at the Length value from the Setup
    packet, then copies that full len to userspace regardless of
    how many bytes were actually received:
    
        data = kmalloc(len, GFP_KERNEL);
        ...
        ret = __ffs_ep0_queue_wait(ffs, data, len);
        if ((ret > 0) && (copy_to_user(buf, data, len)))
                ret = -EFAULT;
    
    __ffs_ep0_queue_wait() returns req->actual, which on a short
    control OUT transfer is strictly less than len.  The
    copy_to_user() call still copies len bytes, so on a short OUT
    the last (len - ret) bytes of the kmalloc() buffer --
    uninitialised slab residue -- are delivered to the FunctionFS
    daemon.
    
    Short ep0 OUT completions are specified USB control-transfer
    behavior and are produced by in-tree UDCs:
    
      * dwc2 continues on req->actual < req->length for ep0 DATA OUT
        (short-not-ok is the only ep0-OUT stall path).
      * aspeed_udc ends ep0 OUT on rx_len < ep->ep.maxpacket.
      * renesas_usbf logs "ep0 short packet" and completes the
        request.
      * dwc3 stalls on short IN but not on short OUT.
    
    A short ep0 OUT is therefore not evidence of a broken UDC; it is
    a normal condition f_fs has to cope with.  The sibling gadgetfs
    implementation in drivers/usb/gadget/legacy/inode.c already does
    this correctly via min(len, dev->req->actual) before
    copy_to_user().  This patch brings f_fs.c to the same safe
    pattern rather than trimming at a defensive layer.
    
    The bug is reached from the FunctionFS device node, which in
    real deployments is owned by the privileged gadget daemon
    (adbd, UMS, composite gadget services, etc.); it is not
    reachable from unprivileged userspace.  Linux host stacks
    normally reject short-wLength control OUTs before they reach
    the gadget, so reproducing this required a build that
    bypasses that host-side check.  With the bypass in place, a
    1-byte payload on a 64-byte Setup produces 63 bytes of
    non-canary slab residue in the daemon's read buffer.
    
    Fix by copying only ret (actually received) bytes to
    userspace.
    
    Fixes: ddf8abd25994 ("USB: f_fs: the FunctionFS driver")
    Cc: stable <stable@kernel.org>
    Assisted-by: Claude:claude-opus-4-7
    Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
    Link: https://patch.msgid.link/20260419160359.1577270-1-michael.bommarito@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: gadget: f_fs: serialize DMABUF cancel against request completion [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
Date:   Sun Apr 19 12:12:27 2026 -0400

    usb: gadget: f_fs: serialize DMABUF cancel against request completion
    
    commit 2796646f6d892c1eb6818c7ca41fdfa12568e8d1 upstream.
    
    ffs_epfile_dmabuf_io_complete() calls usb_ep_free_request() on the
    completed request but leaves priv->req, the back-pointer that
    ffs_dmabuf_transfer() set on submission, pointing at the freed
    memory.  A later FUNCTIONFS_DMABUF_DETACH ioctl or
    ffs_epfile_release() on the close path still sees priv->req
    non-NULL under ffs->eps_lock:
    
        if (priv->ep && priv->req)
                usb_ep_dequeue(priv->ep, priv->req);
    
    so usb_ep_dequeue() is called on a freed usb_request.
    
    On dummy_hcd the dequeue path only walks a live queue and
    pointer-compares, so the freed pointer reads without faulting and
    KASAN requires an explicit check at the FunctionFS call site to
    surface the use-after-free.  On SG-capable in-tree UDCs the
    dequeue path dereferences the supplied request immediately:
    
      * chipidea's ep_dequeue() does
        container_of(req, struct ci_hw_req, req) and reads
        hwreq->req.status before acquiring its own lock.
      * cdnsp's cdnsp_gadget_ep_dequeue() reads request->status first.
    
    The narrower option of clearing priv->req via cmpxchg() in the
    completion does not close the race: the completion runs without
    eps_lock, so a cancel path holding eps_lock can still observe
    priv->req non-NULL, race a concurrent completion that clears and
    frees, and pass the freed pointer to usb_ep_dequeue().  A slightly
    longer fix that moves the free into the cleanup work is needed.
    
    Same class of lifetime race as the recent usbip-vudc timer fix [1].
    
    Take eps_lock in the sole place that mutates priv->req from the
    callback direction by moving usb_ep_free_request() out of the
    completion into ffs_dmabuf_cleanup(), the existing work handler
    scheduled by ffs_dmabuf_signal_done() on
    ffs->io_completion_wq.  Clear priv->req there under eps_lock
    before freeing, and only clear if priv->req still names our
    request (a subsequent ffs_dmabuf_transfer() on the same
    attachment may have queued a new one).
    
    This keeps the existing dummy_hcd sync-dequeue invariant: the
    completion callback is still invoked by the UDC without
    eps_lock held (dummy_hcd drops its own lock before calling the
    callback), and the callback now takes no f_fs lock at all.
    Serialization against the cancel path happens in cleanup, which
    runs from the workqueue with no f_fs lock held on entry.
    
    The priv ref count protects the containing ffs_dmabuf_priv:
    ffs_dmabuf_transfer() takes a ref via ffs_dmabuf_get(), cleanup
    drops it via ffs_dmabuf_put(), so priv stays live for the
    cleanup even after the cancel path's list_del + ffs_dmabuf_put.
    
    The ffs_dmabuf_transfer() error path no longer frees usb_req
    inline: fence->req and fence->ep are set before usb_ep_queue(),
    so ffs_dmabuf_cleanup() (scheduled by the error-path
    ffs_dmabuf_signal_done()) owns the free regardless of whether
    the queue succeeded.
    
    Reproduced under KASAN on both detach and close paths against
    dummy_hcd with an observability hook
    (kasan_check_byte(priv->req) immediately before usb_ep_dequeue)
    at the two FunctionFS cancel sites to surface the stale-pointer
    access; the hook is not part of this patch.  The KASAN
    allocator / free stacks in the captured splats identify the
    same request: alloc in dummy_alloc_request, free in
    dummy_timer, fault reached from ffs_epfile_release (close) and
    from the FUNCTIONFS_DMABUF_DETACH ioctl (detach).  With the
    patch applied, both paths are silent under the same hook.
    
    The bug is reached from the FunctionFS device node, which in
    real deployments is owned by the privileged gadget daemon
    (adbd, UMS, composite gadget services, etc.); it is not
    reachable from unprivileged userspace or from a USB host on the
    cable.  FunctionFS mounts default to GLOBAL_ROOT_UID, but the
    filesystem supports uid=, gid=, and fmode= delegation to a
    non-root gadget daemon, so on real deployments the attacker may
    be a less-privileged service rather than root.
    
    Fixes: 7b07a2a7ca02 ("usb: gadget: functionfs: Add DMABUF import interface")
    Link: https://lore.kernel.org/all/20260417163552.807548-1-michael.bommarito@gmail.com/ [1]
    Cc: stable <stable@kernel.org>
    Assisted-by: Claude:claude-opus-4-7
    Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
    Link: https://patch.msgid.link/20260419161227.1587668-1-michael.bommarito@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: gadget: f_hid: fix device reference leak in hidg_alloc() [+ + +]
Author: Guangshuo Li <lgs201920130244@gmail.com>
Date:   Mon Apr 13 22:21:19 2026 +0800

    usb: gadget: f_hid: fix device reference leak in hidg_alloc()
    
    commit 4f88d65def6f3c90121601b4f62a4c967f3063a6 upstream.
    
    hidg_alloc() initializes hidg->dev with device_initialize() before
    calling dev_set_name(). If dev_set_name() fails, the function currently
    jumps to err_unlock and returns without calling put_device().
    
    This leaves the device reference unbalanced and prevents hidg_release()
    from being called. Calling put_device() here is also safe, since
    hidg_release() only frees resources owned by hidg.
    
    The issue was identified by a static analysis tool I developed and
    confirmed by manual review.
    
    Route the dev_set_name() failure path through err_put_device so the
    device reference is dropped properly.
    
    Fixes: 89ff3dfac604 ("usb: gadget: f_hid: fix f_hidg lifetime vs cdev")
    Cc: stable <stable@kernel.org>
    Reviewed-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
    Reviewed-by: Johan Hovold johan@kernel.org
    Link: https://patch.msgid.link/20260413142119.2977716-1-lgs201920130244@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: gadget: net2280: Fix double free in probe error path [+ + +]
Author: Guangshuo Li <lgs201920130244@gmail.com>
Date:   Mon Apr 27 23:36:51 2026 +0800

    usb: gadget: net2280: Fix double free in probe error path
    
    commit c8547c74988e0b5f4cbb1b895e2a57aae084f070 upstream.
    
    usb_initialize_gadget() installs gadget_release() as the release
    callback for the embedded gadget device.  The struct net2280 instance is
    therefore released through gadget_release() when the gadget device's last
    reference is dropped.
    
    The probe error path calls net2280_remove(), which tears down the
    partially initialized device and drops the gadget reference with
    usb_put_gadget().  Calling kfree(dev) afterwards can free the same object
    again.
    
    Drop the explicit kfree() and let the gadget device release callback
    handle the final free.  This issue was found by a static analysis tool
    I am developing.
    
    Fixes: f770fbec4165 ("USB: UDC: net2280: Fix memory leaks")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
    Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
    Link: https://patch.msgid.link/20260427153651.337846-1-lgs201920130244@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: gadget: uvc: hold opts->lock across XU walks in uvc_function_bind [+ + +]
Author: Kai Aizen <kai.aizen.dev@gmail.com>
Date:   Thu Apr 30 20:56:43 2026 +0300

    usb: gadget: uvc: hold opts->lock across XU walks in uvc_function_bind
    
    commit 68aa70648b625fa684bc0b71bbfd905f4943ca20 upstream.
    
    uvc_function_bind() walks &opts->extension_units twice without holding
    opts->lock:
    
      - directly, for the iExtension string-descriptor fixup loop;
      - indirectly, four times via uvc_copy_descriptors() (once per speed),
        where the helper iterates uvc->desc.extension_units (which aliases
        &opts->extension_units) to size and emit XU descriptors.
    
    The configfs side (uvcg_extension_make / uvcg_extension_drop, in
    drivers/usb/gadget/function/uvc_configfs.c) takes opts->lock around its
    list_add_tail / list_del operations.  A privileged userspace process
    that holds the configfs subtree open and writes the gadget UDC name
    to bind the function while concurrently rmdir()'ing an extensions
    subdir can race uvcg_extension_drop() against the bind-time list walks
    and dereference a freed struct uvcg_extension.
    
    Hold opts->lock from the start of the XU string-descriptor fixup
    through the last uvc_copy_descriptors() call, releasing on the
    descriptor-error path via a new error_unlock label that drops the
    lock before falling through to the existing error label.  This
    matches the locking discipline of the configfs callbacks and removes
    the only remaining unsynchronised reader of the XU list during bind.
    
    Reachability: only privileged processes that can mount configfs and
    write to gadget UDC files can trigger the race, so this is a
    correctness fix rather than a security boundary.
    
    Fixes: 0525210c9840 ("usb: gadget: uvc: Allow definition of XUs in configfs")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Kai Aizen <kai.aizen.dev@gmail.com>
    Link: https://patch.msgid.link/20260430175643.67120-1-kai.aizen.dev@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: musb: omap2430: Fix use-after-free in omap2430_probe() [+ + +]
Author: Wentao Liang <vulab@iscas.ac.cn>
Date:   Fri Jun 5 09:57:44 2026 -0400

    usb: musb: omap2430: Fix use-after-free in omap2430_probe()
    
    [ Upstream commit e194ce048f5a6c549b3a23a8c568c6470f40f772 ]
    
    In omap2430_probe(), of_node_put(np) is called prematurely before the
    last access to np, leading to a use-after-free if the node's reference
    count drops to zero. Move the of_node_put() calls after the last use of
    np in both the success and error paths.
    
    Fixes: ffbe2feac59b ("usb: musb: omap2430: Fix probe regression for missing resources")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
    Link: https://patch.msgid.link/20260409101104.480623-1-vulab@iscas.ac.cn
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
USB: quirks: add NO_LPM for Lenovo ThinkPad USB-C Dock Gen2 hub controllers [+ + +]
Author: Stephen J. Fuhry <fuhrysteve@gmail.com>
Date:   Wed May 13 13:14:19 2026 -0400

    USB: quirks: add NO_LPM for Lenovo ThinkPad USB-C Dock Gen2 hub controllers
    
    commit 9ddb9c0deca48d2c2a22ebf4d2f35c925a520328 upstream.
    
    The Lenovo ThinkPad USB-C Dock Gen2 (17ef:a391, 17ef:a392) hub
    controllers exhibit link instability when USB Link Power Management
    is enabled, similar to the dock's Ethernet adapter (17ef:a387) which
    already carries USB_QUIRK_NO_LPM.
    
    When the dock reconnects after a transient disconnect, the hub
    controllers enter LPM states between re-enumeration retries, causing
    repeated disconnect/reconnect cycles lasting up to two minutes.
    Disabling LPM for these devices restores stable enumeration.
    
    Signed-off-by: Stephen J. Fuhry <fuhrysteve@gmail.com>
    Cc: stable <stable@kernel.org>
    Link: https://patch.msgid.link/20260513171419.44849-1-fuhrysteve@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: belkin_sa: validate interrupt status length [+ + +]
Author: Zhang Cen <rollkingzzc@gmail.com>
Date:   Tue May 19 19:11:50 2026 +0800

    USB: serial: belkin_sa: validate interrupt status length
    
    commit 4ce058df2ee02cc2a0f0fd5cd64ce6f1482a0b65 upstream.
    
    The Belkin interrupt callback treats interrupt data as a four-byte
    status report and reads LSR/MSR fields at offsets 2 and 3. The
    interrupt-in buffer length is derived from endpoint wMaxPacketSize, and
    short interrupt transfers may complete successfully with a smaller
    actual_length.
    
    Check the completed interrupt packet length before parsing status
    fields so short interrupt endpoints and short successful packets are
    ignored instead of causing out-of-bounds or stale status-byte reads.
    
    KASAN report as below:
    
    BUG: KASAN: slab-out-of-bounds in belkin_sa_read_int_callback()
    Read of size 1
    Call trace:
      belkin_sa_read_int_callback() (drivers/usb/serial/belkin_sa.c:202)
      __usb_hcd_giveback_urb() (drivers/usb/core/hcd.c:1630)
      dummy_timer() (?:?)
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Assisted-by: Codex:gpt-5.5
    Signed-off-by: Zhang Cen <rollkingzzc@gmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: cypress_m8: fix memory corruption with small endpoint [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Thu Jun 4 10:36:36 2026 +0200

    USB: serial: cypress_m8: fix memory corruption with small endpoint
    
    commit e1a9d791fd66ab2431b9e6f6f835823809869047 upstream.
    
    Make sure that the interrupt-out endpoint max packet size is at least
    eight bytes to avoid user-controlled slab corruption or NULL-pointer
    dereference should a malicious device report a smaller size.
    
    Fixes: 3416eaa1f8f8 ("USB: cypress_m8: Packet format is separate from characteristic size")
    Cc: stable@vger.kernel.org      # 2.6.26
    Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    [ johan: adjust context for 6.18 ]
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

USB: serial: cypress_m8: validate interrupt packet headers [+ + +]
Author: Zhang Cen <rollkingzzc@gmail.com>
Date:   Fri May 22 22:54:42 2026 +0800

    USB: serial: cypress_m8: validate interrupt packet headers
    
    commit 9f9bfc80c67f35a275820da7e83a35dface08281 upstream.
    
    cypress_read_int_callback() parses the interrupt-in buffer according to
    the selected Cypress packet format. Format 1 has a two-byte status/count
    header and format 2 has a one-byte combined status/count header. The
    usb-serial core sizes the interrupt-in buffer from the endpoint
    descriptor's wMaxPacketSize, and successful interrupt transfers can
    complete short when URB_SHORT_NOT_OK is not set.
    
    Check that the completed packet contains the selected header before
    reading it. Malformed short reports are ignored and the interrupt URB is
    resubmitted through the existing retry path, preventing out-of-bounds
    header-byte reads.
    
    KASAN report as below:
    KASAN slab-out-of-bounds in cypress_read_int_callback+0x240/0x7f0
    Read of size 1
    Call trace:
      cypress_read_int_callback() (drivers/usb/serial/cypress_m8.c:1009)
      __usb_hcd_giveback_urb()
      dummy_timer()
    
    Fixes: 3416eaa1f8f8 ("USB: cypress_m8: Packet format is separate from characteristic size")
    Assisted-by: Codex:gpt-5.5
    Signed-off-by: Zhang Cen <rollkingzzc@gmail.com>
    Fixes: 3416eaa1f8f8 ("USB: cypress_m8: Packet format is separate from characteristic size")
    Cc: stable@vger.kernel.org      # 2.6.26
    [ johan: use constants in header length sanity checks ]
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: digi_acceleport: fix memory corruption with small endpoints [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Thu Jun 4 14:07:58 2026 +0200

    USB: serial: digi_acceleport: fix memory corruption with small endpoints
    
    commit cb3560e8eab1dfa1cac1ed52631adf8ec6ff2cd5 upstream.
    
    Add the missing bulk-out buffer size sanity checks to avoid
    out-of-bounds memory accesses or slab corruption should a malicious
    device report smaller buffers than expected.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable@vger.kernel.org
    Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

USB: serial: keyspan: fix missing indat transfer sanity check [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Wed May 20 16:26:48 2026 +0200

    USB: serial: keyspan: fix missing indat transfer sanity check
    
    commit ab8336a7e414f018430aa1af3a46944032f7ff96 upstream.
    
    Add the missing sanity check on the size of usa49wg indat transfers to
    avoid parsing stale or uninitialised slab data.
    
    Fixes: 0ca1268e109a ("USB Serial Keyspan: add support for USA-49WG & USA-28XG")
    Cc: stable@vger.kernel.org      # 2.6.23
    Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: mct_u232: fix missing interrupt-in transfer sanity check [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Wed May 20 16:27:10 2026 +0200

    USB: serial: mct_u232: fix missing interrupt-in transfer sanity check
    
    commit 245aba83e3c288e176ed037a1f6b618b09e92ed8 upstream.
    
    Add the missing sanity check on the size of interrupt-in transfers to
    avoid parsing stale or uninitialised slab data (and leaking it to user
    space).
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable@vger.kernel.org
    Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: mxuport: fix memory corruption with small endpoint [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Fri May 22 16:19:50 2026 +0200

    USB: serial: mxuport: fix memory corruption with small endpoint
    
    commit 4085f0dbb1ce2251c9a5938d693de6593f0ab2bd upstream.
    
    Make sure that the bulk-out endpoint max packet size is at least eight
    bytes to avoid user-controlled slab corruption should a malicious device
    report a smaller size.
    
    Fixes: ee467a1f2066 ("USB: serial: add Moxa UPORT 12XX/14XX/16XX driver")
    Cc: stable@vger.kernel.org      # 3.14
    Cc: Andrew Lunn <andrew@lunn.ch>
    Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: omninet: fix memory corruption with small endpoint [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Fri May 22 16:20:58 2026 +0200

    USB: serial: omninet: fix memory corruption with small endpoint
    
    commit 60df93d30f9bdd27db17c4d80ed80ef718d7226b upstream.
    
    Make sure that the bulk-out buffers are at least as large as the
    hardcoded transfer size to avoid user-controlled slab corruption should
    a malicious device report a smaller endpoint max packet size than
    expected.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable@vger.kernel.org
    Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: option: add MeiG SRM813Q [+ + +]
Author: Jan Volckaert <janvolck@gmail.com>
Date:   Sun May 17 17:32:37 2026 +0200

    USB: serial: option: add MeiG SRM813Q
    
    commit 7d2b37d3e42d19071b62f4ddbee6e16e905efbf1 upstream.
    
    Add support for the Qualcomm Technology Snapdragon X35-based MeiG
    SRM813Q module.
    
    The module can be put in different modes via AT commands to
    enable/disable GPS functionality:
    
    MODEM - PPP mode(2dee:4d63): AT+SER=1,1
    
    If#= 0: RMNET
    If#= 1: DIAG/ADB
    If#= 2: MODEM
    If#= 3: AT
    
    P:  Vendor=2dee ProdID=4d63 Rev=05.15
    S:  Manufacturer=MEIG
    S:  Product=LTE-A Module
    S:  SerialNumber=1bd51f0e
    C:  #Ifs= 4 Cfg#= 1 Atr=80 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
    I:  If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(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=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(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=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    
    NMEA mode(2dee:4d64): AT+SER=51,1
    
    If#= 0: RMNET
    If#= 1: DIAG/ADB
    If#= 2: NMEA
    If#= 3: AT
    
    P:  Vendor=2dee ProdID=4d64 Rev=05.15
    S:  Manufacturer=MEIG
    S:  Product=LTE-A Module
    S:  SerialNumber=1bd51f0e
    C:  #Ifs= 4 Cfg#= 1 Atr=80 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
    I:  If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(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=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    
    Signed-off-by: Jan Volckaert <janvolck@gmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: option: add missing RSVD(5) flag for Rolling RW135R-GL [+ + +]
Author: Wanquan Zhong <wanquan.zhong@fibocom.com>
Date:   Wed May 20 19:32:45 2026 +0800

    USB: serial: option: add missing RSVD(5) flag for Rolling RW135R-GL
    
    commit 689f2facc689c8add11d7ff69fbbad17d65ee596 upstream.
    
    The RW135R-GL entry added in commit 01e8d0f74222 ("USB: serial: option:
    add support for Rolling Wireless RW135R-GL") was missing the
    .driver_info = RSVD(5) flag used by other Rolling Wireless MBIM laptop
    modules (e.g. RW135-GL and RW350-GL).
    
    Without this flag, the option driver incorrectly binds to the reserved
    ADB interface (If#5) in multi-interface USB modes, causing AT/MBIM
    communication failures after mode switching. This matches the handling
    of other Rolling Wireless MBIM devices.
    
    - VID:PID 33f8:1003, RW135R-GL for laptop debug M.2 cards (with MBIM
      interface for Linux/Chrome OS)
    
      0x1003: mbim, diag, AT, pipe
    
      Here are the outputs of usb-devices:
    
    T:  Bus=03 Lev=01 Prnt=01 Port=04 Cnt=02 Dev#=  8 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=33f8 ProdID=1003 Rev= 5.15
    S:  Manufacturer=Rolling Wireless S.a.r.l.
    S:  Product=Rolling RW135R-GL Module
    S:  SerialNumber=12345678
    C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA
    A:  FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
    I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    - VID:PID 33f8:1003, RW135R-GL for laptop debug M.2 cards (with MBIM
      interface for Linux/Chrome OS)
    
      0x1003: mbim, diag, AT, ADB, pipe
    
      Here are the outputs of usb-devices:
    
    T:  Bus=03 Lev=01 Prnt=01 Port=04 Cnt=02 Dev#=  7 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=33f8 ProdID=1003 Rev= 5.15
    S:  Manufacturer=Rolling Wireless S.a.r.l.
    S:  Product=Rolling RW135R-GL Module
    S:  SerialNumber=12345678
    C:* #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
    A:  FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
    I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
    E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    - VID:PID 33f8:1003, RW135R-GL for laptop debug M.2 cards (with MBIM
      interface for Linux/Chrome OS)
    
      0x1003: mbim, pipe
    
      Here are the outputs of usb-devices:
    
    T:  Bus=03 Lev=01 Prnt=01 Port=04 Cnt=02 Dev#=  9 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=33f8 ProdID=1003 Rev= 5.15
    S:  Manufacturer=Rolling Wireless S.a.r.l.
    S:  Product=Rolling RW135R-GL Module
    S:  SerialNumber=12345678
    C:* #Ifs= 3 Cfg#= 1 Atr=a0 MxPwr=500mA
    A:  FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
    I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    Fixes: 01e8d0f74222 ("USB: serial: option: add support for Rolling Wireless RW135R-GL")
    Signed-off-by: Wanquan Zhong <wanquan.zhong@fibocom.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: safe_serial: fix memory corruption with small endpoint [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Fri May 22 16:22:18 2026 +0200

    USB: serial: safe_serial: fix memory corruption with small endpoint
    
    commit 438061ed1ad85e6743e2dce826671772d81089ec upstream.
    
    Make sure that the bulk-out buffer size is at least eight bytes to avoid
    user-controlled slab corruption in "safe" mode should a malicious device
    report a smaller size.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable@vger.kernel.org
    Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
usb: storage: Add quirks for PNY Elite Portable SSD [+ + +]
Author: Sam Burkels <sam@1a38.nl>
Date:   Fri May 1 15:23:46 2026 +0200

    usb: storage: Add quirks for PNY Elite Portable SSD
    
    commit b53ebb811e00be50a779ce4e7aee604178b4a825 upstream.
    
    The PNY Elite Portable SSD (USB ID 154b:f009) is a sibling of the
    already-quirked PNY Pro Elite SSDs (154b:f00b and 154b:f00d). Like its
    siblings, it uses a Phison-based USB-SATA bridge that exhibits
    firmware bugs when bound to the uas driver.
    
    Without quirks, the device fails to complete READ CAPACITY commands
    when accessed over UAS on a SuperSpeed (USB 3) port. The device
    enumerates and reports as a SCSI direct-access device, but reports
    zero logical blocks and never finishes spin-up:
    
        usb 2-3: new SuperSpeed USB device number 8 using xhci_hcd
        usb 2-3: New USB device found, idVendor=154b, idProduct=f009
        usb 2-3: Product: PNY ELITE PSSD
        usb 2-3: Manufacturer: PNY
        scsi host0: uas
        scsi 0:0:0:0: Direct-Access     PNY      PNY ELITE PSSD   0
        sd 0:0:0:0: [sda] Spinning up disk...
        [...10+ seconds of polling, no progress...]
        sd 0:0:0:0: [sda] Read Capacity(16) failed: hostbyte=DID_ERROR
        sd 0:0:0:0: [sda] Read Capacity(10) failed: hostbyte=DID_ERROR
        sd 0:0:0:0: [sda] 0 512-byte logical blocks: (0 B/0 B)
    
    Tested each individual quirk to find the minimum that fixes this:
      - US_FL_NO_ATA_1X alone: device hangs on spin-up
      - US_FL_NO_REPORT_OPCODES alone: works on USB 2.0, hangs on USB 3.0
      - US_FL_NO_ATA_1X | US_FL_NO_REPORT_OPCODES: works on both
    
    With both quirks the device enumerates correctly while still using
    the uas driver, and delivers full UAS throughput (~281 MB/s
    sequential read on a USB 3.0 Gen 1 port).
    
    The existing PNY Pro Elite entries (f00b, f00d) only set NO_ATA_1X,
    but this device additionally chokes on REPORT OPCODES under
    SuperSpeed.
    
    Signed-off-by: Sam Burkels <sam@1a38.nl>
    Acked-by: Oliver Neukum <oneukum@suse.com>
    Cc: stable <stable@kernel.org>
    Link: https://patch.msgid.link/20260501132346.86572-1-sam@1a38.nl
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: typec: altmodes/displayport: validate count before reading Status Update VDO [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Wed May 13 17:52:49 2026 +0200

    usb: typec: altmodes/displayport: validate count before reading Status Update VDO
    
    commit 8a18f896e667df491331371b55d4ad644dc51d60 upstream.
    
    A broken/malicious device can send the incorrect count for a status
    update VDO, which will cause the kernel to read uninitialized stack data
    and send it off elsewhere.
    
    Fix this up by correctly verifying the count for the update object.
    
    Assisted-by: gkh_clanker_t1000
    Cc: stable <stable@kernel.org>
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Link: https://patch.msgid.link/2026051350-reacquire-sculpture-4244@gregkh
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: typec: tcpm/tcpci_maxim: validate header NDO against RX_BYTE_CNT [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Wed May 13 17:52:50 2026 +0200

    usb: typec: tcpm/tcpci_maxim: validate header NDO against RX_BYTE_CNT
    
    commit aa2f716327be1818e1cb156da8a2844804aaec2f upstream.
    
    A broken/malicious port can transmit a CRC-valid frame whose header
    advertises up to seven data objects but whose body carries fewer than
    that.  Check for this, and rightfully reject the message, instead of
    reading from uninitialized stack memory.
    
    Assisted-by: gkh_clanker_t1000
    Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Cc: "André Draszik" <andre.draszik@linaro.org>
    Cc: Badhri Jagan Sridharan <badhri@google.com>
    Cc: Amit Sunil Dhamne <amitsd@google.com>
    Cc: stable <stable@kernel.org>
    Link: https://patch.msgid.link/2026051350-sitter-canopener-9045@gregkh
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: typec: tcpm: bound altmode_desc[] per iteration in svdm_consume_modes() [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Wed May 13 17:52:53 2026 +0200

    usb: typec: tcpm: bound altmode_desc[] per iteration in svdm_consume_modes()
    
    commit 3389c149c68c3fea61910ad5d34f7bf3bff44e32 upstream.
    
    svdm_consume_modes() checks pmdata->altmodes against the array size once
    before the loop over the count, but forgot to check the bound at every
    point in the loop.
    
    In the well-behaved SVDM discovery flow this is harmless because each of
    at most SVID_DISCOVERY_MAX SVIDs contributes at most MODE_DISCOVERY_MAX
    modes, exactly filling altmode_desc[ALTMODE_DISCOVERY_MAX].  But the
    CMDT_RSP_ACK handler in tcpm_pd_svdm() does not correlate an incoming
    ACK with any request the port actually sent.  Once port->partner is set,
    an unsolicited Discover Modes ACK is consumed unconditionally.  A broken
    or malicious port partner can therefore drive altmodes to
    ALTMODE_DISCOVERY_MAX - 1 via the normal flow, and then send one extra
    Discover Modes ACK with seven VDOs.  Because the pre-loop check passes,
    the loop could then writes up to five entries past altmode_desc[].  For
    mode_data_prime the next field in struct tcpm_port is the
    partner_altmode[] pointer array, which then receives partner-chosen
    SVID/VDO bytes.
    
    Move the bound check inside the loop so the array can never be indexed
    past ALTMODE_DISCOVERY_MAX regardless of how many VDOs the partner
    supplies or how the function was reached.
    
    Assisted-by: gkh_clanker_t1000
    Cc: Badhri Jagan Sridharan <badhri@google.com>
    Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Cc: stable <stable@kernel.org>
    Link: https://patch.msgid.link/2026051351-reshuffle-skillful-90af@gregkh
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: typec: tcpm: improve handling of DISCOVER_MODES failures [+ + +]
Author: Sebastian Reichel <sebastian.reichel@collabora.com>
Date:   Wed Apr 29 18:33:32 2026 +0200

    usb: typec: tcpm: improve handling of DISCOVER_MODES failures
    
    commit c06e6cd488194e37ed4dc29d1488d1ffb760de60 upstream.
    
    UGREEN USB-C Multifunction Adapter Model CM512 (AKA "Revodok 107")
    exposes two SVIDs: 0xff01 (DP Alt Mode) and 0x1d5c. The DISCOVER_MODES
    step succeeds for 0xff01 and gets a NAK for 0x1d5c. Currently this
    results in DP Alt Mode not being registered either, since the modes
    are only registered once all of them have been discovered. The NAK
    results in the processing being stopped and thus no Alt modes being
    registered.
    
    Improve the situation by handling the NAK gracefully and continue
    processing the other modes.
    
    Before this change, the TCPM log ends like this:
    
    (more log entries before this)
    [    5.028287] AMS DISCOVER_SVIDS finished
    [    5.028291] cc:=4
    [    5.040040] SVID 1: 0xff01
    [    5.040054] SVID 2: 0x1d5c
    [    5.040082] AMS DISCOVER_MODES start
    [    5.040096] PD TX, header: 0x1b6f
    [    5.050946] PD TX complete, status: 0
    [    5.059609] PD RX, header: 0x264f [1]
    [    5.059626] Rx VDM cmd 0xff018043 type 1 cmd 3 len 2
    [    5.059640] AMS DISCOVER_MODES finished
    [    5.059644] cc:=4
    [    5.069994]  Alternate mode 0: SVID 0xff01, VDO 1: 0x000c0045
    [    5.070029] AMS DISCOVER_MODES start
    [    5.070043] PD TX, header: 0x1d6f
    [    5.081139] PD TX complete, status: 0
    [    5.087498] PD RX, header: 0x184f [1]
    [    5.087515] Rx VDM cmd 0x1d5c8083 type 2 cmd 3 len 1
    [    5.087529] AMS DISCOVER_MODES finished
    [    5.087534] cc:=4
    (no further log entries after this point)
    
    After this patch the TCPM log looks exactly the same, but then
    continues like this:
    
    [    5.100222] Skip SVID 0x1d5c (failed to discover mode)
    [    5.101699] AMS DFP_TO_UFP_ENTER_MODE start
    (log goes on as the system initializes DP AltMode)
    
    Cc: stable <stable@kernel.org>
    Fixes: 41d9d75344d9 ("usb: typec: tcpm: add discover svids and discover modes support for sop'")
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
    Reviewed-by: RD Babiera <rdbabiera@google.com>
    Reviewed-by: Badhri Jagan Sridharan <badhri@google.com>
    Link: https://patch.msgid.link/20260429-tcpm-discover-modes-nak-fix-v4-1-75945d0ed30f@collabora.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: typec: tcpm: validate VDO count in Discover Identity ACK handlers [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Wed May 13 17:52:51 2026 +0200

    usb: typec: tcpm: validate VDO count in Discover Identity ACK handlers
    
    commit 8fbc349e8383125dd2d8de1c1e926279d398ab17 upstream.
    
    Properly validate the count passed from a device when calling
    svdm_consume_identity() or svdm_consume_identity_sop_prime() as the
    device-controlled value could index off of the static arrays, which
    could leak data.
    
    Assisted-by: gkh_clanker_t1000
    Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Cc: stable <stable@kernel.org>
    Reviewed-by: Badhri Jagan Sridharan <badhri@google.com>
    Link: https://patch.msgid.link/2026051350-plated-salute-0efe@gregkh
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: typec: ucsi: ccg: reject firmware images without a ':' record header [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Thu May 14 19:10:06 2026 +0200

    usb: typec: ucsi: ccg: reject firmware images without a ':' record header
    
    commit d7486952bf74e546ee3748fb14b2d07881fa6273 upstream.
    
    do_flash() locates the first .cyacd record with
    
            p = strnchr(fw->data, fw->size, ':');
            while (p < eof) {
                    s = strnchr(p + 1, eof - p - 1, ':');
                    ...
            }
    
    If the firmware image contains no ':' byte,  strnchr() returns NULL.
    NULL compares less than the valid kernel pointer eof, so the loop body
    runs and strnchr() is called with p + 1 == (void *)1 and a length of
    roughly (unsigned long)eof, causing a wonderful crash.
    
    The not_signed_fw fallthrough earlier in do_flash() and the chip-state
    branches in ccg_fw_update_needed() allow an unsigned blob to reach this
    loop, so a root user who can place a crafted file under /lib/firmware
    and write the do_flash sysfs attribute can trigger the oops.
    
    Bail out with -EINVAL when the initial strnchr() returns NULL.
    
    Assisted-by: gkh_clanker_t1000
    Cc: stable <stable@kernel.org>
    Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Link: https://patch.msgid.link/2026051405-posture-shrill-7884@gregkh
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: typec: ucsi: Check if power role change actually happened before handling [+ + +]
Author: Myrrh Periwinkle <myrrhperiwinkle@qtmlabs.xyz>
Date:   Fri Jun 5 14:31:35 2026 -0400

    usb: typec: ucsi: Check if power role change actually happened before handling
    
    [ Upstream commit b80e7d34c7ea6a564525119d6138fbb577a23dba ]
    
    The CrOS EC may send a connector status change event with the power
    direction changed flag set even if the power direction hasn't actually
    changed after initiating a SET_PDR command internally [1]. In practice
    this happens on every system suspend due to other changes performed by
    the EC [2][3][4], causing suspend to fail.
    
    Fix this by checking if the power role change actually happened before
    handling it.
    
    [1]: https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/platform/ec/zephyr/subsys/pd_controller/pdc_power_mgmt.c;l=1689;drc=2d5a1cffce4e5ac8a39442cb3b764d2d5e1cf794
    [2]: https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/platform/ec/zephyr/subsys/pd_controller/pdc_power_mgmt.c;l=3923;drc=2d5a1cffce4e5ac8a39442cb3b764d2d5e1cf794
    [3]: https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/platform/ec/zephyr/subsys/pd_controller/pdc_power_mgmt.c;l=5094;drc=2d5a1cffce4e5ac8a39442cb3b764d2d5e1cf794
    [4]: https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/platform/ec/zephyr/subsys/pd_controller/pdc_power_mgmt.c;l=2229;drc=2d5a1cffce4e5ac8a39442cb3b764d2d5e1cf794
    
    Cc: stable <stable@kernel.org>
    Fixes: 7616f006db07 ("usb: typec: ucsi: Update power_supply on power role change")
    Signed-off-by: Myrrh Periwinkle <myrrhperiwinkle@qtmlabs.xyz>
    Reported-and-tested-by: Sergey Senozhatsky <senozhatsky@chromium.org>
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Link: https://patch.msgid.link/20260519-ucsi-fix-2-v1-1-6f1239535187@qtmlabs.xyz
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: typec: ucsi: displayport: NAK DP_CMD_CONFIGURE without a payload VDO [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Wed May 13 17:52:54 2026 +0200

    usb: typec: ucsi: displayport: NAK DP_CMD_CONFIGURE without a payload VDO
    
    commit 167dd8d12226587ee554f520aed0256b7769cd5d upstream.
    
    ucsi_displayport_vdm() handles a DP_CMD_CONFIGURE by copying the first
    payload VDO from data[], but unlike the equivalent handler in
    altmodes/displayport.c it does not check that count covers a VDO beyond
    the header.  A header-only Configure VDM (count == 1) would read one u32
    past the caller's array.
    
    In the normal UCSI path the caller controls count, so this is hardening
    for non-standard delivery paths.  NAK and bail when no configuration VDO
    is present, matching the generic DP altmode driver's existing guard.
    
    Assisted-by: gkh_clanker_t1000
    Cc: Pooja Katiyar <pooja.katiyar@intel.com>
    Cc: Johan Hovold <johan@kernel.org>
    Cc: stable <stable@kernel.org>
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Link: https://patch.msgid.link/2026051351-vividly-flattered-eb3d@gregkh
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: typec: ucsi: Don't update power_supply on power role change if not connected [+ + +]
Author: Myrrh Periwinkle <myrrhperiwinkle@qtmlabs.xyz>
Date:   Sat Jun 6 08:18:59 2026 -0400

    usb: typec: ucsi: Don't update power_supply on power role change if not connected
    
    [ Upstream commit d98d413ca65d0790a8f3695d0a5845538958ab84 ]
    
    We only need to update the power_supply on power role change if the port
    is connected, because otherwise the online status should be the same for
    both cases.
    
    Cc: stable <stable@kernel.org>
    Fixes: 7616f006db07 ("usb: typec: ucsi: Update power_supply on power role change")
    Signed-off-by: Myrrh Periwinkle <myrrhperiwinkle@qtmlabs.xyz>
    Reported-and-tested-by: Sergey Senozhatsky <senozhatsky@chromium.org>
    Link: https://patch.msgid.link/20260519-ucsi-fix-2-v1-2-6f1239535187@qtmlabs.xyz
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    [ This is documentation for an already-completed backport. The change is described clearly.
    
    "translated upstream `UCSI_CONSTAT(con, CONNECTED)` accessor macro to in-tree idiom `con->status.flags & UCSI_CONSTAT_CONNECTED`" ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: typec: ucsi: validate connector number in ucsi_connector_change() [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Wed May 13 17:52:55 2026 +0200

    usb: typec: ucsi: validate connector number in ucsi_connector_change()
    
    commit 288a81a8507052bcfbf884d39a463c44c42c5fd9 upstream.
    
    The connector number in a UCSI CCI notification is a 7-bit field
    supplied by the PPM.  ucsi_connector_change() uses it to index the
    ucsi->connector[] array without checking it against the number of
    connectors the PPM reported at init time, so a buggy or malicious PPM
    (EC firmware, or an I2C-attached UCSI controller on the ccg / stm32g0 /
    glink transports) can drive schedule_work() on memory past the end of
    the array.
    
    Reject connector numbers that are zero or exceed cap.num_connectors
    before dereferencing the array.
    
    Assisted-by: gkh_clanker_t1000
    Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Cc: Benson Leung <bleung@chromium.org>
    Cc: Jameson Thies <jthies@google.com>
    Cc: Nathan Rebello <nathan.c.rebello@gmail.com>
    Cc: Johan Hovold <johan@kernel.org>
    Cc: Pooja Katiyar <pooja.katiyar@intel.com>
    Cc: Hsin-Te Yuan <yuanhsinte@chromium.org>
    Cc: Abel Vesa <abelvesa@kernel.org>
    Cc: stable <stable@kernel.org>
    Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Reviewed-by: Benson Leung <bleung@chromium.org>
    Link: https://patch.msgid.link/2026051351-truck-steadfast-df48@gregkh
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: typec: wcove: don't write past struct pd_message in wcove_read_rx_buffer() [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Wed May 13 17:52:48 2026 +0200

    usb: typec: wcove: don't write past struct pd_message in wcove_read_rx_buffer()
    
    commit 4af7ad0e6d7aa4403dbb1dac7b9659b0421efcaa upstream.
    
    wcove_read_rx_buffer() copies the PD RX FIFO into the caller's
    struct pd_message with
    
            for (i = 0; i < USBC_RXINFO_RXBYTES(info); i++)
                    regmap_read(wcove->regmap, USBC_RX_DATA + i, msg + i);
    
    which has two problems:
    
    USBC_RXINFO_RXBYTES() is a 5-bit field (max 31) while struct pd_message
    is 30 bytes (__le16 header + __le32 payload[PD_MAX_PAYLOAD], packed).
    The byte count latched in RXINFO is the number of bytes the port partner
    put on the wire, so a malicious partner that transmits a 31-byte frame
    can drive the loop one byte past the destination if the WCOVE BMC
    receiver does not enforce the PD object-count limit in hardware. The
    existing FIXME flagged this as unverified.
    
    Independently, regmap_read() takes an unsigned int * and stores a full
    unsigned int at the destination. Passing the byte pointer msg + i means
    each iteration writes four bytes; the high three are zero (val_bits is
    8) and are normally overwritten by the next iteration, but the final
    iteration's high bytes are not. With RXBYTES == 30 the i == 29 iteration
    already writes three zero bytes past msg, which sits on the IRQ thread's
    stack in wcove_typec_irq().
    
    Clamp the loop to sizeof(struct pd_message) and read each register into
    a local before storing only its low byte, so the copy can never exceed
    the destination regardless of what RXINFO reports.
    
    Assisted-by: gkh_clanker_t1000
    Cc: stable <stable@kernel.org>
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Link: https://patch.msgid.link/2026051347-clustered-deflected-9543@gregkh
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: usbtmc: check URB actual_length for interrupt-IN notifications [+ + +]
Author: Heitor Alves de Siqueira <halves@igalia.com>
Date:   Tue May 5 15:56:03 2026 -0300

    usb: usbtmc: check URB actual_length for interrupt-IN notifications
    
    commit 52f2ad3f7e5eb3b5908e1d685d4342519dc9cfcd upstream.
    
    USBTMC devices can use an optional interrupt endpoint for notification
    messages. These typically contain two-byte headers indicating the
    payload format, but the driver does not check if these headers are
    present before accessing the data buffers. In cases where the URB
    actual_length is not enough to fit these headers, the driver will either
    cause an out-of-bounds read, or consume stale leftover data from a
    previous notification.
    
    Fix by checking if actual_data contains enough bytes for the headers,
    otherwise resubmit URB to the interrupt endpoint.
    
    Fixes: dbf3e7f654c0 ("Implement an ioctl to support the USMTMC-USB488 READ_STATUS_BYTE operation.")
    Reported-by: syzbot+abbfd103085885cf16a2@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=abbfd103085885cf16a2
    Cc: stable <stable@kernel.org>
    Suggested-by: Michal Pecio <michal.pecio@gmail.com>
    Signed-off-by: Heitor Alves de Siqueira <halves@igalia.com>
    Link: https://patch.msgid.link/20260505-usbtmc-iin-size-v3-1-a36113f62db7@igalia.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: usbtmc: reject interrupt endpoints with small wMaxPacketSize [+ + +]
Author: Heitor Alves de Siqueira <halves@igalia.com>
Date:   Tue May 5 15:56:04 2026 -0300

    usb: usbtmc: reject interrupt endpoints with small wMaxPacketSize
    
    commit 121d2f682ba912b1427cddca7cf84840f41cc620 upstream.
    
    The USB488 subclass specification requires interrupt wMaxPacketSize to
    be 0x02, unless the device sends vendor-specific notifications.
    Endpoints that advertise less than 2 bytes for wMaxPacketSize are
    unlikely to work with the current driver, as URBs will not have enough
    space for interrupt headers. Considering that any notification URBs will
    be ignored by the driver, reject these endpoints early during probe.
    
    Fixes: 041370cce889 ("USB: usbtmc: refactor endpoint retrieval")
    Cc: stable <stable@kernel.org>
    Suggested-by: Michal Pecio <michal.pecio@gmail.com>
    Signed-off-by: Heitor Alves de Siqueira <halves@igalia.com>
    Link: https://patch.msgid.link/20260505-usbtmc-iin-size-v3-2-a36113f62db7@igalia.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
usbip: vudc: Fix use after free bug in vudc_remove due to race condition [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
Date:   Fri Apr 17 12:35:52 2026 -0400

    usbip: vudc: Fix use after free bug in vudc_remove due to race condition
    
    commit d96209626a29ea64666be98c30b30ac82e5f1be6 upstream.
    
    This patch follows up Zheng Wang's 2023 report of a use-after-free in
    vudc_remove(). The original thread stalled on Shuah Khan's request for
    runtime testing of the unplug/unbind path. This patch supplies that
    testing and keeps Zheng's original fix shape.
    
    In vudc_probe(), v_init_timer() binds udc->tr_timer.timer to v_timer().
    usbip_sockfd_store() starts the timer via v_start_timer()/v_kick_timer().
    vudc_remove() can then free the containing struct vudc while the timer is
    still pending or executing.
    
    KASAN confirms the race on an unpatched x86_64 QEMU guest with
    CONFIG_KASAN=y, CONFIG_USBIP_VUDC=y, CONFIG_USB_ZERO=y, and a tight loop
    that repeatedly writes a socket fd to usbip_sockfd, closes the socket
    pair, and unbinds/rebinds usbip-vudc.0:
    
      BUG: KASAN: slab-use-after-free in __run_timer_base.part.0+0x8ba/0x8e0
      Write of size 8 at addr ffff888001b80740 by task trigger_and_unb/239
      Allocated by task 239:
        vudc_probe+0x4d/0xaa0
      Freed by task 239:
        kfree+0x18f/0x520
        device_release_driver_internal+0x388/0x540
        unbind_store+0xd9/0x100
    
    This lands in the timer core rather than v_timer() itself because the
    embedded timer_list is being walked after its containing struct vudc has
    already been freed. The underlying lifetime bug is the same one Zheng
    reported.
    
    With v_stop_timer() called from vudc_remove() and the timer deleted
    synchronously, the same harness completed 5000 bind/unbind iterations
    with no KASAN report.
    
    Fixes: b6a0ca111867 ("usbip: vudc: Add UDC specific ops")
    Cc: stable <stable@kernel.org>
    Reported-by: Zheng Wang <zyytlz.wz@163.com>
    Closes: https://lore.kernel.org/linux-usb/20230317100954.2626573-1-zyytlz.wz@163.com/
    Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
    Acked-by: Shuah Khan <skhan@linuxfoundation.org>
    Link: https://patch.msgid.link/20260417163552.807548-1-michael.bommarito@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
vsock: keep poll shutdown state consistent [+ + +]
Author: Ziyu Zhang <ziyuzhang201@gmail.com>
Date:   Wed May 20 00:56:36 2026 +0800

    vsock: keep poll shutdown state consistent
    
    [ Upstream commit aae9d8a5528b8ee9ff8dc5d3558b8a9f852a724a ]
    
    vsock_poll() reads vsk->peer_shutdown before taking the socket lock
    to set EPOLLHUP and EPOLLRDHUP, then reads it again after taking
    the lock to report EOF readability. A shutdown packet can update
    peer_shutdown while poll is waiting for the lock, so one poll invocation
    can report EOF readability without the corresponding HUP/RDHUP bits.
    
    For connectible sockets, take one peer_shutdown snapshot after
    lock_sock() and use it for all peer-shutdown-derived poll bits. For
    datagram sockets, which do not take lock_sock() in poll(), take one
    lockless READ_ONCE() snapshot and pair it with WRITE_ONCE() on the
    writer side.
    
    This keeps the peer-shutdown-derived bits internally consistent for each
    poll pass.
    
    Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")
    Signed-off-by: Ziyu Zhang <ziyuzhang201@gmail.com>
    Link: https://patch.msgid.link/20260519165636.62542-1-ziyuzhang201@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
vxlan: do not reuse cached ip_hdr() value after skb_tunnel_check_pmtu() [+ + +]
Author: Eric Dumazet <edumazet@google.com>
Date:   Mon May 25 20:36:42 2026 +0000

    vxlan: do not reuse cached ip_hdr() value after skb_tunnel_check_pmtu()
    
    [ Upstream commit 7d9ef0cb271555d8cf39fefe6c981e1493b25ecf ]
    
    skb_tunnel_check_pmtu() can change skb->head.
    
    Reusing old_iph afer skb_tunnel_check_pmtu() can cause an UAF.
    
    Use instead ip_hdr(skb) as done in drivers/net/bareudp.c
    and drivers/net/geneve.c.
    
    Found by Sashiko.
    
    Fixes: 4cb47a8644cc ("tunnels: PMTU discovery support for directly bridged IP packets")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
    Link: https://patch.msgid.link/20260525203642.2389723-1-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
wireguard: send: append trailer after expanding head [+ + +]
Author: Jason A. Donenfeld <Jason@zx2c4.com>
Date:   Fri May 29 19:31:34 2026 +0200

    wireguard: send: append trailer after expanding head
    
    commit f75e3eb08fe31d30a9af6ed80cdd22e6772837e2 upstream.
    
    With how this is currently written, we add the trailer, zero it out, and
    then add the header space on. If that header space requires a
    reallocation + copy, the zeros in the trailer aren't copied, because the
    skb len hasn't actually been yet expanded to cover that. Instead add the
    padding at the end of the process rather than at the beginning.
    
    Fixes: e7096c131e51 ("net: WireGuard secure network tunnel")
    Cc: stable@vger.kernel.org
    Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
    Link: https://patch.msgid.link/20260529173134.3080773-2-Jason@zx2c4.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
x86/alternatives: Rename 'apply_relocation()' to 'text_poke_apply_relocation()' [+ + +]
Author: Ingo Molnar <mingo@kernel.org>
Date:   Sat Jun 6 08:19:05 2026 -0400

    x86/alternatives: Rename 'apply_relocation()' to 'text_poke_apply_relocation()'
    
    [ Upstream commit 023f42dd59203be8ad2fc0574af32d3b4ad041ec ]
    
    Join the text_poke_*() API namespace.
    
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Cc: Juergen Gross <jgross@suse.com>
    Cc: "H . Peter Anvin" <hpa@zytor.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Link: https://lore.kernel.org/r/20250411054105.2341982-52-mingo@kernel.org
    Stable-dep-of: a17dc12bfed8 ("x86/ftrace: Relocate %rip-relative percpu refs in dynamic trampolines")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
x86/boot: Disable stack protector for early boot code [+ + +]
Author: Brian Gerst <brgerst@gmail.com>
Date:   Thu Jan 23 14:07:35 2025 -0500

    x86/boot: Disable stack protector for early boot code
    
    [ Upstream commit a9a76b38aaf577887103e3ebb41d70e6aa5a4b19 ]
    
    On 64-bit, this will prevent crashes when the canary access is changed
    from %gs:40 to %gs:__stack_chk_guard(%rip).  RIP-relative addresses from
    the identity-mapped early boot code will target the wrong address with
    zero-based percpu.  KASLR could then shift that address to an unmapped
    page causing a crash on boot.
    
    This early boot code runs well before user-space is active and does not
    need stack protector enabled.
    
    Signed-off-by: Brian Gerst <brgerst@gmail.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Link: https://lore.kernel.org/r/20250123190747.745588-4-brgerst@gmail.com
    Stable-dep-of: 917e3ad3321e ("x86/kexec: Disable KCOV instrumentation after load_segments()")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
x86/ftrace: Relocate %rip-relative percpu refs in dynamic trampolines [+ + +]
Author: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
Date:   Sat Jun 6 08:19:06 2026 -0400

    x86/ftrace: Relocate %rip-relative percpu refs in dynamic trampolines
    
    [ Upstream commit a17dc12bfed8868e6a86f3b45c16065a70641acb ]
    
    With CONFIG_CALL_DEPTH_TRACKING enabled on an x86 retbleed-affected platform
    (eg: Skylake), with retbleed=stuff, registering a dynamic ftrace trampoline
    crashes on the first call into the traced function:
    
      BUG: unable to handle page fault for address: ffff88817ae18880
      #PF: supervisor write access in kernel mode
      #PF: error_code(0x0002) - not-present page
      PGD 4b53067 P4D 4b53067 PUD 0
      Oops: Oops: 0002 [#1] SMP PTI
      CPU: 3 UID: 0 PID: 187 Comm: usleep Not tainted 7.0.10 #243 PREEMPT(full)
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Arch Linux 1.17.0-2-2 04/01/2014
      Code: 24 78 00 00 00 00 48 89 ea 48 89 54 24 20 48 8b b4 24 b8 00 00 00 48 8b bc 24 b0 00 00 00 48 89 bc 24 80 00 00 00 48 83 ef 05 <65> 48 c1 3d 1f a8 b6 02 05 48 8b 15 f6 00 00 00 4c 89 3c 24 4c 89
      Call Trace:
       <TASK>
       ? find_held_lock
       ? exc_page_fault
       ? lock_release
       ? __x64_sys_clock_nanosleep
       ? lockdep_hardirqs_on_prepare
       ? trace_hardirqs_on
       __x64_sys_clock_nanosleep
       do_syscall_64
       ? exc_page_fault
       ? call_depth_return_thunk
       entry_SYSCALL_64_after_hwframe
      ...
      Kernel panic - not syncing: Fatal exception
    
    This small reproducer allows to easily trigger the crash:
    
      # echo 'p __x64_sys_clock_nanosleep' > /sys/kernel/tracing/kprobe_events
      # echo 1 > /sys/kernel/tracing/events/kprobes/p___x64_sys_clock_nanosleep_0/enable
      # usleep 1
    
    Monitoring the crash under GDB points to the exact instruction in charge of
    incrementing the call depth:
    
      sarq $5, %gs:__x86_call_depth(%rip)
    
    This instruction matches the one inserted by the ftrace_regs_caller from
    ftrace_64.S. This emitted code was likely working fine until the introduction
    of
    
      59bec00ace28 ("x86/percpu: Introduce %rip-relative addressing to PER_CPU_VAR()"):
    
    it has made the call depth accounting addressing relative to $rip, instead of
    being based on an absolute address.
    
    As this code exact location depends on where the trampoline lives in memory,
    the corresponding displacement needs to be adjusted at runtime to actually
    correctly find the per-cpu __x86_call_depth value, otherwise the targeted
    address is wrong, leading to the page fault seen above.
    
    Fix the %rip-relative displacement of the copied CALL_DEPTH_ACCOUNT
    instruction (from ftrace_regs_caller) by calling text_poke_apply_relocation(),
    as it is done for example by the x86 BPF JIT compiler through
    x86_call_depth_emit_accounting(). This corrects both CALL_DEPTH_ACCOUNT slots,
    in ftrace_caller and ftrace_regs_caller.
    
      [ bp: Massage. ]
    
    Fixes: 59bec00ace28 ("x86/percpu: Introduce %rip-relative addressing to PER_CPU_VAR()")
    Signed-off-by: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Acked-by: Steven Rostedt <rostedt@goodmis.org>
    Cc: <stable@kernel.org>
    Link: https://patch.msgid.link/20260527-fix_call_depth_in_trampoline-v1-1-1c1abc8ae310@bootlin.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
x86/kexec: Disable KCOV instrumentation after load_segments() [+ + +]
Author: Aleksandr Nogikh <nogikh@google.com>
Date:   Wed Mar 25 16:48:24 2026 +0100

    x86/kexec: Disable KCOV instrumentation after load_segments()
    
    [ Upstream commit 917e3ad3321e75ca0223d5ccf26ceda116aa51e1 ]
    
    The load_segments() function changes segment registers, invalidating GS base
    (which KCOV relies on for per-cpu data). When CONFIG_KCOV is enabled, any
    subsequent instrumented C code call (e.g. native_gdt_invalidate()) begins
    crashing the kernel in an endless loop.
    
    To reproduce the problem, it's sufficient to do kexec on a KCOV-instrumented
    kernel:
    
      $ kexec -l /boot/otherKernel
      $ kexec -e
    
    The real-world context for this problem is enabling crash dump collection in
    syzkaller. For this, the tool loads a panic kernel before fuzzing and then
    calls makedumpfile after the panic. This workflow requires both CONFIG_KEXEC
    and CONFIG_KCOV to be enabled simultaneously.
    
    Adding safeguards directly to the KCOV fast-path (__sanitizer_cov_trace_pc())
    is also undesirable as it would introduce an extra performance overhead.
    
    Disabling instrumentation for the individual functions would be too fragile,
    so disable KCOV instrumentation for the entire machine_kexec_64.c and
    physaddr.c. If coverage-guided fuzzing ever needs these components in the
    future, other approaches should be considered.
    
    The problem is not relevant for 32 bit kernels as CONFIG_KCOV is not supported
    there.
    
      [ bp: Space out comment for better readability. ]
    
    Fixes: 0d345996e4cb ("x86/kernel: increase kcov coverage under arch/x86/kernel folder")
    Signed-off-by: Aleksandr Nogikh <nogikh@google.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20260325154825.551191-1-nogikh@google.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
xfrm: ah: use skb_to_full_sk in async output callbacks [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
Date:   Fri May 15 11:45:31 2026 -0400

    xfrm: ah: use skb_to_full_sk in async output callbacks
    
    commit 79d8be262377f7112cfa3088dfc4142d5a2533f3 upstream.
    
    When AH output is offloaded to an asynchronous crypto provider
    (hardware accelerators such as AMD CCP, or a forced-async software
    shim used for testing), the digest completion fires
    ah_output_done() / ah6_output_done() on a workqueue.  The egress
    skb at that point may have been originated by a TCP listener
    sending a SYN-ACK, which sets skb->sk to a request_sock via
    skb_set_owner_edemux(); it may also have been originated by an
    inet_timewait_sock retransmit.  Neither is a full struct sock, and
    passing the raw skb->sk to xfrm_output_resume() then forwards a
    non-full socket through the rest of the xfrm output chain.
    
    xfrm_output_resume() and its downstream consumers expect a full
    sk where they dereference at all.  The natural egress path
    through ah_output_done() does not crash today because the
    consumers that read past sock_common are either gated by
    sk_fullsock() or short-circuit on flags that are clear on a fresh
    request_sock; an exhaustive walk of the 50 most plausible
    consumers under sch_fq, dev_queue_xmit, netfilter, tc-egress and
    cgroup-egress BPF found no current unguarded deref.  The bug is
    still a real type confusion that future consumer changes could
    turn into a memory-corruption primitive.
    
    This is the same bug class fixed for ESP in commit 1620c88887b1
    ("xfrm: Fix the usage of skb->sk").  Apply the analogous fix to
    AH: convert skb->sk to a full socket pointer (or NULL) via
    skb_to_full_sk() before handing it to xfrm_output_resume().
    
    The same async AH callbacks were touched recently for an
    independent ESN-related ICV layout bug in commit ec54093e6a8f
    ("xfrm: ah: account for ESN high bits in async callbacks"); the
    sk type-confusion addressed here is orthogonal.  This patch is
    part of an ongoing audit of the AH callback paths; an ah_output
    ihl-validation hardening series is also currently under review on
    netdev.
    
    Reproduced under UML + KASAN + lockdep with a forced-async
    hmac(sha1) shim that registers at priority 9999 and wraps the
    sync in-tree hmac-sha1-lib.  With the shim loaded, ah_output_done
    runs on every SYN-ACK egress through a transport-mode AH SA and
    skb->sk arrives as a request_sock (TCP_NEW_SYN_RECV); after this
    patch, xfrm_output_resume() receives the listener (the result of
    sk_to_full_sk()) and consumer derefs land on full-sock fields as
    intended.
    
    Fixes: 9ab1265d5231 ("xfrm: Use actual socket sk instead of skb socket for xfrm_output_resume")
    Cc: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4-7
    Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfrm: Check for underflow in xfrm_state_mtu [+ + +]
Author: David Ahern <dahern@nvidia.com>
Date:   Wed May 13 10:49:14 2026 -0600

    xfrm: Check for underflow in xfrm_state_mtu
    
    [ Upstream commit 742b04d0550b0ec89dcbc99537ec88653bd1ad90 ]
    
    Leo Lin reported OOB write issue in esp component:
    
      xfrm_state_mtu() returns u32 but performs its arithmetic in unsigned
      modulo-2^32 space using an attacker-influenced "header_len + authsize +
      net_adj" subtracted from a small "mtu" argument. A nobody user can
      install an IPv4 ESP tunnel SA with a large authentication key
      (XFRMA_ALG_AUTH_TRUNC, e.g. hmac(sha512), 64-byte key, 64-byte trunc),
      configure a small interface MTU (68 bytes), and set XFRMA_TFCPAD to a
      large value. When a single UDP datagram is then sent through the
      tunnel, xfrm_state_mtu() underflows to a near-2^32 value, and
      esp_output() consumes it as a signed int via:
    
            padto      = min(x->tfcpad, xfrm_state_mtu(x, mtu_cached))
            esp.tfclen = padto - skb->len   (assigned to int)
    
      esp.tfclen ends up negative (e.g. -207). It is sign-extended to size_t
      when passed to memset() inside esp_output_fill_trailer(), producing a
      ~16 EB write of zeroes at skb_tail_pointer(skb). KASAN logs it as
      "Write of size 18446744073709551537 at addr ffff888...".
    
    Check for underflow and return 1. This causes the sendmsg attempt to
    fail with ENETUNREACH.
    
    Fixes: c5c252389374 ("[XFRM]: Optimize MTU calculation")
    Reported-by: Leo Lin <leo@depthfirst.com>
    Assisted-by: Codex:26.506.31004
    Signed-off-by: David Ahern <dahern@nvidia.com>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

xfrm: esp: restore combined single-frag length gate [+ + +]
Author: Jingguo Tan <tanjingguo@huawei.com>
Date:   Mon May 18 17:06:48 2026 +0800

    xfrm: esp: restore combined single-frag length gate
    
    commit dfa0d7b0ff1eb6b2c416b8fdb9b4f2cefba57a40 upstream.
    
    The ESP out-of-place fast path appends the trailer in esp_output_head()
    before esp_output_tail() allocates the destination page frag. The
    head-side gate currently checks skb->data_len and tailen separately, but
    the tail code allocates a single destination frag from the combined
    post-trailer skb->data_len.
    
    Reject the page-frag fast path when the combined aligned length exceeds a
    page. Otherwise skb_page_frag_refill() may fall back to a single page while
    the destination sg still spans the combined skb->data_len.
    
    Restore this combined-length page gate for both IPv4 and IPv6.
    
    Fixes: 5bd8baab087d ("esp: limit skb_page_frag_refill use to a single page")
    Cc: stable@vger.kernel.org
    Signed-off-by: Lin Ma <malin89@huawei.com>
    Signed-off-by: Chenyuan Mi <michenyuan@huawei.com>
    Signed-off-by: Jingguo Tan <tanjingguo@huawei.com>
    Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfrm: input: hold netns during deferred transport reinjection [+ + +]
Author: Zhengchuan Liang <zcliangcn@gmail.com>
Date:   Fri May 22 17:31:55 2026 +0800

    xfrm: input: hold netns during deferred transport reinjection
    
    commit c16f74dc1d75d0e2e7670076d5375deda110ebeb upstream.
    
    Transport-mode reinjection stores a struct net pointer in skb->cb and
    uses it later from xfrm_trans_reinject(). That pointer must stay valid
    until the deferred callback runs.
    
    Take a netns reference when queueing deferred reinjection work and drop
    it after the callback completes. Use maybe_get_net() so the queueing
    path does not revive a namespace that is already being torn down.
    
    This keeps the existing workqueue design and fixes the netns lifetime
    handling in one place for all users of xfrm_trans_queue_net().
    
    Fixes: 7b3801927e52 ("xfrm: introduce xfrm_trans_queue_net")
    Cc: stable@kernel.org
    Reported-by: Yuan Tan <yuantan098@gmail.com>
    Reported-by: Xin Liu <bird@lzu.edu.cn>
    Co-developed-by: Luxing Yin <tr0jan@lzu.edu.cn>
    Signed-off-by: Luxing Yin <tr0jan@lzu.edu.cn>
    Signed-off-by: Zhengchuan Liang <zcliangcn@gmail.com>
    Signed-off-by: Ren Wei <n05ec@lzu.edu.cn>
    Assisted-by: Codex:gpt-5.4
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfrm: move policy_bydst RCU sync from per-netns .exit to .pre_exit [+ + +]
Author: Usama Arif <usama.arif@linux.dev>
Date:   Thu May 21 03:29:26 2026 -0700

    xfrm: move policy_bydst RCU sync from per-netns .exit to .pre_exit
    
    [ Upstream commit 3e52417318473782012b236d0325bf7d2266a597 ]
    
    The struct pernet_operations docstring in include/net/net_namespace.h
    explicitly warns against blocking RCU primitives in .exit handlers:
    
        Exit methods using blocking RCU primitives, such as
        synchronize_rcu(), should be implemented via exit_batch.
        [...]
        Please, avoid synchronize_rcu() at all, where it's possible.
    
        Note that a combination of pre_exit() and exit() can
        be used, since a synchronize_rcu() is guaranteed between
        the calls.
    
    xfrm_policy_fini() violates this: it calls synchronize_rcu() before
    freeing the policy_bydst hash tables (so no RCU reader is mid-
    traversal at free time), but runs from xfrm_net_ops.exit -- once per
    namespace -- so a cleanup_net() of N namespaces pays N full RCU
    grace periods serially.
    
    Use the documented pre_exit/exit split. Move the policy flush (and
    the workqueue drains it depends on) into a new .pre_exit handler;
    xfrm_policy_fini() then runs in .exit and frees the hash tables
    after the synchronize_rcu_expedited() that cleanup_net() guarantees
    between the two phases. Providing O(1) RCU grace periods per batch
    instead of O(N).
    
    Observed on Linux 6.18 with a workload doing unshare(CLONE_NEWNET)
    at ~13/sec sustained: cleanup_net() and the netns_wq rescuer kthread
    both stuck in xfrm_policy_fini()'s synchronize_rcu(), >300k struct
    net accumulated in the cleanup queue, Percpu in /proc/meminfo climbed
    to 130+ GB on 256-CPU hosts, and memcg OOMs followed. setup_net and
    __put_net counts were balanced, ruling out a refcount leak.
    
    Fixes: 069daad4f2ae ("xfrm: Wait for RCU readers during policy netns exit")
    Signed-off-by: Usama Arif <usama.arif@linux.dev>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

xfrm: route MIGRATE notifications to caller's netns [+ + +]
Author: Maoyi Xie <maoyixie.tju@gmail.com>
Date:   Mon May 4 22:27:36 2026 +0800

    xfrm: route MIGRATE notifications to caller's netns
    
    commit 7e2a4f7ca0952820731ef7bdadfc9a9e9d3571b4 upstream.
    
    xfrm_send_migrate() in net/xfrm/xfrm_user.c and pfkey_send_migrate()
    in net/key/af_key.c both hardcode &init_net for the multicast that
    announces a successful XFRM_MSG_MIGRATE / SADB_X_MIGRATE.
    
    XFRM_MSG_MIGRATE arrives on a per-netns NETLINK_XFRM socket, and the
    rest of the xfrm/af_key netlink path was made netns-aware in 2008.
    The other 14 multicast paths in xfrm_user.c route their event using
    xs_net(x), xp_net(xp) or sock_net(skb->sk); only the migrate path
    was missed.
    
    Two consequences of the init_net hardcoding:
    
      1. The notification (selector, old/new endpoint addresses, and the
         km_address) is delivered to listeners on init_net's
         XFRMNLGRP_MIGRATE / pfkey BROADCAST_ALL groups rather than on
         the issuing netns. An IKE daemon running in init_net therefore
         receives migration notifications originating from any other
         netns on the host.
    
      2. An IKE daemon running inside a non-init netns and subscribed
         to its own XFRMNLGRP_MIGRATE / pfkey groups never receives the
         notification of its own migration. IKEv2 MOBIKE / address-update
         handling inside a netns is silently broken.
    
    Thread struct net through km_migrate() and the xfrm_mgr.migrate
    function pointer, drop the &init_net override in xfrm_send_migrate()
    and pfkey_send_migrate(), and pass the caller's net (already in
    scope in xfrm_migrate() via sock_net(skb->sk)) all the way down.
    struct xfrm_mgr is in-tree only and not exported as a stable API,
    so the function-pointer signature change is internal.
    
    pfkey_broadcast() is already netns-aware via net_generic(net,
    pfkey_net_id) since the pernet conversion. The five other
    pfkey_broadcast() callers in af_key.c already pass xs_net(x),
    sock_net(sk) or a per-netns net, so this only removes the
    &init_net outlier.
    
    Fixes: 5c79de6e79cd ("[XFRM]: User interface for handling XFRM_MSG_MIGRATE")
    Cc: stable@vger.kernel.org # v5.15+
    Signed-off-by: Maoyi Xie <maoyi.xie@ntu.edu.sg>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
xhci: tegra: Fix ghost USB device on dual-role port unplug [+ + +]
Author: Wei-Cheng Chen <weichengc@nvidia.com>
Date:   Thu Jun 4 20:19:09 2026 +0800

    xhci: tegra: Fix ghost USB device on dual-role port unplug
    
    [ Upstream commit 5a4c828b8b29b47534814ade26d9aee09d5101fc ]
    
    When a USB device is unplugged from the dual-role port, the device-mode
    path in tegra_xhci_id_work() explicitly clears both SS and HS port power
    via direct hub_control ClearPortFeature(POWER) calls. This preempts the
    xHCI controller's normal disconnect processing -- PORT_CSC is never
    generated, the USB core never sees the disconnect, and the device remains
    in its internal tree as a ghost visible in lsusb.
    
    Add an otg_set_port_power flag to control whether the dual-role switch
    path performs explicit port power management. SoCs that need it
    (Tegra124 / Tegra210 / Tegra186) set the flag; later SoCs (Tegra194 and
    beyond) rely on the PHY mode change to handle disconnect naturally and
    skip all port power calls.
    
    Within the port power path, otg_reset_sspi additionally gates the SSPI
    reset sequence on host-mode entry for SoCs that require it.
    
    Flags set per SoC:
      Tegra124, Tegra186  -> otg_set_port_power
      Tegra210            -> otg_set_port_power, otg_reset_sspi
      Tegra194 and later  -> (none)
    
    [ Backport to 6.12.y: keep the host-mode snapshot in the existing
      tegra->lock section, retain pm_runtime_mark_last_busy() in the host
      port-power path, and resolve context around the SoC ops/Tegra234
      entries. ]
    
    Fixes: f836e7843036 ("usb: xhci-tegra: Add OTG support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Wei-Cheng Chen <weichengc@nvidia.com>
    Link: https://patch.msgid.link/20260505112630.217704-1-weichengc@nvidia.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>