Changelog in Linux kernel 6.12.104

 
ALSA: usb-audio: fix OOB write on Type II inbound URBs [+ + +]
Author: Baul Lee <baul.lee@xbow.com>
Date:   Wed Aug 5 10:34:41 2026 +0900

    ALSA: usb-audio: fix OOB write on Type II inbound URBs
    
    commit 69ee44e1a23be62318189dc4b37fa4ad94053269 upstream.
    
    data_ep_set_params() sizes each URB transfer buffer before it adds the
    Format Type II transfer delimiter:
    
            u->packets = urb_packs;
            u->buffer_size = maxsize * u->packets;
    
            if (fmt->fmt_type == UAC_FORMAT_TYPE_II)
                    u->packets++; /* for transfer delimiter */
            u->urb = usb_alloc_urb(u->packets, GFP_KERNEL);
    
    buffer_size is computed from the pre-increment packet count and never
    recomputed, so for a Type II endpoint the buffer is one packet short of
    the packet count the URB is built with.
    
    prepare_inbound_urb() then lays out one iso frame per packet and never
    consults buffer_size:
    
            offs = 0;
            for (i = 0; i < urb_ctx->packets; i++) {
                    urb->iso_frame_desc[i].offset = offs;
                    urb->iso_frame_desc[i].length = ep->curpacksize;
                    offs += ep->curpacksize;
            }
    
            urb->transfer_buffer_length = offs;
            urb->number_of_packets = urb_ctx->packets;
    
    The last descriptor therefore points one packet past the end of the
    transfer buffer, where the host controller writes device data on every
    inbound transfer.  prepare_silent_urb() and prepare_playback_urb() bound
    their fill loops by ctx->buffer_size, so only capture is affected.
    
    fmt_type comes from the device's audio streaming descriptors, so any
    device advertising a Type II capture format hits this once userspace sets
    hw_params on the stream.
    
    KASAN on 7.2.0-rc5 (arm64) with a dummy_hcd/raw-gadget device, one report
    per inbound transfer:
    
      BUG: KASAN: slab-out-of-bounds in dummy_timer
      Write of size 64 at addr ffff0000186171c0 by task cons02/166
       __asan_memcpy
       dummy_timer
       hrtimer_run_softirq
      Allocated by task 166:
       usb_alloc_coherent
       snd_usb_endpoint_set_params
      The buggy address is located 0 bytes to the right of
       allocated 64-byte region [ffff000018617180, ffff0000186171c0)
    
    Compute buffer_size after the delimiter packet has been accounted for,
    and bound the fill loop by buffer_size, as prepare_silent_urb() already
    does on the outbound side.  This grows every Type II URB allocation by
    one maxsize packet.
    
    Discovered by XBOW, triaged by Baul Lee <baul.lee@xbow.com>
    
    Fixes: 8fdff6a319e7 ("ALSA: snd-usb: implement new endpoint streaming model")
    Reported-by: Federico Kirschbaum <federico.kirschbaum@xbow.com>
    Reported-by: Baul Lee <baul.lee@xbow.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Baul Lee <baul.lee@xbow.com>
    Link: https://patch.msgid.link/20260805013441.38245-1-baul.lee@xbow.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: usb: Fix UAF at delayed release of MIDI2 EPs [+ + +]
Author: Takashi Iwai <tiwai@suse.de>
Date:   Sat Aug 8 17:20:06 2026 +0200

    ALSA: usb: Fix UAF at delayed release of MIDI2 EPs
    
    commit f8a80cfb68613fb7e6452b66447dbc63f435d140 upstream.
    
    The recent fix for UAF in ump_to_endpoint() caused another UAF because
    it tries to dereference the UMP endpoint object, but this might be
    executed at a delayed context where the endpoint has been already
    released.
    
    Add private_free to clear the associated data for avoiding the further
    dereference for delayed releases.
    
    Fixes: 4a05b2d1b464 ("ALSA: usb-audio: fix use-after-free in ump_to_endpoint()")
    Reported-by: syzbot+565b1138cfbe549d4422@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=565b1138cfbe549d4422
    Cc: <stable@vger.kernel.org>
    Link: https://patch.msgid.link/20260808152009.1947835-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: usx2y: bound the hwdep mmap fault offset [+ + +]
Author: Baul Lee <baul.lee@xbow.com>
Date:   Wed Aug 5 10:34:45 2026 +0900

    ALSA: usx2y: bound the hwdep mmap fault offset
    
    commit 2ca1eea3cd17930daffe9e429a7c89232036ec24 upstream.
    
    snd_us428ctls_vm_fault() turns the faulting page offset into a kernel
    address with no bound of any kind:
    
            offset = vmf->pgoff << PAGE_SHIFT;
            vaddr = (char *)(...)->us428ctls_sharedmem + offset;
            page = virt_to_page(vaddr);
            get_page(page);
            vmf->page = page;
    
            return 0;
    
    snd_us428ctls_mmap() checks only the length of the mapping, never the
    offset, and us428ctls_sharedmem is a single page from
    alloc_pages_exact().  For a character device file_mmap_size_max()
    returns ULONG_MAX, so the mm layer imposes no ceiling either.  Every page
    offset above zero resolves to a struct page outside the object, and the
    handler installs it into the caller's address space read-write; the vma
    is not marked read-only.
    
    The caller picks the page frame with a single mmap() argument and gets
    read-write access to a page of kernel memory it does not own; an offset
    that lands in an unpopulated vmemmap region oopses instead.
    
    A process that can open the hwdep node of an attached US-X2Y reaches
    this after loading the FPGA image through the same node; no capability
    check is involved.
    
    On 7.2.0-rc5 (arm64), mmap() with a large offset:
    
      Unable to handle kernel paging request at virtual address fffffdffc45d5ac8
      pc : snd_us428ctls_vm_fault+0x68/0x140 [snd_usb_usx2y]
      Call trace:
       snd_us428ctls_vm_fault+0x68/0x140 [snd_usb_usx2y]
       __do_fault
       __handle_mm_fault
       handle_mm_fault
       el0_da
    
    Reject any offset outside the shared region.  The pcm hwdep handler in
    usx2yhwdeppcm.c computes its address the same way and needs the same
    bound.
    
    Discovered by XBOW, triaged by Baul Lee <baul.lee@xbow.com>
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: Federico Kirschbaum <federico.kirschbaum@xbow.com>
    Reported-by: Baul Lee <baul.lee@xbow.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Baul Lee <baul.lee@xbow.com>
    Link: https://patch.msgid.link/20260805013445.38283-1-baul.lee@xbow.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
arm64: dts: broadcom: bcm2712: Remove non-functional EL2 virtual timer [+ + +]
Author: Daniel Drake <dan@reactivated.net>
Date:   Thu Jul 16 21:45:27 2026 +0100

    arm64: dts: broadcom: bcm2712: Remove non-functional EL2 virtual timer
    
    [ Upstream commit 75952cfc7752c52a2b692b59d34ce160d3edabb2 ]
    
    Commit d87773de9efe1 ("clocksource/drivers/arm_arch_timer: Default to EL2
    virtual timer when running VHE") causes boot to hang on Raspberry Pi 5.
    The newly-selected EL2 virtual timer does not generate any interrupts,
    even though the GIC_DIST_ENABLE_SET flag has been confirmed set via
    readback.
    
    It is highly unusual that this timer interrupt is non-operational because
    this is a standard GIC interrupt corresponding to a standard Cortex-A76
    CPU timer. However, Broadcom have confirmed for this SoC:
    
    > the interrupt line was never connected in the first place as this was
    > not identified as being a requirement
    
    Remove the corresponding DeviceTree entry.
    
    Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Closes: https://lore.kernel.org/all/ea15cce1-b393-43f6-8d58-3d6f90f0c0cd@samsung.com/
    Fixes: faa3381267d0 ("arm64: dts: broadcom: Add minimal support for Raspberry Pi 5")
    Signed-off-by: Daniel Drake <dan@reactivated.net>
    Link: https://lore.kernel.org/r/20260716-bcm2712-el2-v2-1-e708f7fb42fa@reactivated.net
    Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ARM: dts: BCM5301X: fix PCIe controller 2 second interrupt [+ + +]
Author: Rosen Penev <rosenp@gmail.com>
Date:   Sat Jul 25 14:57:22 2026 -0700

    ARM: dts: BCM5301X: fix PCIe controller 2 second interrupt
    
    [ Upstream commit bab4d538f8485e0d48538fcb82b285df3779278e ]
    
    PCIe controller 2 has interrupts 0-4 mapping to GIC SPI 138-142. The
    mapping for interrupt 1 was incorrectly set to 138 due to a copy-paste
    error. Fix it to 139.
    
    Assisted-by: opencode:big-pickle
    Signed-off-by: Rosen Penev <rosenp@gmail.com>
    Link: https://lore.kernel.org/r/20260725215722.9323-1-rosenp@gmail.com
    Fixes: 3b3e35b279be ("ARM: dts: BCM5301X: Relicense AXI interrupts code to the GPL 2.0+ / MIT")
    Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ARM: npcm: Fix OF node refcount leaks in SMP setup [+ + +]
Author: Yuho Choi <dbgh9129@gmail.com>
Date:   Sun May 24 23:38:46 2026 -0400

    ARM: npcm: Fix OF node refcount leaks in SMP setup
    
    [ Upstream commit 8eb052f48331474c2789d07b7f11165c323bd2f9 ]
    
    npcm7xx_smp_boot_secondary() and npcm7xx_smp_prepare_cpus() look up
    the GCR and SCU nodes with of_find_compatible_node(). The returned
    nodes are used for of_iomap(), but the node references are never
    released.
    
    of_iomap() does not consume the device node reference, and iounmap()
    only releases the MMIO mapping. Drop each node reference after the
    corresponding mapping attempt.
    
    Fixes: 7bffa14c9aed ("arm: npcm: add basic support for Nuvoton BMCs")
    Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
    Reviewed-by: Avi Fishman <avifishman70@gmail.com>
    Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ata: pata_sl82c105: fix bridge revision use-after-free [+ + +]
Author: Hongyan Xu <getshell@seu.edu.cn>
Date:   Thu Aug 6 14:06:28 2026 +0800

    ata: pata_sl82c105: fix bridge revision use-after-free
    
    [ Upstream commit 7700a31039cdc6715cb6cce7e7a664ee4e945f67 ]
    
    pci_get_slot() returns a referenced PCI device. Commit 44c10138fd4b
    ("PCI: Change all drivers to use pci_device->revision") replaced a
    configuration-space read with direct access to the cached revision field,
    but left that access after pci_dev_put(). The bridge may therefore be freed
    before its revision is read.
    
    Read the revision before dropping the reference.
    
    Fixes: 44c10138fd4b ("PCI: Change all drivers to use pci_device->revision")
    Signed-off-by: Hongyan Xu <getshell@seu.edu.cn>
    Reviewed-by: Niklas Cassel <cassel@kernel.org>
    Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
binfmt_misc: don't warn when the mount is completed from another user namespace [+ + +]
Author: Christian Brauner <brauner@kernel.org>
Date:   Sun Aug 2 20:00:44 2026 +0200

    binfmt_misc: don't warn when the mount is completed from another user namespace
    
    commit 79fdf39f1a31f88cb3833b6f8091fbf6acdca2c6 upstream.
    
    fsopen() records the caller's user namespace in fc->user_ns and hands
    back an ordinary file descriptor. Nothing ties the task that calls
    fsconfig(FSCONFIG_CMD_CREATE) to the task that created the context. The
    fd is inherited across fork() and exec() and it can be passed over a
    unix socket.
    
    Completing a context from another user namespace is allowed on purpose.
    vfs_cmd_create() authorizes the create with mount_capable(), which for
    FS_USERNS_MOUNT checks ns_capable(fc->user_ns, CAP_SYS_ADMIN), and that
    succeeds for a task holding CAP_SYS_ADMIN in an ancestor of fc->user_ns.
    So an unprivileged task can reach the WARN_ON() in bm_fill_super():
    create a user and a mount namespace in a child, call
    fsopen("binfmt_misc") there, send the fscontext fd to the parent and let
    the parent issue FSCONFIG_CMD_CREATE. Both namespaces come from a plain
    unshare(1) and no capability is needed anywhere:
    
      WARNING: fs/binfmt_misc.c:938 at bm_fill_super+0xa2/0xc0 [binfmt_misc]
      CPU: 15 UID: 1000 PID: 3243382 Comm: fswarn
      Call Trace:
       get_tree_keyed+0x7d/0xb0
       bm_get_tree+0x34/0x90 [binfmt_misc]
       vfs_get_tree+0x2a/0x100
       vfs_cmd_create+0x60/0xf0
       __do_sys_fsconfig+0x4b2/0x500
    
    The child needs the mount namespace because fsopen() itself gates on
    may_mount(), which asks for CAP_SYS_ADMIN in the user namespace owning
    the caller's mount namespace. fsconfig() doesn't repeat that check.
    
    It is a WARN_ON() and not a WARN_ON_ONCE(), so the condition can be
    raised in a loop to taint the kernel and flood the log, and it panics a
    kernel booted with panic_on_warn.
    
    Keep refusing the mount and stop warning about it. Nothing in
    bm_fill_super() depends on the two namespaces matching, it derives
    everything from sb->s_user_ns.
    
    Fixes: 21ca59b365c0 ("binfmt_misc: enable sandboxed mounts")
    Cc: stable@vger.kernel.org # v6.7+
    Link: https://patch.msgid.link/20260802-work-fill_super-warn-v1-2-4e987911a39a@kernel.org
    Reviewed-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
blk-mq: pop cached request if it is usable [+ + +]
Author: Keith Busch <kbusch@kernel.org>
Date:   Wed Aug 12 13:54:11 2026 +0000

    blk-mq: pop cached request if it is usable
    
    [ Upstream commit dc278e9bf2b9513a763353e6b9cc21e0f532954e ]
    
    When submitting a bio to blk-mq, if the task should sleep after peeking
    a cached request, but before it pops it, the plug flushes and calls
    blk_mq_free_plug_rqs, freeing the cached_rqs. This creates a
    use-after-free bug. Fix this by popping the cached request before any
    possible blocking calls if it is suitable for use.
    
    Popping this request first holds a queue reference, so avoid any
    serialization races with queue freezes and can safely proceed with
    dispatching that request to the driver. This potentially increases a
    timing window from when a driver wants to freeze its queue to when
    requests stop being dispatched. That scenario is off the fast path
    though, and drivers need to appropriately handle requests during a
    freeze request anyway.
    
    The downside is the popped element needs to be individually freed when
    we performed a bio plug merge. The cached request would have had to be
    freed later anyway, but this patch does it inline with building the plug
    list instead of after flushing it.
    
    Fixes: b0077e269f6c1 ("blk-mq: make sure active queue usage is held for bio_integrity_prep()")
    Fixes: 7b4f36cd22a65 ("block: ensure we hold a queue reference when using queue limits")
    Signed-off-by: Keith Busch <kbusch@kernel.org>
    Link: https://patch.msgid.link/20260521190253.242065-1-kbusch@meta.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    [ fix contextual conflicts ]
    Signed-off-by: Simon Liebold <simonlie@amazon.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

blk-mq: reinsert cached request to the list [+ + +]
Author: Keith Busch <kbusch@kernel.org>
Date:   Wed Aug 12 13:54:12 2026 +0000

    blk-mq: reinsert cached request to the list
    
    [ Upstream commit b051bb6bf0a231117036aa607cadf55be8e63910 ]
    
    A previous commit removed an optimization out of caution for a scenario
    that turns out not to be real: all the "queue_exit" goto's are safe to
    reinsert the request into the cached_rq's plug list as they are either
    from a non-blocking path, or a successful merge that already holds the
    queue reference. This optimization is most needed for small sequential
    workloads that successfully merge into larger requests.
    
    Fixes: dc278e9bf2b9 ("blk-mq: pop cached request if it is usable")
    Suggested-by: Ming Lei <tom.leiming@gmail.com>
    Suggested-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Keith Busch <kbusch@kernel.org>
    Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
    Link: https://patch.msgid.link/20260526153531.2365935-1-kbusch@meta.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Simon Liebold <simonlie@amazon.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
block: Reorder the request allocation code in blk_mq_submit_bio() [+ + +]
Author: Bart Van Assche <bvanassche@acm.org>
Date:   Wed Aug 12 13:54:10 2026 +0000

    block: Reorder the request allocation code in blk_mq_submit_bio()
    
    [ Upstream commit 44e41381591dc5b4ea67a9f170b4ec85c817586e ]
    
    Help the CPU branch predictor in case of a cache hit by handling the cache
    hit scenario first.
    
    Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
    Cc: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Bart Van Assche <bvanassche@acm.org>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
    Link: https://lore.kernel.org/r/20241218212246.1073149-2-bvanassche@acm.org
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Stable-dep-of: dc278e9bf2b9 ("blk-mq: pop cached request if it is usable")
    Signed-off-by: Simon Liebold <simonlie@amazon.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
bnxt_en: Determine and store default RX ring in vnic structure [+ + +]
Author: Shravya KN <shravya.k-n@broadcom.com>
Date:   Fri Jul 31 12:09:34 2026 -0700

    bnxt_en: Determine and store default RX ring in vnic structure
    
    [ Upstream commit 53f01cd594e223aabb538d5288e60111523c96f2 ]
    
    Each VNIC has a default RX ring.  The purpose of the default RX ring
    is to provide a destination for any packets that cannot be parsed by
    the RSS logic.  Up until now, the default RX ring is always Ring 0.
    
    We neglected to take care of this default RX ring when adding the
    queue restart feature.  If ring 0 (default ring) is re-started, it
    may now have a new FW ring ID after freeing the old one and
    allocating a new one.  The VNIC now may have a stale default ring
    and it may generate an internal exception.  This exception may
    appear in dmesg:
    
    FW reported unknown error type 10
    
    The best way to resolve this issue is to use a more appropriate
    ring for the default ring instead of always ring 0.  Ring 0 may not
    even be in the RSS table, especially on a new RSS context.
    
    This patch adds the logic to determine and store the proper default
    RX ring for a VNIC.  For an RSS VNIC, the default ring is the lowest
    ring number in the RSS table.  The next patch will add proper logic
    to update the VNIC if the default ring changes after queue restart.
    
    Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
    Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
    Signed-off-by: Shravya KN <shravya.k-n@broadcom.com>
    Signed-off-by: Michael Chan <michael.chan@broadcom.com>
    Link: https://patch.msgid.link/20260731190937.807270-3-michael.chan@broadcom.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: 0b137529a899 ("bnxt_en: Refresh VNIC default ring on queue restart if needed")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

bnxt_en: Fix PTP PPS setting bug [+ + +]
Author: Keegan Freyhof <keegan.freyhof@broadcom.com>
Date:   Fri Jul 31 12:09:37 2026 -0700

    bnxt_en: Fix PTP PPS setting bug
    
    [ Upstream commit 80eaf88efec33ac77ed7726d066c4f2f932cc329 ]
    
    The existing driver logic is always turning on PTP_CLK_REQ_PPS
    regardless of the "on" parameter passed to bnxt_ptp_enable().
    During shutdown, PTP_CLK_REQ_PPS may be turned off and this
    bug will do the opposite and may trigger a PCIe PTM request TLP.
    On some systems this can trigger a PCIe AER.
    
    Fix it by properly configuring PTP_CLK_REQ_PPS based on the "on"
    parameter.
    
    Fixes: 9e518f25802c ("bnxt_en: 1PPS functions to configure TSIO pins")
    Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
    Signed-off-by: Keegan Freyhof <keegan.freyhof@broadcom.com>
    Signed-off-by: Michael Chan <michael.chan@broadcom.com>
    Link: https://patch.msgid.link/20260731190937.807270-6-michael.chan@broadcom.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

bnxt_en: Move RSS table fill outside __bnxt_hwrm_vnic_set_rss() [+ + +]
Author: Shravya KN <shravya.k-n@broadcom.com>
Date:   Fri Jul 31 12:09:33 2026 -0700

    bnxt_en: Move RSS table fill outside __bnxt_hwrm_vnic_set_rss()
    
    [ Upstream commit 1d0fc6c7ea49994b8ff50d02979d1e4207ec6c4f ]
    
    This is a refactor patch with no change in behavior.  The caller
    will now fill the RSS table before calling __bnxt_hwrm_vnic_set_rss().
    In the next patch, we'll add code to determine the default ring for
    the VNIC when we fill the RSS table.
    
    Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
    Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
    Signed-off-by: Shravya KN <shravya.k-n@broadcom.com>
    Signed-off-by: Michael Chan <michael.chan@broadcom.com>
    Link: https://patch.msgid.link/20260731190937.807270-2-michael.chan@broadcom.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: 0b137529a899 ("bnxt_en: Refresh VNIC default ring on queue restart if needed")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

bnxt_en: Refresh VNIC default ring on queue restart if needed [+ + +]
Author: Shravya KN <shravya.k-n@broadcom.com>
Date:   Fri Jul 31 12:09:35 2026 -0700

    bnxt_en: Refresh VNIC default ring on queue restart if needed
    
    [ Upstream commit 0b137529a8997caf67190ca1d71ba8bbdb44fbfb ]
    
    When a queue is restarted, refresh VNIC_CFG for all VNICs whose
    default RX ring is the restarted ring.  This will eliminate this
    possible FW warning caused by a stale default ring in the VNIC:
    
    FW reported unknown error type 10
    
    Fixes: 5ac066b7b062 ("bnxt_en: Fix queue start to update vnic RSS table")
    Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
    Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
    Signed-off-by: Shravya KN <shravya.k-n@broadcom.com>
    Signed-off-by: Michael Chan <michael.chan@broadcom.com>
    Link: https://patch.msgid.link/20260731190937.807270-4-michael.chan@broadcom.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
bonding: alb: re-check primary_is_promisc under RTNL in bond_alb_monitor [+ + +]
Author: Xiang Mei (Microsoft) <xmei5@asu.edu>
Date:   Sat Jul 25 23:39:30 2026 +0000

    bonding: alb: re-check primary_is_promisc under RTNL in bond_alb_monitor
    
    [ Upstream commit 683c6ba6e58e6ed1037831ea97dd58d9c0e76b8d ]
    
    bond_alb_monitor() reads primary_is_promisc under RCU, then drops RCU and
    takes RTNL via rtnl_trylock() before undoing the promiscuity it set on the
    active slave. In that window the active slave can change under RTNL
    (RTM_DELLINK -> __bond_release_one() -> bond_alb_handle_active_change()),
    which already drops the promiscuity and clears primary_is_promisc. The
    monitor still acts on the stale decision: if the slave was removed with no
    failover, curr_active_slave is now NULL and the deref faults; if it failed
    over, the stale dev_set_promiscuity(-1) underflows the new slave's
    promiscuity counter and pins it in IFF_PROMISC.
    
      Oops: general protection fault, probably for non-canonical address ...
      KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
      Workqueue: b42 bond_alb_monitor
      RIP: 0010:bond_alb_monitor (drivers/net/bonding/bond_alb.c:1600)
       process_one_work (kernel/workqueue.c:3322)
       worker_thread (kernel/workqueue.c:3486)
       kthread (kernel/kthread.c:436)
       ret_from_fork (arch/x86/kernel/process.c:158)
      Kernel panic - not syncing: Fatal exception
    
    Re-check primary_is_promisc (and curr_active_slave) after taking RTNL so
    the monitor only undoes an increment it still owns. The other bonding
    monitors already re-read state under RTNL in their commit phase
    (bond_miimon_commit/bond_ab_arp_commit); bond_alb_monitor() was the only
    one acting on the pre-trylock decision.
    
    Fixes: d0e81b7e2246 ("bonding: Acquire correct locks in alb for promisc change")
    Reported-by: AutonomousCodeSecurity@microsoft.com
    Signed-off-by: Xiang Mei (Microsoft) <xmei5@asu.edu>
    Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
    Acked-by: Jay Vosburgh <jv@jvosburgh.net>
    Link: https://patch.msgid.link/20260725233930.2957317-1-xmei5@asu.edu
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
bpf, sockmap: Fix sk_redir use-after-free in send verdict [+ + +]
Author: Chengfeng Ye <nicoyip.dev@gmail.com>
Date:   Sun Jul 19 23:22:07 2026 +0800

    bpf, sockmap: Fix sk_redir use-after-free in send verdict
    
    commit a76624733730e541e4955fdecf506af2f6b20558 upstream.
    
    sk_psock_msg_verdict() takes a socket reference for psock->sk_redir.
    tcp_bpf_send_verdict() copies that pointer while holding the source socket
    lock, but does not take a reference for the local copy before dropping the
    lock around tcp_bpf_sendmsg_redir().
    
    When apply_bytes keeps the cached verdict active, another sendmsg() on the
    same source socket can consume the remaining bytes and release the cached
    reference while the first thread still holds only the raw local pointer:
    
      CPU 0                                  CPU 1
      sk_redir = psock->sk_redir
      apply_bytes remains nonzero
      release_sock(sk)
                                             lock_sock(sk)
                                             apply_bytes reaches zero
                                             psock->sk_redir = NULL
                                             release_sock(sk)
                                             tcp_bpf_sendmsg_redir(sk_redir)
                                             sock_put(sk_redir)
      tcp_bpf_sendmsg_redir(sk_redir)
    
    The final sock_put() can free sk_redir before CPU 0 dereferences it.
    
    KASAN reported:
    
      BUG: KASAN: slab-use-after-free in tcp_bpf_sendmsg_redir+0xf39/0x1020
      Read of size 8 at addr ffff888108537090 by task poc/87
      Call Trace:
       tcp_bpf_sendmsg_redir+0xf39/0x1020
       tcp_bpf_sendmsg+0x977/0x1a50
       __sys_sendto+0x32c/0x3a0
       __x64_sys_sendto+0xdb/0x1b0
      Allocated by task 85:
       sk_prot_alloc+0x56/0x210
       sk_clone+0x6f/0x14b0
       inet_csk_clone_lock+0x24/0x740
       tcp_create_openreq_child+0x25/0x2710
       tcp_v4_syn_recv_sock+0x10a/0xe00
      Freed by task 0:
       __kasan_slab_free+0x43/0x70
       slab_free_after_rcu_debug+0xa6/0x1e0
       rcu_core+0x50a/0x1850
      Last potentially related work creation:
       __sk_destruct+0x3da/0x540
       sk_psock_destroy+0x81e/0xab0
       process_one_work+0x63a/0x1070
    
    Take a temporary socket reference while the source socket lock still
    protects psock->sk_redir, and drop it after tcp_bpf_sendmsg_redir()
    returns.  This keeps each unlocked use independent of cached-verdict
    ownership.
    
    Fixes: 604326b41a6f ("bpf, sockmap: convert to generic sk_msg interface")
    Signed-off-by: Chengfeng Ye <nicoyip.dev@gmail.com>
    Reviewed-by: John Fastabend <john.fastabend@gmail.com>
    Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/bpf/20260719152207.2892156-1-nicoyip.dev@gmail.com
    Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
bpf: Preserve pointer state for commuted arithmetic [+ + +]
Author: Yiyang Chen <chenyy23@mails.tsinghua.edu.cn>
Date:   Wed Jul 29 15:18:28 2026 +0000

    bpf: Preserve pointer state for commuted arithmetic
    
    [ Upstream commit a4c6f804b44c5c790269b25e0e61cf4e9f117c86 ]
    
    When scalar += pointer is handled in adjust_ptr_min_max_vals(), the
    destination register inherits the pointer state from the source pointer.
    Copying only selected fields is fragile because pointer provenance is
    tracked by several bpf_reg_state fields.
    
    Use the caller's temporary offset register to preserve the scalar operand
    while replacing the destination with the full pointer state. This preserves
    the frame number for PTR_TO_STACK registers and keeps parent identity
    fields consistent.
    
    Fixes: f4d7e40a5b71 ("bpf: introduce function calls (verification)")
    Signed-off-by: Yiyang Chen <chenyy23@mails.tsinghua.edu.cn>
    Tested-by: Daniel Wade <danjwade95@gmail.com>
    Acked-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
    Link: https://patch.msgid.link/20260729-c3-035-public-bpf-v4-v4-2-8ee297e2346b@mails.tsinghua.edu.cn
    Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

bpf: tcp: Avoid socket skips and repeats during iteration [+ + +]
Author: Jordan Rife <jordan@jrife.io>
Date:   Mon Jul 14 11:09:09 2025 -0700

    bpf: tcp: Avoid socket skips and repeats during iteration
    
    [ Upstream commit f5080f612a1c587bf636bb23d2a2f4de276d60e4 ]
    
    Replace the offset-based approach for tracking progress through a bucket
    in the TCP table with one based on socket cookies. Remember the cookies
    of unprocessed sockets from the last batch and use this list to
    pick up where we left off or, in the case that the next socket
    disappears between reads, find the first socket after that point that
    still exists in the bucket and resume from there.
    
    This approach guarantees that all sockets that existed when iteration
    began and continue to exist throughout will be visited exactly once.
    Sockets that are added to the table during iteration may or may not be
    seen, but if they are they will be seen exactly once.
    
    Signed-off-by: Jordan Rife <jordan@jrife.io>
    Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
    Acked-by: Stanislav Fomichev <sdf@fomichev.me>
    Stable-dep-of: e5fd3f514e27 ("bpf: tcp: Fix use-after-free in bpf_iter_tcp_established_batch()")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

bpf: tcp: fix double sock release on batch realloc [+ + +]
Author: Xiang Mei (Microsoft) <xmei5@asu.edu>
Date:   Mon Jul 13 23:32:30 2026 +0000

    bpf: tcp: fix double sock release on batch realloc
    
    commit 980a813452754f8001704744e92f7aa697c53dd3 upstream.
    
    bpf_iter_tcp_batch() releases the current batch via
    bpf_iter_tcp_put_batch(), which drops the socket refs and rewrites
    each slot with the socket cookie, then grows the batch. cur_sk/end_sk
    are kept for bpf_iter_tcp_resume(), but on realloc failure the function
    returns ERR_PTR() before resume runs, leaving cur_sk < end_sk over
    slots that now hold cookies rather than sock pointers.
    bpf_iter_tcp_seq_stop() then calls bpf_iter_tcp_put_batch() again and
    dereferences a cookie as a struct sock.
    
    Empty the batch on the failure path so stop() does not release it
    again. The sockets were already freed by the first
    bpf_iter_tcp_put_batch(), so nothing leaks, and a later read() rescans
    the bucket from the start instead of skipping it. The sibling
    GFP_NOWAIT failure path still holds real socket references and is left
    for stop() to release.
    
      BUG: KASAN: null-ptr-deref in __sock_gen_cookie
      Read of size 8 at addr 0000000000000059 by task exploit
       ...
       __sock_gen_cookie (net/core/sock_diag.c:28)
       bpf_iter_tcp_put_batch (net/ipv4/tcp_ipv4.c:2918)
       bpf_iter_tcp_seq_stop (net/ipv4/tcp_ipv4.c:3270)
       bpf_seq_read (kernel/bpf/bpf_iter.c:205)
       vfs_read (fs/read_write.c:572)
       ksys_read (fs/read_write.c:716)
       do_syscall_64
       entry_SYSCALL_64_after_hwframe
      Kernel panic - not syncing: Fatal exception
    
    Fixes: cdec67a489d4 ("bpf: tcp: Make sure iter->batch always contains a full bucket snapshot")
    Reported-by: AutonomousCodeSecurity@microsoft.com
    Signed-off-by: Xiang Mei (Microsoft) <xmei5@asu.edu>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: Jordan Rife <jordan@jrife.io>
    Link: https://patch.msgid.link/20260713233230.3553593-1-xmei5@asu.edu
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

bpf: tcp: Fix use-after-free in bpf_iter_tcp_established_batch() [+ + +]
Author: Jose Fernandez (Anthropic) <jose.fernandez@linux.dev>
Date:   Thu Jul 30 22:32:47 2026 +0000

    bpf: tcp: Fix use-after-free in bpf_iter_tcp_established_batch()
    
    [ Upstream commit e5fd3f514e27db1f05fbd72ba615d74941e23c51 ]
    
    reqsk_queue_hash_req() publishes a TCP_NEW_SYN_RECV request_sock onto
    the ehash chain, drops the bucket lock, and only afterwards sets
    rsk_refcnt to 3.
    
    Lockless readers such as __inet_lookup_established() handle this with
    refcount_inc_not_zero(), but bpf_iter_tcp_established_batch() uses plain
    sock_hold() while holding the bucket lock, on the assumption that the
    lock guarantees sk_refcnt > 0. That assumption does not hold for
    request_sock:
    
      CPU 0                                CPU 1
      -----                                -----
      tcp_conn_request()
       reqsk_queue_hash_req()
        inet_ehash_insert(req)
         spin_lock(bucket)
         __sk_nulls_add_node_rcu(req)      // rsk_refcnt == 0
         spin_unlock(bucket)
                                           bpf_iter_tcp_established_batch()
                                            spin_lock(bucket)
                                            sock_hold(req)   <-- addition on 0
                                            spin_unlock(bucket)
        refcount_set(&req->rsk_refcnt, 3)  // clobbers saturated value
    
    which surfaces as:
    
      refcount_t: addition on 0; use-after-free.
      WARNING: lib/refcount.c:25 at refcount_warn_saturate+0x48/0x90, CPU#1
      Call Trace:
       bpf_iter_tcp_established_batch+0x14e/0x170
       bpf_iter_tcp_batch+0x53/0x200
       bpf_iter_tcp_seq_next+0x27/0x70
       bpf_seq_read+0x107/0x410
       vfs_read+0xb9/0x380
    
    The iterator's stolen reference is lost when the publishing CPU's
    refcount_set() overwrites the count, leaving the socket one reference
    short. When the last legitimate owner drops its reference the reqsk is
    freed while still reachable, leading to use-after-free.
    
    This reproduces in seconds with tcp_syncookies=0, a handful of threads
    doing connect()/close() to a local listener while others read an
    iter/tcp link in a tight loop.
    
    Use refcount_inc_not_zero() and skip the socket on failure. A skipped
    socket is still part of the bucket, so keep counting it in expected.
    The reallocations are sized from expected, and a request sock whose
    refcount gets published while the lock is held across the last realloc
    must already have room.
    
    A skipped socket is counted in expected but never batched, so end_sk
    can be short of expected on a batch that is actually complete. Decide
    completeness by whether the walk left any socket behind instead. The
    WARN after the locked realloc checks the same, replacing an
    end_sk == expected check that could not hold on that path since
    commit cdec67a489d4 ("bpf: tcp: Make sure iter->batch always
    contains a full bucket snapshot").
    
    If every matching socket in a bucket is mid-init (refcount 0), end_sk
    stays 0. Advance to the next bucket rather than returning a batch entry
    that was never filled this round.
    
    Fixes: 04c7820b776f ("bpf: tcp: Bpf iter batching and lock_sock")
    Assisted-by: Claude:unspecified
    Signed-off-by: Jose Fernandez (Anthropic) <jose.fernandez@linux.dev>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
    Link: https://lore.kernel.org/bpf/20260730-bpf-iter-tcp-refcnt-v3-1-754b9c8a6717@linux.dev
    Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

bpf: tcp: Get rid of st_bucket_done [+ + +]
Author: Jordan Rife <jordan@jrife.io>
Date:   Mon Jul 14 11:09:07 2025 -0700

    bpf: tcp: Get rid of st_bucket_done
    
    [ Upstream commit e25ab9b874a4bd8c6e3e5ce66cbe8a1dd4096e2e ]
    
    Get rid of the st_bucket_done field to simplify TCP iterator state and
    logic. Before, st_bucket_done could be false if bpf_iter_tcp_batch
    returned a partial batch; however, with the last patch ("bpf: tcp: Make
    sure iter->batch always contains a full bucket snapshot"),
    st_bucket_done == true is equivalent to iter->cur_sk == iter->end_sk.
    
    Signed-off-by: Jordan Rife <jordan@jrife.io>
    Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Acked-by: Stanislav Fomichev <sdf@fomichev.me>
    Stable-dep-of: e5fd3f514e27 ("bpf: tcp: Fix use-after-free in bpf_iter_tcp_established_batch()")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

bpf: tcp: Make mem flags configurable through bpf_iter_tcp_realloc_batch [+ + +]
Author: Jordan Rife <jordan@jrife.io>
Date:   Mon Jul 14 11:09:05 2025 -0700

    bpf: tcp: Make mem flags configurable through bpf_iter_tcp_realloc_batch
    
    [ Upstream commit 8271bec9fc1cfe522b1a18cacbefd6712a3d41c2 ]
    
    Prepare for the next patch which needs to be able to choose either
    GFP_USER or GFP_NOWAIT for calls to bpf_iter_tcp_realloc_batch.
    
    Signed-off-by: Jordan Rife <jordan@jrife.io>
    Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Acked-by: Stanislav Fomichev <sdf@fomichev.me>
    Stable-dep-of: e5fd3f514e27 ("bpf: tcp: Fix use-after-free in bpf_iter_tcp_established_batch()")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

bpf: tcp: Make sure iter->batch always contains a full bucket snapshot [+ + +]
Author: Jordan Rife <jordan@jrife.io>
Date:   Mon Jul 14 11:09:06 2025 -0700

    bpf: tcp: Make sure iter->batch always contains a full bucket snapshot
    
    [ Upstream commit cdec67a489d4fdae3e83e04fca0419136a83c4c2 ]
    
    Require that iter->batch always contains a full bucket snapshot. This
    invariant is important to avoid skipping or repeating sockets during
    iteration when combined with the next few patches. Before, there were
    two cases where a call to bpf_iter_tcp_batch may only capture part of a
    bucket:
    
    1. When bpf_iter_tcp_realloc_batch() returns -ENOMEM.
    2. When more sockets are added to the bucket while calling
       bpf_iter_tcp_realloc_batch(), making the updated batch size
       insufficient.
    
    In cases where the batch size only covers part of a bucket, it is
    possible to forget which sockets were already visited, especially if we
    have to process a bucket in more than two batches. This forces us to
    choose between repeating or skipping sockets, so don't allow this:
    
    1. Stop iteration and propagate -ENOMEM up to userspace if reallocation
       fails instead of continuing with a partial batch.
    2. Try bpf_iter_tcp_realloc_batch() with GFP_USER just as before, but if
       we still aren't able to capture the full bucket, call
       bpf_iter_tcp_realloc_batch() again while holding the bucket lock to
       guarantee the bucket does not change. On the second attempt use
       GFP_NOWAIT since we hold onto the spin lock.
    
    I did some manual testing to exercise the code paths where GFP_NOWAIT is
    used and where ERR_PTR(err) is returned. I used the realloc test cases
    included later in this series to trigger a scenario where a realloc
    happens inside bpf_iter_tcp_batch and made a small code tweak to force
    the first realloc attempt to allocate a too-small batch, thus requiring
    another attempt with GFP_NOWAIT. Some printks showed both reallocs with
    the tests passing:
    
    Jun 27 00:00:53 crow kernel: again GFP_USER
    Jun 27 00:00:53 crow kernel: again GFP_NOWAIT
    Jun 27 00:00:53 crow kernel: again GFP_USER
    Jun 27 00:00:53 crow kernel: again GFP_NOWAIT
    
    With this setup, I also forced each of the bpf_iter_tcp_realloc_batch
    calls to return -ENOMEM to ensure that iteration ends and that the
    read() in userspace fails.
    
    Signed-off-by: Jordan Rife <jordan@jrife.io>
    Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Acked-by: Stanislav Fomichev <sdf@fomichev.me>
    Stable-dep-of: e5fd3f514e27 ("bpf: tcp: Fix use-after-free in bpf_iter_tcp_established_batch()")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

bpf: tcp: Use bpf_tcp_iter_batch_item for bpf_tcp_iter_state batch items [+ + +]
Author: Jordan Rife <jordan@jrife.io>
Date:   Mon Jul 14 11:09:08 2025 -0700

    bpf: tcp: Use bpf_tcp_iter_batch_item for bpf_tcp_iter_state batch items
    
    [ Upstream commit efeb820951ebf3778830256496ff72d00d135310 ]
    
    Prepare for the next patch that tracks cookies between iterations by
    converting struct sock **batch to union bpf_tcp_iter_batch_item *batch
    inside struct bpf_tcp_iter_state.
    
    Signed-off-by: Jordan Rife <jordan@jrife.io>
    Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Acked-by: Stanislav Fomichev <sdf@fomichev.me>
    Stable-dep-of: e5fd3f514e27 ("bpf: tcp: Fix use-after-free in bpf_iter_tcp_established_batch()")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
btrfs: fix memory leak in btrfs_do_encoded_write() [+ + +]
Author: Dmitry Antipov <dmantipov@yandex.ru>
Date:   Mon Jul 27 14:53:52 2026 +0300

    btrfs: fix memory leak in btrfs_do_encoded_write()
    
    [ Upstream commit d2a4e4e626b2f4670b69b430c357f03f53eb6632 ]
    
    Local fuzzing of 6.12.94 has found the following memory leak:
    
    Unreferenced object 0xffff888018050a80 (size 64):
      comm "syz.0.17", pid 10297, jiffies 4294953601
      hex dump (first 32 bytes):
        00 10 00 00 00 00 00 00 01 00 00 00 00 00 00 00  ................
        10 0a 05 18 80 88 ff ff 10 0a 05 18 80 88 ff ff  ................
      backtrace (crc a8a6fc29):
        kmemleak_alloc_recursive include/linux/kmemleak.h:42 [inline]
        slab_post_alloc_hook mm/slub.c:4152 [inline]
        slab_alloc_node mm/slub.c:4197 [inline]
        __kmalloc_cache_noprof+0x168/0x2c0 mm/slub.c:4358
        kmalloc_noprof include/linux/slab.h:878 [inline]
        extent_changeset_alloc fs/btrfs/extent_io.h:207 [inline]
        qgroup_reserve_data+0x1c5/0x7d0 fs/btrfs/qgroup.c:4305
        btrfs_qgroup_reserve_data+0x2e/0xb0 fs/btrfs/qgroup.c:4355
        btrfs_do_encoded_write+0x92e/0x1040 fs/btrfs/inode.c:9746
        btrfs_encoded_write fs/btrfs/file.c:1482 [inline]
        btrfs_do_write_iter+0x280/0x610 fs/btrfs/file.c:1507
        btrfs_ioctl_encoded_write+0x3d6/0x490 fs/btrfs/ioctl.c:4738
        btrfs_ioctl+0x6f9/0xc90 fs/btrfs/ioctl.c:-1
        vfs_ioctl fs/ioctl.c:51 [inline]
        __do_sys_ioctl fs/ioctl.c:906 [inline]
        __se_sys_ioctl+0xf9/0x170 fs/ioctl.c:892
        do_syscall_x64 arch/x86/entry/common.c:47 [inline]
        do_syscall_64+0xbe/0x1a0 arch/x86/entry/common.c:78
        entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
    Unreferenced object 0xffff888018050a00 (size 64):
      comm "syz.0.17", pid 10297, jiffies 4294953601
      hex dump (first 32 bytes):
        00 00 00 00 00 00 00 00 ff 0f 00 00 00 00 00 00  ................
        90 0a 05 18 80 88 ff ff 90 0a 05 18 80 88 ff ff  ................
      backtrace (crc cb5c9580):
        kmemleak_alloc_recursive include/linux/kmemleak.h:42 [inline]
        slab_post_alloc_hook mm/slub.c:4152 [inline]
        slab_alloc_node mm/slub.c:4197 [inline]
        __kmalloc_cache_noprof+0x168/0x2c0 mm/slub.c:4358
        kmalloc_noprof include/linux/slab.h:878 [inline]
        kzalloc_noprof include/linux/slab.h:1014 [inline]
        ulist_prealloc+0x9c/0x110 fs/btrfs/ulist.c:114
        extent_changeset_prealloc fs/btrfs/extent_io.h:217 [inline]
        __set_extent_bit+0x16b/0x1a70 fs/btrfs/extent-io-tree.c:1086
        set_record_extent_bits+0x50/0x90 fs/btrfs/extent-io-tree.c:1821
        qgroup_reserve_data+0x274/0x7d0 fs/btrfs/qgroup.c:4312
        btrfs_qgroup_reserve_data+0x2e/0xb0 fs/btrfs/qgroup.c:4355
        btrfs_do_encoded_write+0x92e/0x1040 fs/btrfs/inode.c:9746
        btrfs_encoded_write fs/btrfs/file.c:1482 [inline]
        btrfs_do_write_iter+0x280/0x610 fs/btrfs/file.c:1507
        btrfs_ioctl_encoded_write+0x3d6/0x490 fs/btrfs/ioctl.c:4738
        btrfs_ioctl+0x6f9/0xc90 fs/btrfs/ioctl.c:-1
        vfs_ioctl fs/ioctl.c:51 [inline]
        __do_sys_ioctl fs/ioctl.c:906 [inline]
        __se_sys_ioctl+0xf9/0x170 fs/ioctl.c:892
        do_syscall_x64 arch/x86/entry/common.c:47 [inline]
        do_syscall_64+0xbe/0x1a0 arch/x86/entry/common.c:78
        entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
    Fix this by freeing an extent changeset before returning from
    btrfs_do_encoded_write().
    
    Fixes: 7c0c7269f7b5 ("btrfs: add BTRFS_IOC_ENCODED_WRITE")
    Reviewed-by: Filipe Manana <fdmanana@suse.com>
    Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
    Signed-off-by: Filipe Manana <fdmanana@suse.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
counter: microchip-tcb-capture: Fix DT channel validation [+ + +]
Author: Babanpreet Singh <bbnpreetsingh@gmail.com>
Date:   Tue Jul 14 04:29:10 2026 +0000

    counter: microchip-tcb-capture: Fix DT channel validation
    
    [ Upstream commit f1a3a9946aab611dd2200c01ff122f64b033dad2 ]
    
    mchp_tc_probe() reads the devicetree "reg" cell - a u32, per the API
    contract of of_property_read_u32_index() - into a signed int, so the
    bounds check "channel > 2" fails to reject cell values at or above
    0x80000000: reinterpreted as a negative int, they compare below 2 and
    pass validation.
    
    A malformed devicetree can therefore drive a negative channel into the
    ATMEL_TC_REG() offset arithmetic, making the driver access syscon
    regmap offsets outside the TC block's register window, and into the
    "t%d_clk" clock-name formatting, where it truncates clk_name (sized
    for "t0_clk".."t2_clk").
    
    Declare channel as u32, matching the API contract; the unsigned
    comparison then rejects everything except channels 0..2. Adjust the
    format specifier to %u accordingly, which also resolves the W=1
    warning that exposed the gap:
    
      microchip-tcb-capture.c:520:56: warning: '%d' directive output may
        be truncated writing between 1 and 11 bytes into a region of size
        6 [-Wformat-truncation=]
      note: directive argument in the range [-2147483648, 2]
    
    No behavior change for well-formed devicetrees: channels 0..2 take
    identical paths before and after.
    
    Fixes: 106b104137fd ("counter: Add microchip TCB capture counter")
    Assisted-by: Claude:claude-fable-5 [gcc W=1]
    Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com>
    Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
    Link: https://lore.kernel.org/r/20260714042910.7-1-bbnpreetsingh@gmail.com
    Signed-off-by: William Breathitt Gray <wbg@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
crypto: ccp - Abort doing SEV INIT if SNP INIT fails [+ + +]
Author: Ashish Kalra <ashish.kalra@amd.com>
Date:   Fri Aug 14 12:02:57 2026 +0200

    crypto: ccp - Abort doing SEV INIT if SNP INIT fails
    
    commit 6131e119f5799bec55535530fa2fc44f5c7be1f1 upstream.
    
    If SNP host support (SYSCFG.SNPEn) is set, then the RMP table must
    be initialized before calling SEV INIT.
    
    In other words, if SNP_INIT(_EX) is not issued or fails then
    SEV INIT will fail if SNP host support (SYSCFG.SNPEn) is enabled.
    
    Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Jack Wang <jinpu.wang@cloud.ionos.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

crypto: ccp - Add new SEV/SNP platform shutdown API [+ + +]
Author: Ashish Kalra <ashish.kalra@amd.com>
Date:   Fri Aug 14 12:02:54 2026 +0200

    crypto: ccp - Add new SEV/SNP platform shutdown API
    
    commit f7b86e0e75bc234751cb7a82d888083a57ef28b2 upstream.
    
    Add new API interface to do SEV/SNP platform shutdown when KVM module
    is unloaded.
    
    Reviewed-by: Dionna Glaze <dionnaglaze@google.com>
    Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
    Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Jack Wang <jinpu.wang@cloud.ionos.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

crypto: ccp - Fix checks for SNP_VLEK_LOAD input buffer length [+ + +]
Author: Michael Roth <michael.roth@amd.com>
Date:   Fri Aug 14 12:02:56 2026 +0200

    crypto: ccp - Fix checks for SNP_VLEK_LOAD input buffer length
    
    commit ed53a5050f42a3243a7ed8dfa49030e54034b952 upstream.
    
    The SNP_VLEK_LOAD IOCTL currently fails due to sev_cmd_buffer_len()
    returning the default expected buffer length of 0 instead of the correct
    value, which would be sizeof(struct sev_user_data_snp_vlek_load). Add
    specific handling for SNP_VLEK_LOAD so the correct expected size is
    returned.
    
    Reported-by: Diego GonzalezVillalobos <Diego.GonzalezVillalobos@amd.com>
    Cc: Diego GonzalezVillalobos <Diego.GonzalezVillalobos@amd.com>
    Fixes: 332d2c1d713e ("crypto: ccp: Add the SNP_VLEK_LOAD command")
    Signed-off-by: Michael Roth <michael.roth@amd.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    [Jack: sev_cmd_buffer_len() in queue/6.12 does not yet have the
     SEV_CMD_SNP_FEATURE_INFO case the upstream context line matched
     against (it lands in a later, unrelated commit not queued here),
     so the new SEV_CMD_SNP_VLEK_LOAD case was placed directly after
     SEV_CMD_SNP_COMMIT instead. No functional difference from upstream.]
    Signed-off-by: Jack Wang <jinpu.wang@cloud.ionos.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
devlink: fix net namespace reference leak in reload [+ + +]
Author: Or Har-Toov <ohartoov@nvidia.com>
Date:   Wed Jul 29 11:06:00 2026 +0300

    devlink: fix net namespace reference leak in reload
    
    [ Upstream commit 1c4dac9bf1d2ac31da63b794bdec697777cbd0fd ]
    
    devlink_nl_reload_doit() calls devlink_netns_get(), which returns a net
    with a held reference. When the requested namespace differs from the
    current one and the reload action is not DRIVER_REINIT, the function
    returns -EOPNOTSUPP without releasing the reference. Add the missing
    put_net() on this error path.
    
    Fixes: 2edd92570441 ("devlink: don't allow to change net namespace for FW_ACTIVATE reload action")
    Signed-off-by: Or Har-Toov <ohartoov@nvidia.com>
    Reviewed-by: Jiri Pirko <jiri@nvidia.com>
    Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
    Reviewed-by: Antoine Tenart <atenart@kernel.org>
    Link: https://patch.msgid.link/20260729080600.2427721-1-tariqt@nvidia.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/amd/display: Add AV mute wait frames to dce110_set_avmute [+ + +]
Author: Ray Wu <ray.wu@amd.com>
Date:   Mon Jul 13 22:23:34 2026 +0800

    drm/amd/display: Add AV mute wait frames to dce110_set_avmute
    
    [ Upstream commit 443290d70b01e9c35830c300e3247c06581b594c ]
    
    Port the three-frame wait logic from dcn30_set_avmute to
    dce110_set_avmute so that older DCN versions (1.0, 2.0) also
    wait for GCP packets to be sent out before proceeding.
    
    This ensures HDMI sinks properly process the mute state,
    preventing garbled display after link re-establishment.
    
    Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/5167
    Reviewed-by: Wayne Lin <wayne.lin@amd.com>
    Signed-off-by: Ray Wu <ray.wu@amd.com>
    Signed-off-by: Fangzhi Zuo <jerry.zuo@amd.com>
    Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 414da24137ace80d8c59fefd43ba3ec9f5f854ba)
    Cc: stable@vger.kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/amd/display: Check for tg ops in dce110_set_avmute [+ + +]
Author: Ray Wu <ray.wu@amd.com>
Date:   Wed Aug 5 09:47:17 2026 +0800

    drm/amd/display: Check for tg ops in dce110_set_avmute
    
    [ Upstream commit 3141e3d61469bba2624a91c5e2407f110b33b29e ]
    
    Some older DCE timing generators do not implement is_tg_enabled in
    their ops table. Calling it unconditionally when waiting for AV mute
    frames causes a NULL pointer dereference on Southern Islands dGPUs
    when turning the display off over HDMI.
    
    Check that tg and the required ops exist before waiting for frames.
    
    Fixes: 414da24137ac ("drm/amd/display: Add AV mute wait frames to dce110_set_avmute")
    Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/5557
    Tested-by: Viktor Jägersküpper <viktor_jaegerskuepper@freenet.de>
    Signed-off-by: Ray Wu <ray.wu@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 2686a0c0aaa07bec2e24131835cf27b5fd4935a5)
    Cc: stable@vger.kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/bridge: ps8640: propagate AUX transfer register errors [+ + +]
Author: Pengpeng Hou <pengpeng@iscas.ac.cn>
Date:   Thu Jul 23 10:38:06 2026 +0800

    drm/bridge: ps8640: propagate AUX transfer register errors
    
    [ Upstream commit 20697ecb299cd77b4cf8b28f655e56606b0472d8 ]
    
    ps8640_aux_transfer_msg() programs the AUX address registers, starts the
    AUX transfer, waits for SWAUX_SEND to clear, and reads the AUX status
    register. Several of those regmap operations have return values, but the
    function only checks a stale ret after the status read.
    
    Propagate failures from the address write, transfer start, completion
    poll, and status read. This avoids returning a transfer length when the
    bridge register transaction or AUX completion wait failed.
    
    Fixes: 13afcdd7277e ("drm/bridge: parade-ps8640: Add support for AUX channel")
    Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
    Reviewed-by: Douglas Anderson <dianders@chromium.org>
    Signed-off-by: Douglas Anderson <dianders@chromium.org>
    Link: https://patch.msgid.link/20260723103509.2-ps8640-v2-pengpeng@iscas.ac.cn
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
dt-bindings: crypto: qcom,ice: Fix missing power-domain and iface clk [+ + +]
Author: Harshal Dev <harshal.dev@oss.qualcomm.com>
Date:   Wed Aug 12 19:18:10 2026 +0530

    dt-bindings: crypto: qcom,ice: Fix missing power-domain and iface clk
    
    [ Upstream commit e27264daac7d9ce892a2a5b4a864d6d9a3c9276a ]
    
    The DT bindings for inline-crypto engine do not specify the UFS_PHY_GDSC
    power-domain and iface clock. Without enabling the iface clock and the
    associated power-domain the ICE hardware cannot function correctly and
    leads to unclocked hardware accesses being observed during probe.
    
    Extend and fix the DT bindings for inline-crypto engine by allowing
    description of the iface clock and UFS_PHY_GDSC power-domain.
    
    This patch has been adapted from the mentioned upstream commit to drop
    references to Eliza and Milos Qualcomm platforms which do not exist
    on the stable tree. Thus, patch now fixes the original commit which
    introduced the DT binding for Qualcomm inline-crypto engine.
    
    Fixes: f6ff91a47ac5 ("dt-bindings: crypto: Add Qualcomm Inline Crypto Engine")
    Reviewed-by: Kuldeep Singh <kuldeep.singh@oss.qualcomm.com>
    Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
    Signed-off-by: Harshal Dev <harshal.dev@oss.qualcomm.com>
    Link: https://lore.kernel.org/r/20260416-qcom_ice_power_and_clk_vote-v5-1-5ccf5d7e2846@oss.qualcomm.com
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
enic: fix tx_hang_reset use-after-free on device removal [+ + +]
Author: Satish Kharat <satishkh@cisco.com>
Date:   Mon Jul 27 23:26:30 2026 -0700

    enic: fix tx_hang_reset use-after-free on device removal
    
    [ Upstream commit ec680ea4ba1bca92a767fb7e7869758bfdd886e3 ]
    
    enic_remove() cancels the reset and change_mtu_work items but does not
    cancel tx_hang_reset. A TX timeout that fires while the device is being
    removed can schedule enic_tx_hang_reset() so that it runs after
    free_netdev(), resulting in a use-after-free.
    
    cancel_work_sync() alone is not sufficient here: the still-live watchdog
    and notify paths can re-schedule these work items in the window between
    the cancel and unregister_netdev(). Use disable_work_sync(), which
    cancels the work and blocks any subsequent schedule_work() from
    requeuing it, and apply it to the reset and change_mtu_work items as
    well so the same requeue race is closed for all teardown work.
    
    Fixes: 937317c7c109 ("enic: do hang reset only in case of tx timeout")
    Signed-off-by: Satish Kharat <satishkh@cisco.com>
    Link: https://patch.msgid.link/20260728062730.2394873-1-satishkh@cisco.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
eventfs: Fix use-after-free in eventfs_remove_rec() [+ + +]
Author: Shuangpeng Bai <shuangpeng.kernel@gmail.com>
Date:   Wed Aug 5 22:27:19 2026 -0400

    eventfs: Fix use-after-free in eventfs_remove_rec()
    
    commit fd73b691702170d37d66f4b0278530cea8ed419a upstream.
    
    eventfs_remove_rec() recursively removes the child at the current loop
    position. After the recursive call returns, list_for_each_entry() advances
    by reading list.next from the removed child.
    
    If free_ei() drops the final reference, release_ei() reuses the list/rcu
    union to queue an SRCU callback. The child may be freed before that read.
    The eventfs_mutex serializes list updates, but it does not keep the removed
    child alive or prevent the SRCU callback from running.
    
    Use list_for_each_entry_safe() to save the next sibling before recursively
    removing the current child.
    
    Cc: stable@vger.kernel.org
    Fixes: 43aa6f97c2d0 ("eventfs: Get rid of dentry pointers without refcounts")
    Link: https://patch.msgid.link/20260806022719.375354-1-shuangpeng.kernel@gmail.com
    Signed-off-by: Shuangpeng Bai <shuangpeng.kernel@gmail.com>
    Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
fbdev: bitblit: bound-check glyph index in bit_cursor() [+ + +]
Author: Rik van Riel <riel@surriel.com>
Date:   Fri Aug 7 22:19:56 2026 -0400

    fbdev: bitblit: bound-check glyph index in bit_cursor()
    
    commit e033cbf3975a8465f879ebd5989dc35b04423a4d upstream.
    
    bit_cursor() fetches the glyph under the cursor with
    
            c = scr_readw(vc_pos);
            src = vc_font.data + ((c & charmask) * w * height);
    
    where charmask is 0x1ff when vc_hi_font_mask is set. The screen buffer
    value comes directly from scr_readw() and may be larger than the current
    font's glyph count.
    
    Syzkaller triggers this via vcs_write(). The Call Trace shows
    vcs_write() in vc_screen.c writing an arbitrary 16-bit value with
    writev() to /dev/vcsa, which vcs_write_buf() in vc_screen.c stores via
    vcs_scr_writew() without checking charcount. The stored value is later
    read in bit_cursor() in bitblit.c.
    
    When the font is changed from a font with 512 glyphs to a font with
    256 glyphs, the screen buffer can retain characters with the high
    bit set from the previous mode, which could also produce the same
    out-of-bounds access.
    
      BUG: KASAN: global-out-of-bounds in soft_cursor+0x378/0x6bc drivers/video/fbdev/core/softcursor.c:70
      Read of size 16 at addr ffff800086c57970
    
      Call Trace:
       soft_cursor+0x378/0x6bc drivers/video/fbdev/core/softcursor.c:70
       bit_cursor+0xa90/0x1108 drivers/video/fbdev/core/bitblit.c:365
       fbcon_cursor+0x344/0x498 drivers/video/fbdev/core/fbcon.c:1427
       hide_cursor+0xdc/0x2d0 drivers/tty/vt/vt.c:883
       update_region+0x100/0x18c drivers/tty/vt/vt.c:669
       vcs_write+0x8ec/0xaf0 drivers/tty/vt/vc_screen.c:685
    
    bit_putcs_aligned() and bit_putcs_unaligned() already clamp the glyph
    index to vc_font.charcount. Apply the same clamp in bit_cursor() after
    extracting the attribute and masking, before indexing fontdata.
    
    The fix completes the bounds checking started in commit 18c4ef4e765a
    ("fbdev: bitblit: bound-check glyph index in bit_putcs*"), which missed
    the cursor path.
    
    This change should be safe because the clamp reuses the existing
    contract from fbcon: charcount is maintained under console_lock in
    con_font_set() and fbcon_font_set(), and hi_font_mask is cleared when
    switching from 512 to 256 glyphs. When stale screen data with high bits
    remains after a font switch, or when vcs_write() stores an arbitrary
    value, clamping the index to 0 prevents the out-of-bounds read without
    changing cursor semantics — the same fallback bit_putcs uses.
    
    Reported-by: syzbot+61b1db46218109869c14@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=61b1db46218109869c14
    Link: https://lore.kernel.org/all/6a75205c.01d0871a.3a0d52.0032.GAE@google.com/
    Fixes: 18c4ef4e765a ("fbdev: bitblit: bound-check glyph index in bit_putcs*")
    Cc: stable@vger.kernel.org
    Assisted-by: Hermes:muse-spark-1.2 syzkaller
    Signed-off-by: Rik van Riel <riel@surriel.com>
    Signed-off-by: Helge Deller <deller@gmx.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
fscrypt: use the mount idmap for the owner check in fscrypt_ioctl_set_policy() [+ + +]
Author: Zhan Xusheng <zhanxusheng@xiaomi.com>
Date:   Sat Jul 25 16:00:04 2026 +0800

    fscrypt: use the mount idmap for the owner check in fscrypt_ioctl_set_policy()
    
    commit cf6c993c0feca7984797e634deba3c80342e199a upstream.
    
    fscrypt_ioctl_set_policy() calls inode_owner_or_capable() with
    &nop_mnt_idmap before allowing an encryption policy to be set, instead
    of the idmap of the mount the ioctl was issued on.
    
    fscrypt is used by filesystems that support idmapped mounts (e.g. ext4,
    f2fs), so on such a mount this compares the caller's fsuid against the
    unmapped on-disk owner rather than the mapped owner: the actual owner
    can be wrongly denied with -EACCES and an unrelated caller wrongly
    allowed.  Use file_mnt_idmap(filp) instead.
    
    Fixes: 14f3db5542e6 ("ext4: support idmapped mounts")
    Cc: stable@vger.kernel.org
    Signed-off-by: Zhan Xusheng <zhanxusheng@xiaomi.com>
    Link: https://patch.msgid.link/20260725080004.929328-1-zhanxusheng1024@gmail.com
    Signed-off-by: Eric Biggers <ebiggers@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
fsverity: Fix bpf_get_fsverity_digest() dynptr assumptions [+ + +]
Author: Eric Biggers <ebiggers@kernel.org>
Date:   Mon Aug 3 11:12:31 2026 -0700

    fsverity: Fix bpf_get_fsverity_digest() dynptr assumptions
    
    commit 3e8ec7c0387273329374f5c7bd61f5f38af71fe1 upstream.
    
    The BPF verifier and the dynptr abstraction ensure that the memory space
    referenced by a dynptr remains valid.  They do not, however, provide any
    guarantee that the contents of the memory are stable.  kfuncs are
    expected to remain memory-safe even if concurrent modifications occur.
    
    bpf_get_fsverity_digest() didn't follow that: it could crash if
    arg->digest_size was concurrently modified.
    
    Fix that by using the known-good value hash_alg->digest_size instead.
    
    Also widen 'dynptr_sz' and 'out_digest_sz' to u64 to match the return
    type of __bpf_dynptr_size().  It doesn't appear that it can actually be
    more than INT_MAX currently (since __bpf_dynptr_data_rw() excludes
    file-based pointers), but the correct type might as well be used.
    
    Fixes: 67814c00de31 ("bpf, fsverity: Add kfunc bpf_get_fsverity_digest")
    Signed-off-by: Eric Biggers <ebiggers@kernel.org>
    Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
    Acked-by: Song Liu <song@kernel.org>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/bpf/20260803181232.14743-2-ebiggers@kernel.org
    Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

fsverity: Fix silent truncation in bpf_get_fsverity_digest() [+ + +]
Author: Eric Biggers <ebiggers@kernel.org>
Date:   Mon Aug 3 11:12:32 2026 -0700

    fsverity: Fix silent truncation in bpf_get_fsverity_digest()
    
    commit 7c68ed5c5ad4c185ea9654f5d8ee36560277b7dd upstream.
    
    bpf_get_fsverity_digest() silently truncates the digest if the provided
    buffer is too small.  This is a footgun, and it doesn't match the
    semantics of the equivalent UAPI (FS_IOC_MEASURE_VERITY).
    
    Change it to return -EOVERFLOW instead, matching FS_IOC_MEASURE_VERITY.
    
    Fixes: 67814c00de31 ("bpf, fsverity: Add kfunc bpf_get_fsverity_digest")
    Signed-off-by: Eric Biggers <ebiggers@kernel.org>
    Acked-by: Song Liu <song@kernel.org>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/bpf/20260803181232.14743-3-ebiggers@kernel.org
    Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
futex: Prevent robust futex exit race some more [+ + +]
Author: Keno Fischer <keno@juliacomputing.com>
Date:   Fri Aug 14 14:43:28 2026 +0200

    futex: Prevent robust futex exit race some more
    
    commit 6d4514ca9cdf61fec4ec634cf50386f6f7e69748 upstream.
    
    A robust futex unlock stores 0 over the whole futex value - wiping
    FUTEX_WAITERS - and wakes a single waiter. That wakeup is a one-shot
    notification: the protocol relies on its recipient to either acquire the
    futex (and eventually unlock while aware of the remaining contention) or
    re-arm FUTEX_WAITERS before sleeping again.  If the woken waiter is killed
    before it can do either, the kernel must jump in and wake the next task
    down the line.
    
    This is a known complication of the futex protocol with a previous
    partial fix in commit ca16d5bee598 ("futex: Prevent robust futex exit
    race"). Unfortunately, that fix is insufficient.
    
    If a third task re-acquired the futex through the uncontended fast
    path in the meantime, the notification is lost: robust exit processing
    sees that it is owned by another task and does nothing, while the new
    owner sees no FUTEX_WAITERS when it unlocks and wakes nobody.
    The remaining waiters sleep forever behind a free futex:
    
      A owns the futex, B and C sleep in FUTEX_WAIT
                                            uval == A | FUTEX_WAITERS
      A robust unlock: store 0, FUTEX_WAKE(1) wakes B
                                            uval == 0
      D fast path acquire: cmpxchg(0 -> D)
                                            uval == D, no FUTEX_WAITERS
      B killed before acting on the wakeup
      B exit walk, pending op: owner D != B -> no action
      D unlock: no FUTEX_WAITERS -> no wake
                                            C sleeps forever
    
    This is clearly a shortcoming in the implementation, which fails to keep
    the FUTEX_WAITERS bit consistent.
    
    Work around this by augmenting the robust list exit processing to also
    perform the extra wakeup if the futex word is owned by another thread but
    FUTEX_WAITERS is not set.
    
    This does not fix the problem of a non-contended take over/release and free
    sequence, which has been discussed for years and has been addressed by
    commit 3ca9595d9fb6 ("futex: Add support for unlocking robust futexes") and
    subsequent changes, but failed to take the problem described above into
    account.
    
    A more complete solution which is based on the in kernel unlock of
    contended robust futexes has been discussed in the context of this change
    and should show up in mainline sooner than later.
    
    [ tglx: Amend change log slightly and fixup coding style ]
    
    Fixes: ca16d5bee598 ("futex: Prevent robust futex exit race")
    Signed-off-by: Keno Fischer <keno@juliahub.com>
    Signed-off-by: Thomas Gleixner <tglx@kernel.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Thomas Gleixner <tglx@kernel.org>
    Assisted-by: ClaudeCode:claude-fable-5 tla+
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20260730194705.38981-1-keno@juliacomputing.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
hwmon: (ads7828) Fix external VREF regulator handling [+ + +]
Author: Qingshuang Fu <fuqingshuang@kylinos.cn>
Date:   Wed Aug 5 14:16:45 2026 +0800

    hwmon: (ads7828) Fix external VREF regulator handling
    
    [ Upstream commit fddb5ceaf901b050ed2a1a7deeecbf97e003435a ]
    
    The driver currently has two issues with the external VREF regulator
    handling in ads7828_probe():
    
    1. All errors from devm_regulator_get_optional() are ignored, causing the
       driver to incorrectly fall back to internal VREF even for transient
       errors like -EPROBE_DEFER or genuine failures like -ENOMEM.
    
    2. The external regulator is never enabled. The driver calls
       regulator_get_voltage() without first calling regulator_enable(),
       so the VREF pin may remain unpowered if the regulator is not
       configured as always-on.
    
    Fix both issues by switching to devm_regulator_get_enable_read_voltage(),
    which handles regulator get, enable, and voltage read in one call.
    Only -ENODEV (no regulator specified in device tree) should trigger the
    fallback to internal VREF. All other errors are propagated to the caller.
    
    Fixes: a8ddfea09566 ("hwmon: (ads7828) Accept optional parameters from device tree")
    Signed-off-by: Qingshuang Fu <fuqingshuang@kylinos.cn>
    Link: https://lore.kernel.org/r/20260805061645.1331652-1-fffsqian@163.com
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

hwmon: (corsair-psu) fix possible out-of-bounds access on missing string termination [+ + +]
Author: Wilken Gottwalt <wilken.gottwalt@posteo.net>
Date:   Wed Aug 5 07:19:20 2026 +0000

    hwmon: (corsair-psu) fix possible out-of-bounds access on missing string termination
    
    [ Upstream commit 36c4d73ce05d1d8896c2669eb0730d35a02a2ec1 ]
    
    In theory it could be possible that the REPLY_SIZE sized buffers for
    holding the vendor and product strings could be end up missing the null
    termination (for example by malicious hardware built on purpose)
    required by the seq_printf() call. That limits the debugfs printf calls
    to a maximum string length of REPLY_SIZE.
    
    Fixes: d115b51e0e567 ("hwmon: add Corsair PSU HID controller driver")
    Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net>
    Link: https://lore.kernel.org/r/anLj9gPWRoRDbQBV@monster.localdomain
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

hwmon: (ltc4282) Avoid overflow in maximum power calculation [+ + +]
Author: Guenter Roeck <linux@roeck-us.net>
Date:   Tue Aug 4 15:42:42 2026 -0700

    hwmon: (ltc4282) Avoid overflow in maximum power calculation
    
    [ Upstream commit edd11a94335747423569500a194c6eaa915f2963 ]
    
    During device initialization in ltc4282_set_max_limits(), the calculation
    of the maximum power limit can suffer from a 32-bit integer overflow.
    
    static int ltc4282_set_max_limits(struct ltc4282_state *st)
    {
        ...
        st->power_max = DIV_ROUND_CLOSEST(st->vsense_max * DECA * MILLI,
                                          st->rsense) * st->vfs_out;
        ...
    }
    
    The result of DIV_ROUND_CLOSEST() evaluates to a 32-bit unsigned integer
    on 32-bit architectures. This result is then multiplied by st->vfs_out,
    which is a 16-bit unsigned integer. According to C promotion rules, since
    both operands are 32-bit or smaller, the multiplication is performed in
    32-bit precision.
    
    If the device is configured with a low sense resistor value via the device
    tree (for example, 100 nano-ohms, resulting in st->rsense = 1) and the
    voltage is high, the division result can reach 343,750,000 and st->vfs_out
    can be 33,280. The product of these values is approximately 11.44 trillion,
    which exceeds the maximum capacity of a 32-bit integer and overflows
    before being stored in st->power_max.
    
    This overflow causes a truncated value to be assigned to st->power_max and
    written to the hardware limit register. An incorrect maximum power limit
    can trigger spurious power-bad faults or alarms, which may lead to the
    shutdown of the monitored power rail.
    
    Avoid the problem by calculating and storing the maximum power using 64-bit
    variables.
    
    Reported-by: Sashiko <sashiko-bot@kernel.org>
    Fixes: cbc29538dbf7d ("hwmon: Add driver for LTC4282")
    Cc: Nuno Sa <nuno.sa@analog.com>
    Reviewed-by: Nuno Sá <nuno.sa@analog.com>
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

hwmon: (ltc4282) Clamp negative current limits [+ + +]
Author: Guenter Roeck <linux@roeck-us.net>
Date:   Tue Aug 4 16:26:05 2026 -0700

    hwmon: (ltc4282) Clamp negative current limits
    
    [ Upstream commit e253dd5f9f6d875a317895bf43ec9534ed7523cb ]
    
    When a negative value is passed to ltc4282_write_curr(), the signed long
    val is cast directly to u64:
    
    drivers/hwmon/ltc4282.c:ltc4282_write_curr() {
            /* need to pass it in millivolt */
            u32 in = DIV_ROUND_CLOSEST_ULL((u64)val * st->rsense, DECA * MICRO);
            ...
    }
    
    This cast converts negative inputs into large positive values. The
    subsequent division result overflows the u32 in variable, truncating
    to a pseudo-random positive value. When this is passed to
    ltc4282_write_voltage_byte(), it is clamped to the maximum limit instead
    of zero.
    
    Clamp val to 0 and to the maximum supported upper limit before the cast
    and assign the result to a 64-bit temporary variable before the division
    to avoid the underflow and an also possible overflow.
    
    Reported-by: Sashiko <sashiko-bot@kernel.org>
    Fixes: cbc29538dbf7d ("hwmon: Add driver for LTC4282")
    Cc: Nuno Sa <nuno.sa@analog.com>
    Reviewed-by: Nuno Sá <nuno.sa@analog.com>
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

hwmon: (ltc4282) Fix parsing adi,current-limit-sense-microvolt [+ + +]
Author: Guenter Roeck <linux@roeck-us.net>
Date:   Tue Aug 4 17:30:42 2026 -0700

    hwmon: (ltc4282) Fix parsing adi,current-limit-sense-microvolt
    
    [ Upstream commit 335698fd7f60b6707b21fda725f97f35fa956b07 ]
    
    ltc4282_parse_dt() evaluates the wrong variable when parsing the current
    limit.
    
    When the adi,current-limit-sense-microvolt property is parsed into
    st->vsense_max, the subsequent switch statement evaluates the unrelated
    val variable instead of st->vsense_max:
    
    drivers/hwmon/ltc4282.c:ltc4282_parse_dt() {
        ...
            ret = device_property_read_u32(dev, "adi,current-limit-sense-microvolt",
                                           &st->vsense_max);
            if (!ret) {
                    int reg_val;
    
                    switch (val) {
                    case 12500:
                            reg_val = 0;
                            break;
        ...
    }
    
    Because val holds a small integer representing vin_mode (from 0 to 3), it
    never matches any of the valid current limit cases.
    
    This causes it to always fall through to the default error case, return
    -EINVAL, and aborts probe initialization for any device tree using this
    property.
    
    Validate st->vsense_max instead to fix the problem.
    
    Reported-by: Sashiko <sashiko-bot@kernel.org>
    Fixes: cbc29538dbf7d ("hwmon: Add driver for LTC4282")
    Cc: Nuno Sa <nuno.sa@analog.com>
    Reviewed-by: Nuno Sá <nuno.sa@analog.com>
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

hwmon: (nzxt-smart2) Check return value of init_device() in probe [+ + +]
Author: Qingshuang Fu <fuqingshuang@kylinos.cn>
Date:   Tue Aug 4 15:48:42 2026 +0800

    hwmon: (nzxt-smart2) Check return value of init_device() in probe
    
    [ Upstream commit d533882ce1060866a590257f2c77ee23eabef5b8 ]
    
    The init_device() call in nzxt_smart2_hid_probe() can fail because it
    sends HID output reports to the hardware to detect fans and set the
    update interval.  If the hardware is not responding or the HID reports
    fail, init_device() returns a negative error code.
    
    However, the return value was ignored, causing the probe to continue
    and register an hwmon device even though the device was never properly
    initialized.  This leads to an inconsistent state where the driver
    reports stale data or blocks on wait queues that will never be woken.
    
    The same function's return value is already checked in the
    reset_resume() handler, confirming the author's intent that errors
    should be propagated.
    
    Note that this fix was not possible before commit 59d104b54b0b
    ("hwmon: (nzxt-smart2) Stop device IO before calling hid_hw_stop")
    because the out_hw_close error path was missing hid_device_io_stop(),
    which would have opened a use-after-free risk window.
    
    Fixes: 53e68c20aeb1 ("hwmon: add driver for NZXT RGB&Fan Controller/Smart Device v2.")
    Signed-off-by: Qingshuang Fu <fuqingshuang@kylinos.cn>
    Link: https://lore.kernel.org/r/20260804074842.505923-1-fffsqian@163.com
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

hwmon: (pmbus/lm25066) Fix PMBus coefficient calculations [+ + +]
Author: Guenter Roeck <linux@roeck-us.net>
Date:   Tue Aug 4 14:12:31 2026 -0700

    hwmon: (pmbus/lm25066) Fix PMBus coefficient calculations
    
    [ Upstream commit 0dabe8a56f772f0ece46d2597799f412c277d874 ]
    
    In lm25066_probe(), the PMBus coefficients for current and power are
    scaled based on the shunt resistor value. The calculation evaluates the
    multiplication using 32-bit arithmetic because info->m is an int and
    shunt is a u32:
    
    static int lm25066_probe(struct i2c_client *client) {
        ...
        info->m[PSC_CURRENT_IN] = info->m[PSC_CURRENT_IN] * shunt / 1000;
        info->m[PSC_POWER] = info->m[PSC_POWER] * shunt / 1000;
        ...
    }
    
    For large coefficients like 26882 (LM25056) or 15076 (LM5066i), a device
    tree shunt-resistor-micro-ohms value exceeding approximately 159,000
    (159 mOhm, which is physically valid for low-current applications) causes
    the intermediate product to exceed UINT_MAX (4,294,967,295). This results
    in a silent wraparound before the division by 1000.
    
    Furthermore, if the wrapped value has the most significant bit set,
    converting it back to the signed int info->m results in negative
    coefficients. This logic error leads to drastically corrupted current and
    power readings, which can cause erratic thermal or power management
    behavior in the system.
    
    Fix the problem by using 64-bit operations for the multiply/divide
    operations. This can still overflow, but only for unreasonably large
    shunt resistor values.
    
    Reported-by: Sashiko <sashiko-bot@kernel.org>
    Fixes: 94ee5fcc240fe ("hwmon: (pmbus/lm25066) Support configurable sense resistor values")
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ima: fix out-of-bounds read in xattr_verify() [+ + +]
Author: Lincoln Wallace <locnnil0@gmail.com>
Date:   Mon Aug 3 10:50:21 2026 -0300

    ima: fix out-of-bounds read in xattr_verify()
    
    commit 5ff232d31106f45ac87c3b64e1d35a0667777797 upstream.
    
    The digest-length check in xattr_verify() mixes int and size_t:
    
            if (xattr_len - sizeof(xattr_value->type) - hash_start >=
                            iint->ima_hash->length)
    
    sizeof() yields size_t, so the usual arithmetic conversions promote
    the whole left-hand side to unsigned 64-bit before the subtraction
    runs. For a truncated xattr this underflows instead of going negative:
    a 1-byte IMA_XATTR_DIGEST_NG xattr (xattr_len == 1, hash_start == 1)
    turns "1 - 1 - 1" into SIZE_MAX, which is trivially >= ima_hash->length.
    The check then passes and the following memcmp() reads
    iint->ima_hash->length bytes starting past the end of the buffer
    vfs_getxattr_alloc() allocated for it.
    
    Nothing upstream clamps xattr_len back into a safe range first:
    ima_get_hash_algo() only special-cases xattr_len < 2 to pick a default
    algorithm, and evm_verifyxattr() returns INTEGRITY_UNKNOWN rather than
    failing when no HMAC key is loaded, so a truncated security.ima value
    reaches the length check as-is.
    
    Rewrite the comparison so every operand stays a signed int and no
    implicit conversion to size_t can occur.
    
    Fixes: 3ea7a56067e6 ("ima: provide hash algo info in the xattr")
    Cc: stable@vger.kernel.org
    Signed-off-by: Lincoln Wallace <locnnil0@gmail.com>
    Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ima: Instantiate file_truncate and path_truncate hooks [+ + +]
Author: Mimi Zohar <zohar@linux.ibm.com>
Date:   Mon Jul 27 20:39:41 2026 -0400

    ima: Instantiate file_truncate and path_truncate hooks
    
    commit b80bed5c871a80151351342c065579405ce77145 upstream.
    
    Instantiate the file_truncate and path_truncate LSM hooks to reset the
    action cache flags (IMA_DONE_MASK) as soon as truncation is requested,
    so the file, based on policy, is re-collected, re-measured, re-audited,
    and re-appraised on next access.
    
    Tested-by: Frederick Lawler <fred@cloudflare.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Input: evdev - fix information leak in evdev_pass_values() [+ + +]
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date:   Wed Jul 29 11:30:45 2026 -0700

    Input: evdev - fix information leak in evdev_pass_values()
    
    commit 90f305f2c7a30257c683e13f4bf7c798eea992a0 upstream.
    
    In evdev_pass_values(), the input_event structure is allocated on the
    kernel stack and populated field-by-field. However, it is never fully
    initialized. On architectures where struct input_event contains explicit
    or implicit padding (such as the 32-bit __pad field on SPARC64), these
    padding bytes are left uninitialized.
    
    When this event structure is subsequently passed to the client buffer
    and later copied to userspace, the uninitialized padding bytes leak
    kernel stack memory, potentially exposing sensitive information.
    
    Similar issues exist in __evdev_queue_syn_dropped and __pass_event.
    
    Fix this by explicitly zeroing the entire event structure with memset()
    before populating its fields. This ensures all padding bytes are cleared
    before the data crosses the security boundary.
    
    Reported-by: sashiko-bot@kernel.org
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/ampGGKo4UMKru6f5@google.com
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Input: evdev - sanitize event type index when fetching event masks [+ + +]
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date:   Mon Aug 3 18:41:49 2026 -0700

    Input: evdev - sanitize event type index when fetching event masks
    
    commit 3abd29c61d2ef37c4102cf755b18be53bb9dbea6 upstream.
    
    The user-supplied event type index passed to EVIOCGMASK / EVIOCSMASK
    ioctls is used to index the static counts array in evdev_get_mask_cnt()
    and client evmasks array in evdev_get_mask().
    
    While the event type is architecturally bounded by EV_CNT, speculative
    execution may mispredict bounds checks and perform out-of-bounds loads.
    
    Sanitize the event type index in evdev_get_mask_cnt() branchlessly using
    array_index_mask_nospec(). This clamps the index to 0 for safe array
    access and forces the returned count to 0 speculatively when the index
    is out of bounds.
    
    We do not need additional array_index_nospec() calls in evdev_get_mask()
    because evdev_get_mask_cnt() speculatively forces the count (and
    resulting xfer_size) to 0 for out-of-bounds types, preventing any
    speculative memory access to client evmasks array.
    
    Reported-by: "Wagenaar, C.C.J. (Chris)" <c.c.j.wagenaar@vu.nl>
    Cc: stable@vger.kernel.org
    Assisted-by: Antigravity:gemini-3.6-flash
    Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Link: https://patch.msgid.link/anFCAfvxwXB5eJF1@google.com
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ip6_tunnel: clear skb2->cb[] in ip6ip6_err() [+ + +]
Author: Zhiling Zou <zhilinz@nebusec.ai>
Date:   Mon Aug 3 14:12:33 2026 +0800

    ip6_tunnel: clear skb2->cb[] in ip6ip6_err()
    
    commit f803c086399da277b5d0ff36a107d0f162751800 upstream.
    
    ip6ip6_err() clones an outer IPv6 ICMP error skb, pulls it to the
    quoted inner IPv6 packet, and then passes the clone to icmpv6_send().
    The clone still carries the outer packet's inet6_skb_parm in skb->cb.
    
    If the outer packet had a Home Address Option, IP6CB(skb2)->dsthao
    remains non-zero after skb_pull(). icmpv6_send() later calls
    mip6_addr_swap(), which uses that stale dsthao offset against the quoted
    inner packet. A malformed inner destination-options header can then make
    the HAO lookup and address swap run past the end of the quoted packet
    and corrupt skb_shared_info.
    
    Clear skb2->cb[] before pulling the quoted inner IPv6 packet so the
    reply path does not reuse metadata left by the outer IPv6 stack.
    
    Fixes: e490d1d85cf5 ("[IPV6] IP6TUNNEL: Split out generic routine in ip6ip6_err().")
    Cc: stable@vger.kernel.org
    Reported-by: Vega <vega@nebusec.ai>
    Signed-off-by: Zhiling Zou <zhilinz@nebusec.ai>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Link: https://patch.msgid.link/fe1a5e765fbca88d69391887f0ed26a19e3e4d39.1785736562.git.zhilinz@nebusec.ai
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ipv4: Fix fib_nlmsg_size() for RTA_VIA nexthops [+ + +]
Author: Zihan Xi <zihanx@nebusec.ai>
Date:   Thu Jul 30 12:59:26 2026 +0000

    ipv4: Fix fib_nlmsg_size() for RTA_VIA nexthops
    
    commit 4ff9548d84945d2cbf9e4c207288063a200ea397 upstream.
    
    fib_nlmsg_size() still estimates nexthop space as if every gateway is
    encoded as an IPv4 RTA_GATEWAY attribute. IPv4 routes can also carry an
    IPv6 gateway, which fib_nexthop_info() dumps as RTA_VIA.
    
    As a result, route notifications can allocate an skb that is too small.
    fib_dump_info() then fails with -EMSGSIZE and rtmsg_fib() hits the
    WARN_ON() that marks such failures as a fib_nlmsg_size() bug. With
    panic_on_warn set, this becomes a kernel panic.
    
    Mirror the actual nexthop dump layout in fib_nlmsg_size(): account for
    IPv6 nexthop gateways dumped as RTA_VIA, for the no-header rtnexthop
    layout used inside RTA_MULTIPATH, and for RTA_FLOW only when it is
    actually present.
    
    Fixes: d15662682db2 ("ipv4: Allow ipv6 gateway with ipv4 routes")
    Cc: stable@vger.kernel.org
    Reported-by: Vega <vega@nebusec.ai>
    Signed-off-by: Zihan Xi <zihanx@nebusec.ai>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Link: https://patch.msgid.link/6f53fa797fcaeb26966432ed7ae9bb87c4961f37.1785411220.git.zihanx@nebusec.ai
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ipv4: fix use-after-free in fib_nhc_update_mtu() [+ + +]
Author: Chengfeng Ye <nicoyip.dev@gmail.com>
Date:   Sat Aug 8 02:17:10 2026 +0800

    ipv4: fix use-after-free in fib_nhc_update_mtu()
    
    commit bc5bde9ce3cc36502839dfe98e068f7303a50982 upstream.
    
    fib_nhc_update_mtu() walks the nexthop exception table under RTNL, but
    RTNL does not serialize this walk with PMTU exception updates. The walk
    uses rcu_dereference_protected() with a constant true condition without
    holding fnhe_lock.
    
    The following interleaving can therefore occur:
    
      CPU 0                              CPU 1
      fib_nhc_update_mtu()               update_or_create_fnhe()
        load fnhe                          spin_lock_bh(&fnhe_lock)
                                           fnhe_remove_oldest()
                                             unlink fnhe
                                             kfree_rcu(fnhe, rcu)
        <quiescent state>
        access fnhe after grace period
    
    KASAN reported:
    
      BUG: KASAN: slab-use-after-free in fib_nhc_update_mtu+0x3df/0x410
      Read of size 8 at addr ffff888107d49000 by task poc/90
      Call Trace:
       fib_nhc_update_mtu+0x3df/0x410
       fib_sync_mtu+0x7a/0xd0
       fib_netdev_event+0x229/0x3f0
       netif_set_mtu_ext+0x33a/0x570
       dev_set_mtu+0x88/0x120
    
    The same walk updates fnhe_pmtu and fnhe_mtu_locked. These fields form a
    pair and other writers serialize them with fnhe_lock. RCU alone prevents
    reclamation, but would still allow concurrent writers to leave a mixed
    pair.
    
    Walk the table under RCU and acquire fnhe_lock only while updating each
    exception. RCU keeps the current entry alive while the short critical
    section serializes its paired PMTU fields. This avoids holding the global
    lock while scanning all 2048 buckets for every nexthop.
    
    Fixes: af7d6cce5369 ("net: ipv4: update fnhe_pmtu when first hop's MTU changes")
    Cc: stable@vger.kernel.org
    Suggested-by: Ido Schimmel <idosch@nvidia.com>
    Signed-off-by: Chengfeng Ye <nicoyip.dev@gmail.com>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Link: https://patch.msgid.link/20260807181710.1178747-1-nicoyip.dev@gmail.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ipv6: fix Route Information option length validation [+ + +]
Author: Yuejie Shi <syjcnss@gmail.com>
Date:   Thu Jul 30 11:52:32 2026 +0800

    ipv6: fix Route Information option length validation
    
    commit d1ad8fb2ac6a1afb71dc22d9ae8efb4dda96c824 upstream.
    
    rt6_route_rcv() validates the Route Information option (RFC 4191) length
    against the prefix length, but both checks are off by one.
    
    rinfo->length is the ND option length in units of 8 octets and it
    *includes* the 8-byte option header, so an option carrying N bytes of
    prefix has length == 1 + N/8.  RFC 4191 section 2.3 requires length 3
    when Prefix Length is greater than 64, and 2 or 3 when it is greater
    than 0.  The code accepts length >= 2 and length >= 1 respectively.
    
    ipv6_addr_prefix() then copies prefix_len/8 bytes out of rinfo->prefix,
    so a Router Advertisement with (prefix_len=128, length=2) or
    (prefix_len=64, length=1) makes the kernel read up to 8 bytes past the
    end of the option.  Those bytes end up in the prefix of the route that
    gets installed, so they are visible to userspace:
    
      # RA with a Route Information option (prefix_len=128, length=2)
      # followed by a source link-layer address option, 01 01 de ad be ef ca fe
      $ ip -6 route show
      2001:db8:dead:beef:101:dead:beef:cafe via fe80::1234 dev veth0 proto ra
                         ^^^^^^^^^^^^^^^^^^ the next option, read out of bounds
    
    When the Route Information option is the last one in the packet, those
    eight bytes come from the skb tail room instead.
    
    Reject the option lengths RFC 4191 does not allow.
    
    Fixes: 70ceb4f53929 ("[IPV6]: ROUTE: Add experimental support for Route Information Option in RA (RFC4191).")
    Cc: stable@vger.kernel.org
    Signed-off-by: Yuejie Shi <syjcnss@gmail.com>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Link: https://patch.msgid.link/20260730035310.74584-1-syjcnss@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ipv6: prevent in6_dev_get() from resurrecting inet6_dev [+ + +]
Author: Kyle Zeng <kylebot@openai.com>
Date:   Mon Aug 3 12:27:57 2026 +0000

    ipv6: prevent in6_dev_get() from resurrecting inet6_dev
    
    commit 0e243671bc7b8eaf00f83dd2f4367436dc0cff98 upstream.
    
    in6_dev_get() reads dev->ip6_ptr under RCU and then unconditionally
    increments its refcount. Device teardown can clear the pointer and drop
    the last reference between these operations. The increment then
    resurrects an object whose RCU free has already been queued, so callers
    can use it after it is freed.
    
    Use refcount_inc_not_zero() and return NULL when the object has already
    reached zero. RCU keeps the memory accessible through the attempted
    reference acquisition, and a successful increment pins the object for
    the caller.
    
    An independent run on the exact unpatched 6f5156d7a31a (v7.2-rc3)
    kernel reproduced the invalid reference acquisition as UID 1000:
    
      refcount_t: addition on 0; use-after-free.
      ip6_mc_source+0xef4/0x17e0
    
    It was followed by the corresponding reference underflow in
    ip6_mc_source(). The supplied trace from the same unpatched revision
    additionally shows the access after the RCU read-side section ends:
    
      BUG: KASAN: slab-use-after-free in mutex_lock+0x76/0xe0
      Write of size 8 at addr ffff888015b50240 by task poc/1219
    
    Bug found and triaged by OpenAI Security Research and
    validated by Trail of Bits.
    
    Fixes: 8814c4b53381 ("[IPV6] ADDRCONF: Convert addrconf_lock to RCU.")
    Cc: stable@vger.kernel.org
    Signed-off-by: Kyle Zeng <kylebot@openai.com>
    Co-developed-by: David Lee <david.lee@trailofbits.com>
    Signed-off-by: David Lee <david.lee@trailofbits.com>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Link: https://patch.msgid.link/20260803122758.666112-1-david.lee@trailofbits.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ipvs: add totalconns for dest [+ + +]
Author: Julian Anastasov <ja@ssi.bg>
Date:   Fri Jul 31 22:27:41 2026 +0800

    ipvs: add totalconns for dest
    
    commit 04d2feaed8d0103c498727191ba04001d5100e67 upstream.
    
    Replace the inactconns dest counter with totalconns, now
    inactconns can be obtained from totalconns - activeconns.
    This reduces the atomic inc/dec ops for TCP/SCTP from
    6 to 4 if the connection is established and then closed.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable@vger.kernel.org
    Signed-off-by: Julian Anastasov <ja@ssi.bg>
    Signed-off-by: Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ipvs: avoid out-of-bounds write in ip_vs_nat_icmp [+ + +]
Author: Julian Anastasov <ja@ssi.bg>
Date:   Thu Jul 30 21:35:05 2026 +0300

    ipvs: avoid out-of-bounds write in ip_vs_nat_icmp
    
    [ Upstream commit 646922a0379496154e8c8faca4f8e2fd9100cacc ]
    
    Sashiko warns that local attacker can modify the packet
    while it is processed by IPVS. Some places read the
    IP ihl field multiple times which can cause out-of-bounds
    access. One such place is ip_vs_nat_icmp where we
    can write after the validated area.
    
    Fix it by providing ciph argument just like it is done for
    IPv6 and use ciph->len as offset to the embedded transport
    header.
    
    Modify some IPv4 header checks by reading the ihl field
    only once.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Link: https://sashiko.dev/#/patchset/20260722101517.36313-1-ja%40ssi.bg
    Signed-off-by: Julian Anastasov <ja@ssi.bg>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ipvs: clear IPv4 options after rebasing tunnel ICMP errors [+ + +]
Author: Kyle Zeng <kylebot@openai.com>
Date:   Tue Aug 4 06:10:55 2026 +0000

    ipvs: clear IPv4 options after rebasing tunnel ICMP errors
    
    commit e0ba936287dfe9783426aac27e5fd76fe35b38c9 upstream.
    
    ip_vs_in_icmp() rebases an skb from the outer ICMP packet to the
    quoted original request before passing it to icmp_send(). However,
    IPCB(skb)->opt still describes the outer IPv4 header.
    
    A timestamp option in the outer header can therefore leave an offset
    that points into the quoted transport header after the rebase.
    __ip_options_echo() treats a byte at that stale location as the option
    length and copies it into the fixed-size option storage on the
    __icmp_send() stack, causing a stack out-of-bounds write.
    
    Clear the stale option metadata after resetting the network header.
    Keep the remaining control block fields, including the ingress
    interface used by the ICMP response path.
    
    Fixes: f2edb9f7706d ("ipvs: implement passive PMTUD for IPIP packets")
    Cc: stable@vger.kernel.org
    Assisted-by: Codex:gpt-5.6-sol Codex:gpt-5.5-cyber
    Signed-off-by: Kyle Zeng <kylebot@openai.com>
    Co-developed-by: David Lee <david.lee@trailofbits.com>
    Signed-off-by: David Lee <david.lee@trailofbits.com>
    Acked-by: Julian Anastasov <ja@ssi.bg>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ipvs: properly update the overload flag on dest edit [+ + +]
Author: Julian Anastasov <ja@ssi.bg>
Date:   Fri Jul 31 22:27:42 2026 +0800

    ipvs: properly update the overload flag on dest edit
    
    commit 8f843441c4e7eae8ea83491e8c203c2b192edcf5 upstream.
    
    The upper/lower connection thresholds for dest can be changed,
    so use ip_vs_dest_update_overload() to properly update the
    dest overload flag.
    
    The thresholds were not limited, fit them in the 0 .. INT_MAX
    range as already done in ipvsadm.
    
    As the thresholds are also read when connections are created
    and expired, use WRITE_ONCE/READ_ONCE to access them.
    
    As the lower threshold is optional, use (u - (u >> 2)) to
    calculate the 75% default value based on the upper threshold
    by preserving the integer rounding, as suggested by Yizhou Zhao.
    
    Trigger flag update when totalconns reaches one of the
    thresholds and use dst_lock to serialize the updating.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable@vger.kernel.org
    Signed-off-by: Julian Anastasov <ja@ssi.bg>
    Signed-off-by: Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ipvs: return the csum validation for forward hook [+ + +]
Author: Julian Anastasov <ja@ssi.bg>
Date:   Thu Jul 30 21:35:06 2026 +0300

    ipvs: return the csum validation for forward hook
    
    [ Upstream commit 99609cb0aa789c8d071050ce8579989551882cc6 ]
    
    Sashiko notes that playing games with the skb dst and rt
    flags instead of providing hooknum is not a good idea
    when validating the checksums.
    
    Also, skipping checksum validation for FORWARD packets
    risk silent data corruption, even if the only user is
    the FTP-CMD packets coming from the real server.
    
    Sashiko also noticed that by using common checksum
    helper in the previous commit we actually fixed old bug
    where the TCP/UDP checksum for IPv6 on CHECKSUM_COMPLETE
    was not validated correctly.
    
    Fixes: e876b75b9020 ("ipvs: fix the checksum validations")
    Link: https://sashiko.dev/#/patchset/20260722211420.153933-1-pablo%40netfilter.org
    Link: https://sashiko.dev/#/patchset/20260727185024.67534-1-ja%40ssi.bg
    Link: https://sashiko.dev/#/patchset/20260728202520.59179-1-ja%40ssi.bg
    Signed-off-by: Julian Anastasov <ja@ssi.bg>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ipvs: stop estimator after disabled calc phase [+ + +]
Author: Zhiling Zou <zhilinz@nebusec.ai>
Date:   Wed Jul 29 21:56:59 2026 +0800

    ipvs: stop estimator after disabled calc phase
    
    commit 558f67f1340f803a346ecd14a69c49653111c5f4 upstream.
    
    IPVS estimator kthread 0 starts with zeroed chain and tick limits until
    its initial calculation phase completes. If network namespace teardown
    clears ipvs->enable during that phase, ip_vs_est_calc_phase() can return
    without installing positive limits.
    
    The kthread can then continue into its main loop and drain
    est_temp_list with zero chain_max, tick_max and est_max_count values.
    Each enqueue consumes one available tick row, but est_count never
    reaches the zero est_max_count value. After all rows are consumed, the
    row lookup returns IPVS_EST_NTICKS and ip_vs_enqueue_estimator() writes
    past the ticks and tick_len arrays.
    
    Exit kthread 0 after the calculation phase if the kthread is stopping or
    IPVS has been disabled. That keeps temporary estimators from being
    drained after the limits failed to initialize.
    
    Estimator kthreads can now self-exit before teardown or reload stops
    kd->task. Keep an extra task reference after creation and release it
    with kthread_stop_put(), so kd->task remains valid until the stop paths
    consume that reference.
    
    Fixes: 705dd3444081 ("ipvs: use kthreads for stats estimation")
    Cc: stable@vger.kernel.org
    Reported-by: Vega <vega@nebusec.ai>
    Signed-off-by: Zhiling Zou <zhilinz@nebusec.ai>
    Acked-by: Julian Anastasov <ja@ssi.bg>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
kunit/fortify: Add back "volatile" for sizeof() constants [+ + +]
Author: Kees Cook <kees@kernel.org>
Date:   Thu Aug 13 22:12:54 2026 -0700

    kunit/fortify: Add back "volatile" for sizeof() constants
    
    commit 10299c07c94aa0997fa43523b53301e713a6415d upstream.
    
    It seems the Clang can see through OPTIMIZER_HIDE_VAR when the constant
    is coming from sizeof. Adding "volatile" back to these variables solves
    this false positive without reintroducing the issues that originally led
    to switching to OPTIMIZER_HIDE_VAR in the first place[1].
    
    Reported-by: Nathan Chancellor <nathan@kernel.org>
    Closes: https://github.com/ClangBuiltLinux/linux/issues/2075 [1]
    Cc: Jannik Glückert <jannik.glueckert@gmail.com>
    Suggested-by: Nathan Chancellor <nathan@kernel.org>
    Fixes: 6ee149f61bcc ("kunit/fortify: Replace "volatile" with OPTIMIZER_HIDE_VAR()")
    Reviewed-by: Nathan Chancellor <nathan@kernel.org>
    Link: https://lore.kernel.org/r/20250628234034.work.800-kees@kernel.org
    Signed-off-by: Kees Cook <kees@kernel.org>
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

kunit/fortify: Replace "volatile" with OPTIMIZER_HIDE_VAR() [+ + +]
Author: Kees Cook <kees@kernel.org>
Date:   Thu Aug 13 22:12:53 2026 -0700

    kunit/fortify: Replace "volatile" with OPTIMIZER_HIDE_VAR()
    
    commit 6ee149f61bcce39692f0335a01e99355d4cec8da upstream.
    
    It does seem that using "volatile" isn't going to be sane compared to
    using OPTIMIZER_HIDE_VAR() going forward. Some strange interactions[1]
    with the sanitizers have been observed in the self-test code, so replace
    the logic.
    
    Reported-by: Nathan Chancellor <nathan@kernel.org>
    Closes: https://github.com/ClangBuiltLinux/linux/issues/2075 [1]
    Link: https://lore.kernel.org/r/20250312000439.work.112-kees@kernel.org
    Signed-off-by: Kees Cook <kees@kernel.org>
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
KVM: s390: pci: Fix aisb calculation [+ + +]
Author: Matthew Rosato <mjrosato@linux.ibm.com>
Date:   Wed Aug 12 13:40:43 2026 -0700

    KVM: s390: pci: Fix aisb calculation
    
    [ Upstream commit 0cfe660559e857d7c00ab86c73e4510ce069086f ]
    
    The current implementation of aisb calculation will erroneously index
    via an unsigned long * as well as multiply by 8B for every 64-bits in
    the offset; only one or the other is required.  This throws off aisb
    calculations once the number of devices exceeds 64, and can result
    in out-of-bounds access as well as failure to indicate summary bits
    associated with those devices in guests.
    
    Fix this by converting to a physical address before applying the
    offset, as is already done in arch/s390/pci/pci_irq.c.
    
    Fixes: 3c5a1b6f0a18 ("KVM: s390: pci: provide routines for enabling/disabling interrupt forwarding")
    Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
    Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com>
    Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
    [alifm@linux.ibm.com: Resolved merge conflict]
    Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

KVM: s390: pci: Fix memory accounting for pinned/unpinned pages [+ + +]
Author: Farhan Ali <alifm@linux.ibm.com>
Date:   Wed Aug 12 13:40:40 2026 -0700

    KVM: s390: pci: Fix memory accounting for pinned/unpinned pages
    
    [ Upstream commit 36f6999ecde3976731a8bfc0b8e667da6f593069 ]
    
    The account_mem() and unaccount_mem() functions call get_uid() which
    increments the reference count of struct user_struct on every invocation.
    But we don't decrement the count by calling free_uid(). It also
    accounted/unaccounted the pages against the current->mm. But its possible
    the unaccount_mem() can be called from a different process context than the
    one that originally pinned the pages.
    
    Let's fix this by storing the pinning process user_struct and mm_struct
    when accounting for pinned pages, and subsequently free these resources
    when the pages are unpinned.
    
    Fixes: 3c5a1b6f0a18 ("KVM: s390: pci: provide routines for enabling/disabling interrupt forwarding")
    Cc: stable@vger.kernel.org
    Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
    Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
    Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
    Tested-by: Matthew Rosato <mjrosato@linux.ibm.com>
    [borntraeger@linux.ibm.com: Fixed whitespace]
    Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
    [alifm@linux.ibm.com: Resolve merge conflict]
    Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

KVM: s390: pci: Fix missing error codes and memory unaccounting [+ + +]
Author: Farhan Ali <alifm@linux.ibm.com>
Date:   Wed Aug 12 13:40:41 2026 -0700

    KVM: s390: pci: Fix missing error codes and memory unaccounting
    
    [ Upstream commit f86842e4d6c482300f4567f492d512c9ccf5bc4f ]
    
    In kvm_s390_pci_aif_enable() two error paths failed to set an error code,
    causing the function to return 0 on failure. It also failed to rollback
    memory accounting on failure. Fix both by propagating an error code on
    failure and calling unaccount_mem() in the cleanup path.
    
    Fixes: 3c5a1b6f0a18 ("KVM: s390: pci: provide routines for enabling/disabling interrupt forwarding")
    Cc: stable@vger.kernel.org
    Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
    Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
    Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
    Tested-by: Matthew Rosato <mjrosato@linux.ibm.com>
    Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
    [alifm@linux.ibm.com: Resolve merge conflict]
    Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

KVM: s390: pci: Fix resource leak on IRQ registration failure [+ + +]
Author: Farhan Ali <alifm@linux.ibm.com>
Date:   Wed Aug 12 13:40:42 2026 -0700

    KVM: s390: pci: Fix resource leak on IRQ registration failure
    
    [ Upstream commit 5580c9858f1e00f60191eb09c3add359836d60b6 ]
    
    Currently if kvm_zpci_set_airq() fails, kvm_s390_pci_aif_enable() returns
    the error code but doesn't do any resource cleanup thus leaking resources.
    Fix this by cleaning up all the resources such as the GAITE, AIBV, AISB and
    unpinning any pinned pages. While at it, remove dead code that stored FIB
    values that were never referenced.
    
    As part of the cleanup, we are also holding the aift_lock a bit longer, as
    we hold the lock while executing the MPCIFC instruction. Though this is not
    strictly necessary, it means we don't have to drop and re-acquire in the
    error case.
    
    Fixes: 3c5a1b6f0a18 ("KVM: s390: pci: provide routines for enabling/disabling interrupt forwarding")
    Cc: stable@vger.kernel.org
    Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
    Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
    Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
    Tested-by: Matthew Rosato <mjrosato@linux.ibm.com>
    Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
    [alifm@linux.ibm.com: Resolved merge conflict]
    Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

KVM: SVM: Add support to initialize SEV/SNP functionality in KVM [+ + +]
Author: Ashish Kalra <ashish.kalra@amd.com>
Date:   Fri Aug 14 12:02:55 2026 +0200

    KVM: SVM: Add support to initialize SEV/SNP functionality in KVM
    
    commit 6f1d5a3513c2370bbd6115dd430906bc2f4bdc53 upstream.
    
    Move platform initialization of SEV/SNP from CCP driver probe time to
    KVM module load time so that KVM can do SEV/SNP platform initialization
    explicitly if it actually wants to use SEV/SNP functionality.
    
    Add support for KVM to explicitly call into the CCP driver at load time
    to initialize SEV/SNP. If required, this behavior can be altered with KVM
    module parameters to not do SEV/SNP platform initialization at module load
    time. Additionally, a corresponding SEV/SNP platform shutdown is invoked
    during KVM module unload time.
    
    Continue to support SEV deferred initialization as the user may have the
    file containing SEV persistent data for SEV INIT_EX available only later
    after module load/init.
    
    Suggested-by: Sean Christopherson <seanjc@google.com>
    Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
    Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Jack Wang <jinpu.wang@cloud.ionos.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

KVM: x86/mmu: WARN and clear role.invalid when creating a child shadow page [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Mon Jul 13 08:25:49 2026 -0700

    KVM: x86/mmu: WARN and clear role.invalid when creating a child shadow page
    
    commit 5ec42d57655c690234c14aece6dd3f209778c1d8 upstream.
    
    Explicitly clear role.invalid when deriving a child shadow page's role from
    its parent to harden against bugs elsewhere in KVM, as violating KVM's
    invariant that invalid pages are NOT on the list of active MMU pages leads
    to use-after-free due to __kvm_mmu_prepare_zap_page() using list_add()
    instead of list_move() when processing an invalid shadow page, i.e. makes a
    bad situation far worse.
    
    Yell loudly if the parent is invalid, as it means KVM has missed a validity
    check, i.e. KVM is attempting to map memory using an invalid/obsolete root,
    but continue on as the child is otherwise still a valid shadow page.
    
      ==================================================================
      BUG: KASAN: slab-use-after-free in __kvm_mmu_get_shadow_page+0x1817/0x1860 [kvm]
      Write of size 8 at addr ff11000153dd1368 by task repro/853
    
      CPU: 1 UID: 1000 PID: 853 Comm: repro Not tainted 7.2.0-rc2-3aec122bdcaf-next-vm #5 PREEMPT
      Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
      Call Trace:
       <TASK>
       dump_stack_lvl+0x4b/0x70
       print_report+0x153/0x49c
       kasan_report+0xbc/0xf0
       __kvm_mmu_get_shadow_page+0x1817/0x1860 [kvm]
       mmu_alloc_root+0x141/0x320 [kvm]
       kvm_mmu_load+0x612/0x20f0 [kvm]
       kvm_arch_vcpu_ioctl_run+0x3dd5/0x6150 [kvm]
       kvm_vcpu_ioctl+0x5e4/0x10d0 [kvm]
       __x64_sys_ioctl+0x131/0x1b0
       do_syscall_64+0x67/0x5f0
       entry_SYSCALL_64_after_hwframe+0x4b/0x53
       </TASK>
    
      Allocated by task 853:
       kasan_save_stack+0x20/0x40
       kasan_save_track+0x14/0x30
       __kasan_slab_alloc+0x5f/0x70
       kmem_cache_alloc_noprof+0xfe/0x2e0
       __kvm_mmu_topup_memory_cache+0x135/0x530 [kvm]
       paging64_page_fault+0x318/0x1e30 [kvm]
       kvm_mmu_do_page_fault+0x21d/0x630 [kvm]
       kvm_mmu_page_fault+0x18c/0x17b0 [kvm]
       kvm_arch_vcpu_ioctl_run+0x1f35/0x6150 [kvm]
       kvm_vcpu_ioctl+0x5e4/0x10d0 [kvm]
       __x64_sys_ioctl+0x131/0x1b0
       do_syscall_64+0x67/0x5f0
       entry_SYSCALL_64_after_hwframe+0x4b/0x53
    
      Freed by task 853:
       kasan_save_stack+0x20/0x40
       kasan_save_track+0x14/0x30
       kasan_save_free_info+0x3b/0x60
       __kasan_slab_free+0x43/0x70
       kmem_cache_free+0xe2/0x400
       kvm_mmu_commit_zap_page.part.0+0x1e2/0x310 [kvm]
       kvm_mmu_free_roots+0x283/0x560 [kvm]
       kvm_arch_vcpu_ioctl_run+0x33c8/0x6150 [kvm]
       kvm_vcpu_ioctl+0x5e4/0x10d0 [kvm]
       __x64_sys_ioctl+0x131/0x1b0
       do_syscall_64+0x67/0x5f0
       entry_SYSCALL_64_after_hwframe+0x4b/0x53
    
    Reported-by: Hyunwoo Kim <imv4bel@gmail.com>
    Fixes: a770f6f28b1a ("KVM: MMU: Inherit a shadow page's guest level count from vcpu setup")
    Cc: stable@vger.kernel.org
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Linux: Linux 6.12.104 [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Wed Aug 19 18:14:32 2026 +0200

    Linux 6.12.104
    
    Link: https://lore.kernel.org/r/20260817132535.394764707@linuxfoundation.org
    Tested-by: Pavel Machek (CIP) <pavel@nabladev.com>
    Tested-by: Salvatore Bonaccorso <carnil@debian.org>
    Tested-by: Peter Schneider <pschneider1968@googlemail.com>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
    Tested-by: Francesco Dolcini <francesco.dolcini@toradex.com>
    Tested-by: Ron Economos <re@w6rz.net>
    Tested-by: Brett A C Sheffield <bacs@librecast.net>
    Tested-by: Mark Brown <broonie@kernel.org>
    Tested-by: Shuah Khan <skhan@linuxfoundation.org>
    Tested-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mac802154: fix netdev use-after-free in beacon worker [+ + +]
Author: Zihan Xi <zihanx@nebusec.ai>
Date:   Sun Aug 2 09:23:34 2026 +0000

    mac802154: fix netdev use-after-free in beacon worker
    
    commit 5f26a690e8efa54315e4922368daf54e0b8f5515 upstream.
    
    mac802154_beacon_worker() reads local->beacon_req under RCU and derives
    the sub-interface from the request, but then drops the RCU read lock and
    continues to use both sdata and the embedded wpan_dev.
    
    mac802154_stop_beacons_locked() cancels only pending beacon work, clears
    local->beacon_req and frees the request.  A beacon worker that is already
    running can therefore continue after interface teardown and dereference
    the freed netdev private area.
    
    The scan worker already pins the netdev before leaving RCU.  Apply the
    same lifetime rule to the beacon worker: take a netdev reference while
    the request is still protected by RCU, and release it on all paths that
    continue after the reference is acquired.
    
    Fixes: 3accf4762734 ("mac802154: Handle basic beaconing")
    Cc: stable@vger.kernel.org
    Reported-by: Vega <vega@nebusec.ai>
    Signed-off-by: Zihan Xi <zihanx@nebusec.ai>
    Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://patch.msgid.link/e9a3909c7a6281967961773ca841e860b8ecf40e.1785596603.git.zihanx@nebusec.ai
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mei: pull kvfree out of spinlock [+ + +]
Author: Alexander Usyskin <alexander.usyskin@intel.com>
Date:   Sun Jul 19 12:57:55 2026 +0300

    mei: pull kvfree out of spinlock
    
    commit b0495bb58af06a7de4628c72d500e3d5e180d808 upstream.
    
    The read buffer allocation was changed from kmalloc() to kvmalloc().
    
    This buffer is part of mei_cl_cb structure that can be queued in
    rd_complete queue protected by spinlock.
    Releasing the structure leads to errors like below when freeing buffer
    that allocated non-contiguous:
    
    BUG: sleeping function called from invalid context at mm/vmalloc.c:3448
    
    Separate mei_cl_cb structure dequeue and release to
    perform only dequeue under spinlock and push release out of spinlock.
    
    Cc: stable <stable@kernel.org>
    Fixes: 4adf613e01bf ("mei: use kvmalloc for read buffer")
    Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/work_items/16359
    Reviewed-by: Menachem Adin <menachem.adin@intel.com>
    Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
    Link: https://patch.msgid.link/20260719-kvfree_out_of_spinlock-v1-1-e07d6333bea7@intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
misc: fastrpc: fix channel ctx ref leak when session alloc fails [+ + +]
Author: Anandu Krishnan E <anandu.e@oss.qualcomm.com>
Date:   Fri Jul 24 23:33:40 2026 +0100

    misc: fastrpc: fix channel ctx ref leak when session alloc fails
    
    commit 310f7868399668c6d99d88acc9c4cf3462e69d5b upstream.
    
    fastrpc_channel_ctx_get() is called in fastrpc_device_open() before
    fastrpc_session_alloc(). If session alloc fails, the error path
    returns -EBUSY without calling fastrpc_channel_ctx_put(), leaking
    the reference. Fix by adding the missing put.
    
    Fixes: 278d56f970ae ("misc: fastrpc: Reference count channel context")
    Cc: stable@kernel.org
    Signed-off-by: Anandu Krishnan E <anandu.e@oss.qualcomm.com>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
    Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
    Link: https://patch.msgid.link/20260724223342.629168-5-srini@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

misc: fastrpc: fix memory leak in fastrpc_channel_ctx_free [+ + +]
Author: Eddie Lin <eddie.lin@oss.qualcomm.com>
Date:   Fri Jul 24 23:33:41 2026 +0100

    misc: fastrpc: fix memory leak in fastrpc_channel_ctx_free
    
    commit 2fae94ee14f7fea11d3f95e10383a87c01d21518 upstream.
    
    The 'ctx_idr' is initialized but never destroyed when
    the channel context is freed, leading to a memory leak.
    Add idr_destroy() to properly clean up the IDR resources.
    
    Fixes: f6f9279f2bf0 ("misc: fastrpc: Add Qualcomm fastrpc basic driver model")
    Cc: stable@vger.kernel.org
    Signed-off-by: Eddie Lin <eddie.lin@oss.qualcomm.com>
    Reviewed-by: Ekansh Gupta <ekansh.gupta@oss.qualcomm.com>
    Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
    Link: https://patch.msgid.link/20260724223342.629168-6-srini@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

misc: fastrpc: Remove buffer from list prior to unmap operation [+ + +]
Author: Ekansh Gupta <ekansh.gupta@oss.qualcomm.com>
Date:   Fri Jul 24 23:33:38 2026 +0100

    misc: fastrpc: Remove buffer from list prior to unmap operation
    
    commit 6102ceb4eab845743ee57acd3863fbd06e93c927 upstream.
    
    fastrpc_req_munmap_impl() is called to unmap any buffer. The buffer is
    getting removed from the list after it is unmapped from DSP. This can
    create potential race conditions if multiple threads invoke unmap
    concurrently, where one thread may remove the entry from the list while
    another thread's unmap operation is still ongoing.
    
    Fix this by removing the buffer entry from the list before calling the
    unmap operation. If the unmap fails, the entry is re-added to the list
    so that userspace can retry the unmap, or alternatively, the buffer
    will be cleaned up during device release when the DSP process is torn
    down and all DSP-side mappings are freed along with remaining buffers
    in the list.
    
    Fixes: 2419e55e532de ("misc: fastrpc: add mmap/unmap support")
    Cc: stable@kernel.org
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
    Signed-off-by: Ekansh Gupta <ekansh.gupta@oss.qualcomm.com>
    Signed-off-by: Jianping Li <jianping.li@oss.qualcomm.com>
    Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
    Link: https://patch.msgid.link/20260724223342.629168-3-srini@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

misc: fastrpc: take fl->lock when moving mmaps on interrupted invoke [+ + +]
Author: Junrui Luo <moonafterrain@outlook.com>
Date:   Fri Jul 24 23:33:39 2026 +0100

    misc: fastrpc: take fl->lock when moving mmaps on interrupted invoke
    
    commit b85a0e91d7d6cd06a53c881a46f749cfcef416a2 upstream.
    
    When an invoke is interrupted by a signal,
    wait_for_completion_interruptible() returns -ERESTARTSYS and
    fastrpc_internal_invoke() moves every buffer from fl->mmaps onto
    cctx->invoke_interrupted_mmaps. This list_del()/list_add_tail() walk
    runs without holding fl->lock, the lock that serialises fl->mmaps in
    fastrpc_req_mmap() and fastrpc_req_munmap() everywhere else.
    
    Take fl->lock around the move, matching every other fl->mmaps accessor.
    
    Fixes: 76e8e4ace1ed ("misc: fastrpc: Safekeep mmaps on interrupted invoke")
    Reported-by: Yuhao Jiang <danisjiang@gmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Junrui Luo <moonafterrain@outlook.com>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
    Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
    Link: https://patch.msgid.link/20260724223342.629168-4-srini@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/huge_memory: fix huge_zero_pfn race [+ + +]
Author: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Date:   Thu Jul 30 11:55:47 2026 +0100

    mm/huge_memory: fix huge_zero_pfn race
    
    commit 33192a26cddea7a7e4ca66e5c3eebd36fa8be2bb upstream.
    
    Patch series "mm/huge_memory: fix huge_zero_pfn race", v2.
    
    There is a subtle race in the reference-counted huge_zero_folio
    implementation.
    
    The fast path atomic logic fails to account for the fact that the shrinker
    (which drops the final huge_zero_refcount pin) can overwrite huge_zero_pfn
    with the ~0UL sentinel value in shrink_huge_zero_folio_scan() after a
    racing get_huge_zero_folio() installed a valid value there.
    
    This results in huge_zero_folio being correctly set but huge_zero_pfn
    being set incorrectly and thus is_huge_zero_pfn() and consequently
    is_huge_zero_pmd() will misidentify the huge zero folio as being an
    ordinary THP folio.
    
    This can result in the huge zero folio being split and otherwise treated
    incorrectly.
    
    The solution to this is very subtle as there is an atomic fast path, and
    thus ordering in weakly ordered architectures has to be treated very
    carefully.
    
    The first commit fixes the issue by introducing a spinlock around
    huge_zero_[pfn, folio, refcount] write, with careful consideration paid to
    load/store ordering in the fast path.  It is placed first and kept as
    small as possible so that it can be backported on its own.
    
    The second commit is a pure cleanup which reworks the
    CONFIG_PERSISTENT_HUGE_ZERO_FOLIO logic to better separate the persistent
    logic from the dynamically allocated one.
    
    
    This patch (of 2):
    
    If !CONFIG_PERSISTENT_HUGE_ZERO_FOLIO, the huge_zero_folio is refcounted
    by huge_zero_refcount and returned by mm_get_huge_zero_folio().
    
    When the caller is done with the huge zero page, its reference count is
    decremented.  Only a shrinker can set the reference count to zero.
    
    A race can unfortunately occur between a shrinker decrementing the
    reference count to zero and a concurrent page fault.
    
    This is because shrink_huge_zero_folio_scan() might, if very unlucky, be
    preempted between setting huge_zero_refcount to zero and writing an
    invalid value.
    
    During this time get_huge_zero_folio() could write to huge_zero_pfn before
    shrink_huge_zero_folio_scan() resumes.
    
    In this event the huge zero folio will be persistently misidentified
    causing the THP code path to be entered inappropriately for the huge zero
    folio:
    
                    CPU 0                                   CPU 1
    =======================================|=================================
    shrink_huge_zero_folio_scan()          |
       atomic_cmpxchg() sets refcount to 0 |
       xchg() sets huge_zero_folio to NULL | get_huge_zero_folio()
                     |                     |    atomic_inc_not_zero() -> zero
          preempted for a long time        |    Allocate new huge zero folio
                     |                     |    Write valid huge_zero_folio
                     v                     |    Write valid huge_zero_pfn
      Overwrite huge_zero_pfn with ~0UL   <--- Invalid overwrite!
    
    This results in is_huge_zero_pfn() and is_huge_zero_pmd() incorrectly
    returning false for a huge zero page which could result in issues like the
    huge zero folio being incorrectly split.
    
    Note that the issue is with huge_zero_pfn not huge_zero_folio, as
    get_huge_zero_folio() uses cmpxchg() gated on huge_zero_folio being NULL
    with a retry loop and shrink_huge_zero_folio_scan() uses xchg() to set
    huge_zero_folio.
    
    Fix the issue by introducing a spinlock, huge_zero_lock, to prevent
    concurrent write of huge_zero_folio, huge_zero_pfn and huge_zero_refcount.
    
    There needs to be significant care taken here to ensure correctness:
    
    The fast path in get_huge_zero_folio() uses atomic_inc_not_zero(), which
    is outside of the critical section, and means huge zero allocation is
    gated on zero huge_zero_refcount.
    
    The fast path doesn't use huge_zero_lock, so the critical section is
    irrelevant to it.
    
    So invariants are required - huge_zero_refcount MUST:
    
    * Only be set in the huge_zero_lock critical section to ensure
      serialisation of huge_zero_pfn, huge_zero_folio and huge_zero_refcount
      writes.
    
    * Be set non-zero only AFTER huge_zero_[pfn, folio] are set to valid values
      so installation of the huge zero folio on read page fault ensures
      concurrent is_huge_zero_*() calls correctly identify the huge zero folio.
    
    * Be set zero only BEFORE huge_zero_[pfn, folio] are set to NULL and ~0UL
      respectively, and atomically.
    
    Establish these by:
    
    * Only setting huge_zero_refcount to zero or an absolute value in the
      huge_zero_lock critical section in get_huge_zero_folio() and
      shrink_huge_zero_folio_scan(), and always updating atomically there
      and elsewhere.
    
    * Using atomic_set_release(&huge_zero_refcount) in get_huge_zero_folio()
      after huge_zero_[pfn, folio] are set. This is paired with
      atomic_inc_not_zero() to ensure atomic_inc_not_zero() only observes a
      non-zero value if huge_zero_[pfn, folio] are set.
    
    * Using atomic_cmpxchg() in shrink_huge_zero_folio_scan() (as before) to
      ensure that it is set zero only when equal to 1 and set atomically.
    
    * atomic_cmpxchg() being fully ordered ensures this is done prior to
      huge_zero_[folio, pfn] being set to NULL and ~0UL respectively.
    
    Eliminate the retry loop in get_huge_zero_folio() as the atomic_cmpxchg()
    in shrink_huge_zero_folio_scan() is now performed under the lock, and
    replace with an equally locked atomic_inc() to set the reference count
    should the caller be raced on huge zero folio installation.
    
    folio_put() naturally implies a full memory barrier so its ordering is
    maintained correctly.
    
    The huge zero folio also cannot be released except when the shrinker does
    so as it is non-LRU and non-rmappable.
    
    Note that only the huge zero shrinker (via shrink_huge_zero_folio_scan())
    can actually set huge_zero_refcount to zero, which is the count of mm's
    which have at least one huge zero folio installed plus one shrinker pin.
    
    Additionally convert a BUG_ON() to a VM_WARN_ON_ONCE().
    
    Link: https://lore.kernel.org/20260730-fix-refcounted-huge-zero-v2-0-c5d8a41b317f@kernel.org
    Link: https://lore.kernel.org/20260730-fix-refcounted-huge-zero-v2-1-c5d8a41b317f@kernel.org
    Fixes: 3b77e8c8cde5 ("mm/thp: make is_huge_zero_pmd() safe and quicker")
    Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
    Reported-by: Hengbin Zhang <uqbarz@gmail.com>
    Closes: https://lore.kernel.org/linux-mm/20260727154001.4102341-1-uqbarz@gmail.com/
    Suggested-by: David Hildenbrand (Arm) <david@kernel.org>
    Acked-by: David Hildenbrand (Arm) <david@kernel.org>
    Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
    Cc: Barry Song <baohua@kernel.org>
    Cc: Dev Jain <dev.jain@arm.com>
    Cc: Hannes Reinecke <hare@suse.de>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Kiryl Shutsemau <kas@kernel.org>
    Cc: Lance Yang <lance.yang@linux.dev>
    Cc: Liam R. Howlett <liam@infradead.org>
    Cc: Nico Pache <npache@redhat.com>
    Cc: Pankaj Raghav <p.raghav@samsung.com>
    Cc: Ryan Roberts <ryan.roberts@arm.com>
    Cc: Yang Shi <shy828301@gmail.com>
    Cc: Zi Yan <ziy@nvidia.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/vmscan: wake up flushers conditionally to avoid cgroup OOM [+ + +]
Author: Zeng Jingxiang <linuszeng@tencent.com>
Date:   Sat Oct 26 19:57:14 2024 +0800

    mm/vmscan: wake up flushers conditionally to avoid cgroup OOM
    
    [ Upstream commit 1bc542c6a0d1444559ab75823a89a94d244bf933 ]
    
    Commit 14aa8b2d5c2e ("mm/mglru: don't sync disk for each aging cycle")
    removed the opportunity to wake up flushers during the MGLRU page
    reclamation process can lead to an increased likelihood of triggering OOM
    when encountering many dirty pages during reclamation on MGLRU.
    
    This leads to premature OOM if there are too many dirty pages in cgroup:
    Killed
    
    dd invoked oom-killer: gfp_mask=0x101cca(GFP_HIGHUSER_MOVABLE|__GFP_WRITE),
    order=0, oom_score_adj=0
    
    Call Trace:
      <TASK>
      dump_stack_lvl+0x5f/0x80
      dump_stack+0x14/0x20
      dump_header+0x46/0x1b0
      oom_kill_process+0x104/0x220
      out_of_memory+0x112/0x5a0
      mem_cgroup_out_of_memory+0x13b/0x150
      try_charge_memcg+0x44f/0x5c0
      charge_memcg+0x34/0x50
      __mem_cgroup_charge+0x31/0x90
      filemap_add_folio+0x4b/0xf0
      __filemap_get_folio+0x1a4/0x5b0
      ? srso_return_thunk+0x5/0x5f
      ? __block_commit_write+0x82/0xb0
      ext4_da_write_begin+0xe5/0x270
      generic_perform_write+0x134/0x2b0
      ext4_buffered_write_iter+0x57/0xd0
      ext4_file_write_iter+0x76/0x7d0
      ? selinux_file_permission+0x119/0x150
      ? srso_return_thunk+0x5/0x5f
      ? srso_return_thunk+0x5/0x5f
      vfs_write+0x30c/0x440
      ksys_write+0x65/0xe0
      __x64_sys_write+0x1e/0x30
      x64_sys_call+0x11c2/0x1d50
      do_syscall_64+0x47/0x110
      entry_SYSCALL_64_after_hwframe+0x76/0x7e
    
     memory: usage 308224kB, limit 308224kB, failcnt 2589
     swap: usage 0kB, limit 9007199254740988kB, failcnt 0
    
      ...
      file_dirty 303247360
      file_writeback 0
      ...
    
    oom-kill:constraint=CONSTRAINT_MEMCG,nodemask=(null),cpuset=test,
    mems_allowed=0,oom_memcg=/test,task_memcg=/test,task=dd,pid=4404,uid=0
    Memory cgroup out of memory: Killed process 4404 (dd) total-vm:10512kB,
    anon-rss:1152kB, file-rss:1824kB, shmem-rss:0kB, UID:0 pgtables:76kB
    oom_score_adj:0
    
    The flusher wake up was removed to decrease SSD wearing, but if we are
    seeing all dirty folios at the tail of an LRU, not waking up the flusher
    could lead to thrashing easily.  So wake it up when a memcg is about to
    OOM due to dirty caches.
    
    I did run the build kernel test[1] on V6, with -j16 1G memcg on my local
    branch:
    
    Without the patch(10 times):
    user 1449.394
    system 368.78 372.58 363.03 362.31 360.84 372.70 368.72 364.94 373.51
    366.58 (avg 367.399)
    real 164.883
    
    With the V6 patch(10 times):
    user 1447.525
    system 360.87 360.63 372.39 364.09 368.49 365.15 359.93 362.04 359.72
    354.60 (avg 362.79)
    real 164.514
    
    Test results show that this patch has about 1% performance improvement,
    which should be caused by noise.
    
    Link: https://lkml.kernel.org/r/20241026115714.1437435-1-jingxiangzeng.cas@gmail.com
    Link: https://lore.kernel.org/all/CACePvbV4L-gRN9UKKuUnksfVJjOTq_5Sti2-e=pb_w51kucLKQ@mail.gmail.com/ [1]
    Fixes: 14aa8b2d5c2e ("mm/mglru: don't sync disk for each aging cycle")
    Suggested-by: Wei Xu <weixugc@google.com>
    Signed-off-by: Zeng Jingxiang <linuszeng@tencent.com>
    Signed-off-by: Kairui Song <kasong@tencent.com>
    Reviewed-by: Wei Xu <weixugc@google.com>
    Tested-by: Chris Li <chrisl@kernel.org>
    Cc: T.J. Mercier <tjmercier@google.com>
    Cc: Yu Zhao <yuzhao@google.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
mount: honour SB_NOUSER in the new mount API [+ + +]
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Fri Aug 7 13:38:27 2026 +0300

    mount: honour SB_NOUSER in the new mount API
    
    [ Upstream commit 6dd3c6884cd9defb511284b566cef5ac8f657dbf ]
    
    One should *not* be allowed to mount one of those, new API or not.
    
    Reported-by: Denis Arefev <arefev@swemel.ru>
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
    Link: https://patch.msgid.link/20260602020444.GP2636677@ZenIV
    Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
    [Denis: rename new_mnt -> newmount.mnt]
    [Denis: use goto err_unlock instead of direct return]
    Signed-off-by: Denis Arefev <arefev@swemel.ru>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
 
mtd: spinand: fix direct mapping creation sizes [+ + +]
Author: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Date:   Tue Aug 11 18:13:36 2026 +0200

    mtd: spinand: fix direct mapping creation sizes
    
    [ Upstream commit e4a0cf9f1d90e6888e5373da3314f761024f6c97 ]
    
    Continuous mode is only supported for data reads, thus writing
    requires only single flash page mapping.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mtd: spinand: repeat reading in regular mode if continuous reading fails [+ + +]
Author: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Date:   Tue Aug 11 18:13:38 2026 +0200

    mtd: spinand: repeat reading in regular mode if continuous reading fails
    
    [ Upstream commit 010dc7f2dd6a0078ade3f88f627ed5fbf45ceb94 ]
    
    Continuous reading may result in multiple flash pages reading in one
    operation. Unfortunately, not all spinand controllers support such
    large reading. They will read less data. Unfortunately, the operation
    can't be continued.
    
    In this case:
     * disable continuous reading on this (not good enough) spi controller
     * repeat reading in regular mode.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mtd: spinand: try a regular dirmap if creating a dirmap for continuous reading fails [+ + +]
Author: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Date:   Tue Aug 11 18:13:37 2026 +0200

    mtd: spinand: try a regular dirmap if creating a dirmap for continuous reading fails
    
    [ Upstream commit 004f8ea0d9917398aabff7388b3bf62a84a4088b ]
    
    Continuous reading may result in multiple flash pages reading in one
    operation. Typically only one flash page has read/written (a little bit
    more than 2-4 Kb), but continuous reading requires the spi controller
    to read up to 512 Kb in one operation without toggling CS in beetween.
    
    Roughly speaking spi controllers can be divided on 2 categories:
     * spi controllers without dirmap acceleration support
     * spi controllers with dirmap acceleration support
    
    Firt of them will have issues with continuous reading if restriction on
    the transfer length is implemented in the adjust_op_size() handler.
    Second group often supports acceleration of single page only reading.
    Thus enabling of continuous reading can break flash reading.
    
    This patch tries to create dirmap for continuous reading first and
    fallback to regular reading if spi controller refuses to create it.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net/atm: fix slab-out-of-bounds read in vcc_setsockopt() [+ + +]
Author: Eric Dumazet <edumazet@google.com>
Date:   Wed Aug 5 13:15:08 2026 +0000

    net/atm: fix slab-out-of-bounds read in vcc_setsockopt()
    
    [ Upstream commit d0c80dbb970439bd2eeb0e5effff8c16a5f4e1e3 ]
    
    vcc_setsockopt() contained an ineffective optlen check:
      if (__SO_LEVEL_MATCH(optname, level) && optlen != __SO_SIZE(optname))
          return -EINVAL;
    
    If __SO_LEVEL_MATCH(optname, level) evaluated to false (e.g. if the caller
    passed a mismatched level), the length check optlen != __SO_SIZE(optname)
    was short-circuited and bypassed. Execution then fell through to switch(optname),
    calling copy_from_sockptr() assuming optval contained sufficient space.
    
    Furthermore, even if level matched, a cgroup BPF setsockopt filter could shrink
    optlen after entry. Because copy_from_sockptr() on kernel pointers uses memcpy(),
    this leads to a KASAN slab-out-of-bounds read when optlen is smaller than the
    expected structure size.
    
    Fix this by using copy_safe_from_sockptr(), which unconditionally validates
    that optlen is at least the expected size before copying. Also change the local
    'value' variable type from 'unsigned long' to 'int' so that SO_SETCLP matches
    its sizeof(int) ABI encoding on 64-bit systems.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: syzbot+53ecc09fb81df10ef4de@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=53ecc09fb81df10ef4de
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Link: https://patch.msgid.link/20260805131508.3227331-1-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net/mlx5: fw_tracer, return NULL on create error [+ + +]
Author: Michael Guralnik <michaelgur@nvidia.com>
Date:   Wed Jul 29 11:04:02 2026 +0300

    net/mlx5: fw_tracer, return NULL on create error
    
    [ Upstream commit af39eb111ce6b5eba9c08513b62c4868eb7e7fd5 ]
    
    Tracer creation can fail by returning either NULL or ERR_PTR.
    The return value is stored without a check on the device, and users
    treat ERR_PTR and NULL the same way.
    This also causes a crash in the core dump logic, which is missing the
    ERR_PTR check and ends up dereferencing it, as shown in the trace below.
    
    Switch tracer creation to return NULL on failure only, so callers only
    need a single NULL check.
    
      Internal error: Oops: 0000000096000006 [#1]  SMP
      Modules linked in: mlx5_ib ib_uverbs ib_core ipv6 mlx5_core
      CPU: 1 UID: 0 PID: 12 Comm: kworker/u16:0 Not tainted 6.19.7 #1 PREEMPT(none)
      Workqueue: mlx5_health0001:01:00.0 mlx5_fw_reporter_err_work [mlx5_core]
      pstate: a3400009 (NzCv daif +PAN -UAO +TCO +DIT -SSBS BTYPE=--)
      pc : mlx5_fw_tracer_trigger_core_dump_general+0x58/0xe0 [mlx5_core]
      lr : mlx5_fw_tracer_trigger_core_dump_general+0x40/0xe0 [mlx5_core]
      sp : ffff800081cf3c40
      x29: ffff800081cf3c90 x28: 0000000000000000 x27: 0000000000000000
      x26: ffff000080018828 x25: 0000000000000000 x24: ffff000080304a05
      x23: ffff800081cf3d80 x22: ffff0000847e01a0 x21: 0000000000000000
      x20: ffff0000847e01a0 x19: ffffffffffffffa1 x18: ffff80008310bbf0
      x17: ffff800080119650 x16: ffff80008010df54 x15: ffff80008010d4ac
      x14: ffff800079c202e4 x13: ffff80008002fe60 x12: ffff800080119650
      x11: ffff80008010df54 x10: ffff80008010d4ac x9 : ffff800079c203d8
      x8 : ffff800081cf3c88 x7 : 0000000000000000 x6 : 0000000000000000
      x5 : 0000000000000000 x4 : 0000000000000008 x3 : 0000000000000030
      x2 : 0000000000000008 x1 : 0000000000000000 x0 : 00000000c5c4000e
      Call trace:
       mlx5_fw_tracer_trigger_core_dump_general+0x58/0xe0 [mlx5_core] (P)
       mlx5_fw_reporter_dump+0x30/0x2e0 [mlx5_core]
       devlink_health_do_dump+0x9c/0x160
       devlink_health_report+0x1c0/0x288
       mlx5_fw_reporter_err_work+0xac/0xc0 [mlx5_core]
       process_one_work+0x15c/0x3d8
       worker_thread+0x18c/0x320
       kthread+0x148/0x228
       ret_from_fork+0x10/0x20
      Code: b9400000 5ac00800 7a401800 540003ca (3940a260)
      ---[ end trace 0000000000000000 ]---
      Kernel panic - not syncing: Oops: Fatal exception
      SMP: stopping secondary CPUs
      Kernel Offset: disabled
      CPU features: 0x000000,00078031,75fce5a1,35fffe67
      Memory Limit: none
      ---[ end Kernel panic - not syncing: Oops: Fatal exception ]---
    
    Fixes: fd1483fe1f9f ("net/mlx5: Add support for FW reporter dump")
    Signed-off-by: Michael Guralnik <michaelgur@nvidia.com>
    Reviewed-by: Shay Drori <shayd@nvidia.com>
    Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
    Link: https://patch.msgid.link/20260729080402.2427184-1-tariqt@nvidia.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net/mlx5e: TC, Check if flow is PEER before acquiring devcom lock [+ + +]
Author: Shay Drory <shayd@nvidia.com>
Date:   Tue Jul 28 07:43:38 2026 +0300

    net/mlx5e: TC, Check if flow is PEER before acquiring devcom lock
    
    [ Upstream commit 6ddfba2ea98db21b001e0e5c472499156224650c ]
    
    In case __mlx5e_add_fdb_flow() fails in lower levels, the flow is
    deleted via mlx5e_tc_del_flow(), and mlx5e_tc_del_flow() is acquiring
    ESW devcom lock without condition. In addition, in case of peer_flow,
    __mlx5e_add_fdb_flow() is called while holding ESW devcom comp lock.
    This results in an AA deadlock.
    
    To fix this, introduce a new PEER flag that is set on flows created as
    peer flows (the duplicate flows on peer devices), and check it in
    mlx5e_tc_del_flow() before acquiring ESW devcom lock.
    
    Lockdep splat:
    ============================================
    WARNING: possible recursive locking detected
    ============================================
     Possible unsafe locking scenario:
           CPU0
           ----
      lock(&comp->lock_key#2);
      lock(&comp->lock_key#2);
     *** DEADLOCK ***
    Call Trace:
     <TASK>
     dump_stack_lvl+0x69/0xa0
     print_deadlock_bug.cold+0xbd/0xca
     __lock_acquire+0x1671/0x2ec0
     lock_acquire+0x10e/0x2e0
     down_read+0x95/0x430
     mlx5_devcom_for_each_peer_begin+0x4e/0xe0 [mlx5_core]
     mlx5e_tc_del_flow+0x11d/0xa70 [mlx5_core]
     mlx5e_flow_put+0x99/0x100 [mlx5_core]
     __mlx5e_add_fdb_flow+0x409/0xf00 [mlx5_core]
     mlx5e_configure_flower+0x2a86/0x4100 [mlx5_core]
     mlx5e_rep_setup_tc_cls_flower+0x12f/0x1b0 [mlx5_core]
     mlx5e_rep_setup_tc_cb+0x153/0x750 [mlx5_core]
     tc_setup_cb_add+0x1dc/0x470
     fl_change+0x2f4d/0x626d [cls_flower]
     tc_new_tfilter+0x79b/0x2310
     rtnetlink_rcv_msg+0x778/0xad0
     do_syscall_64+0x70/0x960
     entry_SYSCALL_64_after_hwframe+0x4b/0x53
     </TASK>
    
    Fixes: 04de7dda7394 ("net/mlx5e: Infrastructure for duplicated offloading of TC flows")
    Signed-off-by: Shay Drory <shayd@nvidia.com>
    Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
    Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
    Link: https://patch.msgid.link/20260728044338.2271143-1-tariqt@nvidia.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net/ncsi: fix heap OOB read in NCSI_CMD_SEND_CMD payload length [+ + +]
Author: Henry Martin <bsdhenrymartin@gmail.com>
Date:   Mon Aug 3 12:36:18 2026 +0800

    net/ncsi: fix heap OOB read in NCSI_CMD_SEND_CMD payload length
    
    [ Upstream commit afa58b7384913c8773d837acdb07b035690ec5d2 ]
    
    ncsi_send_cmd_nl() takes the number of bytes to copy from the
    attacker-controlled ncsi_pkt_hdr.length field of the in-band packet
    header, while the source buffer is the NCSI_ATTR_DATA netlink
    attribute whose readable size is nla_len() - sizeof(ncsi_pkt_hdr).
    The two length sources are never cross-checked: only
    nla_len() >= sizeof(struct ncsi_pkt_hdr) is enforced.
    
    With hdr->length set larger than the attribute payload (up to 65535
    against at most 2032 readable bytes), ncsi_cmd_handler_oem() copies
    past the end of the netlink attribute buffer with unsafe_memcpy(),
    leaking up to ~64KB of kernel heap memory into the transmitted NCSI
    command packet. The destination skb is sized by the declared payload,
    so the write side does not overflow - this is a pure OOB read /
    information leak, reachable with CAP_NET_ADMIN on systems with a
    registered NCSI device (e.g. OpenBMC on Aspeed BMC SoCs, where
    NET_NCSI=y is standard).
    
    Reject commands whose declared payload extends past the end of the
    data attribute.
    
    The issue was found by the autokbug dynamic kernel fuzzer at Tencent
    Yunding Lab.
    
    Fixes: 9771b8ccdfa6 ("net/ncsi: Extend NC-SI Netlink interface to allow user space to send NC-SI command")
    Reported-by: Henry Martin <bsdhenrymartin@gmail.com>
    Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
    Link: https://patch.msgid.link/20260803043618.3210301-1-bsdhenrymartin@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net/openvswitch: check Ethernet header length in key_extract() [+ + +]
Author: Cen Zhang (Microsoft) <blbllhy@gmail.com>
Date:   Thu Jul 30 18:20:06 2026 -0400

    net/openvswitch: check Ethernet header length in key_extract()
    
    [ Upstream commit cf6f8b29befb92173659bcef6a441d274947bfae ]
    
    When a packet arrives on an ARPHRD_NONE device (e.g. TUN),
    ovs_flow_key_extract() trusts the user-provided skb->protocol field: if
    it is ETH_P_TEB, the packet is classified as MAC_PROTO_ETHERNET and
    key_extract() is called without ensuring the skb has ETH_HLEN (14) bytes
    of linear data. key_extract() unconditionally pulls 2 * ETH_ALEN bytes
    for MAC addresses and parse_ethertype() pulls 2 more, either of which
    triggers a kernel BUG in __skb_pull() when the linear area is too small.
    
      kernel BUG at include/linux/skbuff.h:2848!
      RIP: 0010:key_extract+0xa7e/0xd90 net/openvswitch/flow.c:933
      ovs_flow_key_extract+0x419/0xa70
      ovs_vport_receive+0x222/0x390
      netdev_frame_hook+0x3e0/0x630
      tun_get_user+0x2d0c/0x38e0
    
    Fixed by calling check_header() in key_extract() before accessing the
    Ethernet header.
    
    Fixes: 217ac77a3c25 ("openvswitch: allow L3 netdev ports")
    Reported-by: AutonomousCodeSecurity@microsoft.com
    Reviewed-by: Eelco Chaudron <echaudro@redhat.com>
    Signed-off-by: Cen Zhang (Microsoft) <blbllhy@gmail.com>
    Reviewed-by: Ilya Maximets <i.maximets@ovn.org>
    Link: https://patch.msgid.link/20260730222006.118652-1-blbllhy@gmail.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net/packet: reset the MAC header on the packet-socket transmit path [+ + +]
Author: Doruk Tan Ozturk <doruk@0sec.ai>
Date:   Fri Jul 24 16:40:15 2026 +0200

    net/packet: reset the MAC header on the packet-socket transmit path
    
    commit c2707480cfbf19c7619acc9c089d17f20869821f upstream.
    
    packet_parse_headers() resets the MAC header only for a SOCK_RAW frame
    whose socket did not bind a protocol. A protocol-bound SOCK_RAW socket,
    any SOCK_DGRAM frame, and the legacy SOCK_PACKET path therefore leave
    skb->mac_header unset here.
    
    For frames sent via __dev_queue_xmit() this is harmless: it resets the
    MAC header unconditionally. But the packet-socket PACKET_QDISC_BYPASS
    path uses dev_direct_xmit(), which does not, so the frame reaches
    ndo_start_xmit() with the MAC header unset. A driver that reads
    eth_hdr(skb) on transmit then dereferences skb->head + (u16)~0, an
    out-of-bounds access ~64 KiB past the head -- the same class fixed for
    one consumer in commit f5089008f90c ("macsec: do not read an unset MAC
    header in macsec_encrypt()").
    
    packet_parse_headers() runs only on the transmit path, where skb->data
    points at the start of the L2 header for every packet-socket type
    regardless of its length: SOCK_RAW and SOCK_PACKET carry a user-supplied
    header and SOCK_DGRAM has one built by dev_hard_header(). Reset the MAC
    header unconditionally, mirroring __dev_queue_xmit(), so the frame is
    anchored on the bypass path too.
    
    Found by 0sec (https://0sec.ai) using automated source analysis;
    verified against source and matched to the macsec KASAN report in
    f5089008f90c. Compile-tested.
    
    Fixes: 75c65772c3d1 ("net/packet: Ask driver for protocol if not provided by user")
    Cc: stable@vger.kernel.org
    Signed-off-by: Doruk Tan Ozturk <doruk@0sec.ai>
    Reviewed-by: Willem de Bruijn <willemb@google.com>
    Link: https://patch.msgid.link/20260724144015.63219-1-doruk@0sec.ai
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
net/sched: act_ct: fix sk_buff leak when the header checks reject a packet [+ + +]
Author: Hyunjung Ko <hj351016@gmail.com>
Date:   Thu Aug 6 19:12:34 2026 +0900

    net/sched: act_ct: fix sk_buff leak when the header checks reject a packet
    
    commit 8a7ed561671aa6a911a2de99e59ef670a4d0b1df upstream.
    
    tcf_ct_handle_fragments() runs its header sanity checks before handing
    anything to the defragmentation engine:
    
            if (family == NFPROTO_IPV4)
                    err = tcf_ct_ipv4_is_fragment(skb, &frag);
            else
                    err = tcf_ct_ipv6_is_fragment(skb, &frag);
            if (err || !frag)
                    return err;
    
    tcf_ct_ipv4_is_fragment() returns -EINVAL or -ENOMEM;
    tcf_ct_ipv6_is_fragment() adds -EPROTO when ipv6_find_hdr() fails. None of
    them frees or queues the skb, so on that path the caller still owns it.
    
    tcf_ct_act() however funnels every non-zero return into the
    ownership-transfer exit:
    
            err = tcf_ct_handle_fragments(net, skb, family, p->zone, &defrag);
            if (err)
                    goto out_frag;
            ...
    out_frag:
            if (err != -EINPROGRESS)
                    tcf_action_inc_drop_qstats(&c->common);
            return TC_ACT_CONSUMED;
    
    TC_ACT_CONSUMED means the action took ownership of the skb, so no caller
    frees it - sch_handle_ingress(), sch_handle_egress() and
    tcf_qevent_handle() all deliberately skip the free for that verdict. The
    skb is therefore orphaned: one sk_buff plus its data buffer is leaked per
    malformed packet, unbounded. Note the drop counter is already incremented
    for these errors, so the statistics claim a drop that never happens.
    
    Three different ownership states reach out_frag: today - the skb may be
    queued by the defrag engine (-EINPROGRESS), already freed by
    nf_ct_handle_fragments(), or still owned by us. Tell the caller which of
    those it is, and free the packet ourselves in the last case, which
    restores the TC_ACT_SHOT behaviour that predated the Fixes: commit.
    
    Reproduced on v7.2-rc6 with a 54-byte frame carrying a 40-byte IPv6
    header with nexthdr = 0 (hop-by-hop) and nothing after it, on a
    clsact ingress chain with "action ct". kmemleak reports one leaked
    232-byte skbuff_head_cache object plus its 704-byte data buffer per
    packet; with this patch it reports none.
    
    Fixes: 3f14b377d01d ("net/sched: act_ct: fix skb leak and crash on ooo frags")
    Cc: stable@vger.kernel.org # v6.8+
    Signed-off-by: Hyunjung Ko <hj351016@gmail.com>
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Link: https://patch.msgid.link/20260806101235.809370-1-hj351016@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net/sched: act_gact, act_police: range check the fallback control action [+ + +]
Author: Hyunjung Ko <hj351016@gmail.com>
Date:   Thu Aug 6 19:12:52 2026 +0900

    net/sched: act_gact, act_police: range check the fallback control action
    
    commit 883b56ae58fe657d8497806c7059646e9ba6dbd0 upstream.
    
    tcf_action_check_ctrlact() range checks the primary control action:
    
            if (!opcode)
                    ret = action > TC_ACT_VALUE_MAX ? -EINVAL : 0;
    
    TC_ACT_VALUE_MAX is TC_ACT_TRAP, so kernel-internal verdicts above it
    cannot be set that way. But act_gact and act_police each carry a second,
    independent control action supplied by user space that never reaches that
    helper - TCA_GACT_PROB.paction and TCA_POLICE_RESULT. Both only reject
    TC_ACT_GOTO_CHAIN, so any other value is stored verbatim and returned
    verbatim from the action.
    
    In particular user space can store TC_ACT_CONSUMED, which is
    TC_ACT_VALUE_MAX + 1 and is deliberately not part of the UAPI value
    range. That verdict tells every caller the action took ownership of the
    skb, so nobody frees it: sch_handle_ingress(), sch_handle_egress() and
    tcf_qevent_handle() all deliberately skip the free for it. The result is
    one leaked sk_buff plus its data buffer per packet traversing the filter,
    unbounded, for all traffic on the chain including kernel-generated
    packets.
    
    Both are trivially deterministic. act_gact clamps tcfg_pval to >= 1, so
    with pval = 1 gact_determ() returns the fallback for every packet.
    act_police has no mandatory rate, so rate = 0 leaves tcfp_mtu = ~0 and
    tcf_police_mtu_check() always passes.
    
    TC_ACT_CONSUMED was added by commit 720f22fed81b ("net: sched: refactor
    reinsert action"), after both goto-chain guards were written:
    commit 9469f375ab09 ("net/sched: act_gact: disallow 'goto chain' on
    fallback control action") and
    commit c08f5ed5d625 ("net/sched: act_police: disallow 'goto chain' on
    fallback control action"). Neither guard was widened when the new
    verdict appeared.
    
    Factor the existing range test out of tcf_action_check_ctrlact() as
    tcf_action_valid() and apply it to both fallbacks. The helper cannot call
    tcf_action_check_ctrlact() directly because that also allocates a
    goto_chain, which is exactly what these two sites must not do.
    
    Reproduced on v7.2-rc6: kmemleak reports one leaked 232-byte
    skbuff_head_cache object plus its 704-byte data buffer per packet. With
    this patch both configurations are rejected with -EINVAL and kmemleak
    reports none.
    
    Fixes: 720f22fed81b ("net: sched: refactor reinsert action")
    Cc: stable@vger.kernel.org # v5.3+
    Signed-off-by: Hyunjung Ko <hj351016@gmail.com>
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Tested-by: Victor Nogueira <victor@mojatatu.com>
    Link: https://patch.msgid.link/20260806101252.809593-1-hj351016@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net/sched: cls_api: Always acquire rtnl_lock when destroying locked classifiers [+ + +]
Author: Jamal Hadi Salim <jhs@mojatatu.com>
Date:   Sat Aug 1 08:56:32 2026 -0400

    net/sched: cls_api: Always acquire rtnl_lock when destroying locked classifiers
    
    [ Upstream commit a347304b2ca1a5377d5bd2d8a72e4b4f12afe648 ]
    
    Another challenge with unlocked filters.
    There is a short window in tc_new_tfilter where a tcf_proto can be found
    and briefly referenced by a totally unrelated, unlocked classifier's request
    and cause a race.
    
    Feng created a poc which created this race with two threads, one creating a
    u32 filter and other a flower filter in the same chain/prio:
    
    1. Both threads enter tc_new_tfilter, both find the chain empty, both
       drop filter_chain_lock
    2. u32 finishes tcf_proto_create("u32") first, calls
       tcf_chain_tp_insert_unique() -> inserts u32_tp into the chain
    3. flower finishes tcf_proto_create("flower") later, calls
       tcf_chain_tp_insert_unique() -> tcf_chain_tp_find() now sees u32_tp
       already there, takes a reference on it, destroys flower's own tp_new
       and returns u32_tp to the caller.
    
    Flower then hits the kind mismatch check (because it requested for kind
    "flower" but tp->ops->kind is "u32") and goes through the errout path
    which calls tcf_proto_put() on u32_tp. If the u32 thread has already
    gone through its own errout (its change() call failed on the PoC's empty
    options) and dropped its create and insert refs, flower's put is the
    last one and drops u32_tp's refcnt to zero.
    
    At this point tp->ops->destroy() runs in a context that never took
    rtnl_lock. When that happens, it might cause a UAF like the following
    (illustrated by the PoC):
    
    [  +0.000710] BUG: KASAN: slab-use-after-free in u32_init (net/sched/cls_u32.c:393)
    [  +0.000281] Read of size 8 at addr ffff888120022f00 by task poc_feng_xue/524
    
      Call Trace:
       u32_init (net/sched/cls_u32.c:393)
       tc_new_tfilter (net/sched/cls_api.c:2378)
    
      Allocated by task 526:
       u32_init (net/sched/cls_u32.c:378)
       tc_new_tfilter (net/sched/cls_api.c:2378)
    
      Freed by task 522:
       kfree
       u32_destroy (net/sched/cls_u32.c:662)
       tcf_proto_destroy (net/sched/cls_api.c:446)
       tcf_proto_put (net/sched/cls_api.c:459)
       tc_new_tfilter (net/sched/cls_api.c:2459)
    
    Fix this by having tcf_proto_destroy() take rtnl_lock around
    tp->ops->destroy() for locked classifiers whenever rtnl is not held.
    
    To explain why I used a temp variable "not_lockless" I'd like to point to a
    semi-related note on rtnl_held vs TCF_PROTO_OPS_DOIT_UNLOCKED (adding here
    for future cleanup if deemed necessary):
    The rtnl_held parameter and the TCF_PROTO_OPS_DOIT_UNLOCKED flag are
    redundant sources of truth for whether rtnl_lock is held. Among the nine
    classifier destroy(..rtnl_held..) callbacks, only flower consults the
    rtnl_held parameter which it propagates to tc_setup_cb_destroy()
    and tc_setup_cb_call(). The other eight (u32, flow, bpf, cgroup, route, basic,
    fw, mall) ignore it entirely;-> those that call tc_setup_cb_destroy()
    (u32, bpf, mall) hardcode true always instead of forwarding the parameter.
    
    A future cleanup should remove the rtnl_held parameter from the destroy callback
    signature entirely and have callers rely solely on their knowledge whether
    they are running in an unlocked context.
    
    Fixes: 12db03b65c2b ("net: sched: extend proto ops to support unlocked classifiers")
    Reported-by: Feng Xue <feng.xue@outlook.com>
    Tested-by: Victor Nogueira <victor@mojatatu.com>
    Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Link: https://patch.msgid.link/20260801125632.360365-1-jhs@mojatatu.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/sched: cls_route: fix fastmap use-after-free on filter [+ + +]
Author: Jamal Hadi Salim <jhs@mojatatu.com>
Date:   Wed Jul 29 05:44:11 2026 -0400

    net/sched: cls_route: fix fastmap use-after-free on filter
    
    [ Upstream commit 47d7f7051253bdc02b1d245d87e38f16d31a74df ]
    
    The route4 classifier maintains a 16-slot fastmap cache that stores raw
    struct route4_filter pointers indexed by (id, iif). The reader
    (route4_classify) populates this cache via route4_set_fastmap() for every
    classified packet that hits a filter. The writer (route4_delete,
    route4_change) clears the cache via route4_reset_fastmap() before
    RCU-deferred kfree of the filter.
    
    This creates a UAF race:
     1. Reader walks the RCU-protected bucket chain, finds filter f
     2. Writer unlinks f, calls route4_reset_fastmap(), then tcf_queue_work()
     3. Reader calls route4_set_fastmap() and writes f into the cache
        *after* the writer's reset, caching a pointer about to be freed
     4. After the RCU grace period, kfree(f) executes
     5. Next classified packet on the same (id, iif) tuple hits the stale
        fastmap entry and reads f->res from freed memory
    
    Reproduced with an mdelay(100) accelerator in route4_set_fastmap() and a
    concurrent add/delete stress test (provided by both zdi and Santosh).
    Both triggered KASAN slab-use-after-free reports in the route4 fastmap
    paths.
    
    Fix:
    Introduce a per-filter boolean dying flag to suppress stale fastmap
    republishing by in-flight readers.
    
    Fixes: 1109c00547fc ("net: sched: RCU cls_route")
    Reported-by: zdi-disclosures@trendmicro.com
    Reported-by: Santosh Kalluri <santosh.kalluri129@gmail.com>
    Suggested-by: Paolo Abeni <pabeni@redhat.com>
    Tested-by: Victor Nogueira <victor@mojatatu.com>
    Tested-by: Santosh Kalluri <santosh.kalluri129@gmail.com>
    Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Link: https://patch.msgid.link/20260729094411.46257-1-jhs@mojatatu.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/sched: reject overly deep qdisc hierarchies [+ + +]
Author: Zijie Huang <milkory@outlook.com>
Date:   Sat Aug 1 21:42:33 2026 +0800

    net/sched: reject overly deep qdisc hierarchies
    
    commit dedd34b0f2310e28c5f6d4875cfbf4b7ed821c01 upstream.
    
    Deep qdisc hierarchies can lead to excessive recursion in qdisc tree
    walkers and exhaust the kernel stack. The existing loop check does not
    cover the create-and-graft path, so a hierarchy can still be extended by
    creating a new child qdisc below an already deep parent.
    
    Store the hierarchy depth in struct Qdisc and update it when qdiscs are
    grafted. Reject new child qdiscs once the parent is already at the maximum
    allowed depth.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable@vger.kernel.org
    Suggested-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Reported-by: Vega <vega@nebusec.ai>
    Assisted-by: Codex:gpt-5.4
    Signed-off-by: Zijie Huang <milkory@outlook.com>
    Signed-off-by: Ren Wei <enjou1224z@gmail.com>
    Reviewed-by: Victor Nogueira <victor@mojatatu.com>
    Link: https://patch.msgid.link/1e9ab39597423fd5d13cfaaf52279b8ee3d9fc3c.1785434373.git.milkory@outlook.com
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net/sched: sch_cake: drop WARN_ON(1) for malformed packets in ACK filter [+ + +]
Author: Toke Høiland-Jørgensen <toke@toke.dk>
Date:   Wed Jul 29 21:14:16 2026 +0200

    net/sched: sch_cake: drop WARN_ON(1) for malformed packets in ACK filter
    
    [ Upstream commit 2a33516f9ef59ad11844d4fc152f889449b5daf3 ]
    
    The sch_cake ACK filter parses packets to find the TCP header and filter
    duplicated ACKs if the flow is backlogged. The parsing code contains a
    WARN_ON(1) which can be triggered by a malformed IP header in certain
    cases. Depending on the system configuration, this leads either to
    either spamming dmesg with warnings, or a panic if panic_on_warn is set.
    
    The code already correctly skips the offending packet in the branch that
    triggers the warning, so the WARN_ON itself doesn't really serve any
    purpose. So just drop it altogether to avoid the inconvenient side
    effects.
    
    Fixes: 8b7138814f29 ("sch_cake: Add optional ACK filter")
    Reported-by: Zhiling Zou <zhilinz@nebusec.ai>
    Reported-by: Ren Wei <enjou1224z@gmail.com>
    Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
    Link: https://patch.msgid.link/20260729191417.45665-1-toke@toke.dk
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net/smc: fix qentry overwrite for CONFIRM_LINK and ADD_LINK_CONT in smc_llc_event_handler() [+ + +]
Author: Mahanta Jambigi <mjambigi@linux.ibm.com>
Date:   Wed Jul 29 15:01:53 2026 +0200

    net/smc: fix qentry overwrite for CONFIRM_LINK and ADD_LINK_CONT in smc_llc_event_handler()
    
    [ Upstream commit 976245094925bab9bc39366b2e9ab44ffcde61d0 ]
    
    The SMC_LLC_CONFIRM_LINK / SMC_LLC_ADD_LINK_CONT branch in
    smc_llc_event_handler() stores an incoming qentry into the local LLC flow
    without first checking whether a qentry is already pending. If a malicious or
    buggy peer sends a second CONFIRM_LINK or ADD_LINK_CONT request while a flow is
    active and flow->qentry is already set, smc_llc_flow_qentry_set() overwrites the
    pointer without freeing the previous allocation, leaking one kmalloc-96 object
    per spurious message.
    
    The sibling SMC_LLC_DELETE_LINK branch already has the correct !flow->qentry
    guard. Apply the same guard to the CONFIRM_LINK/ADD_LINK_CONT branch so that a
    duplicate message when qentry is already occupied falls through to break and is
    freed by the kfree(qentry) at the out: label, rather than silently leaking the
    existing allocation.
    
    The response direction (smc_llc_rx_response()) is unaffected: it already guards
    with flow->qentry at the equivalent site and drops duplicate responses
    correctly.
    
    Fixes: 0fb0b02bd6fd ("net/smc: adapt SMC client code to use the LLC flow")
    Signed-off-by: Mahanta Jambigi <mjambigi@linux.ibm.com>
    Reviewed-by: Hidayath Khan <hidayath@linux.ibm.com>
    Reviewed-by: Sidraya Jayagond <sidraya@linux.ibm.com>
    Reviewed-by: Dust Li <dust.li@linux.alibaba.com>
    Link: https://patch.msgid.link/20260729130153.970800-1-mjambigi@linux.ibm.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/smc: fix TOCTOU race between smc_listen_out() and listener close [+ + +]
Author: Sidraya Jayagond <sidraya@linux.ibm.com>
Date:   Mon Aug 3 09:07:01 2026 +0200

    net/smc: fix TOCTOU race between smc_listen_out() and listener close
    
    [ Upstream commit 185a4caeecabc150106deda1da170b09f2ad803f ]
    
    smc_listen_out() reads lsmc->sk.sk_state without the listener lock,
    then acquires lock_sock_nested() only after the check passes. This
    opens a window where smc_close_active() can transition the listener
    to SMC_CLOSED, call smc_close_cleanup_listen() to drain the accept
    queue, and release the lock, all between the lockless read and the
    delayed lock acquisition:
    
      smc_listen_work (smc_hs_wq)          smc_close_active()
      -------------------------------      -------------------------
      release_sock(child)
      if (sk_state == SMC_LISTEN) TRUE
                                            lock_sock(listener)
                                            sk_state = SMC_CLOSED
                                            smc_close_cleanup_listen()
                                            release_sock(listener)
                                            flush_work(tcp_listen_work)
      lock_sock_nested(listener)
      smc_accept_enqueue(listener, child) /* child enqueued on dead listener */
    
    smc_close_active() flushes only tcp_listen_work. Work items already
    dispatched onto smc_hs_wq for the CLC handshake continue running
    unguarded. smc_accept_enqueue() takes a sock_hold() on the child that
    is never released, so the child smc_sock, its clcsock, and the
    reference all leak. A remote peer that opens TCP connections while the
    server calls close() can exhaust kernel memory.
    
    Move lock_sock_nested() to before the sk_state check so that the test
    and the enqueue are atomic under the listener lock.
    
    Fixes: fd57770dd198 ("net/smc: wait for pending work before clcsock release_sock")
    Reviewed-by: Mahanta Jambigi <mjambigi@linux.ibm.com>
    Signed-off-by: Sidraya Jayagond <sidraya@linux.ibm.com>
    Reviewed-by: Breno Leitao <leitao@debian.org>
    Reviewed-by: Dust Li <dust.li@linux.alibaba.com>
    Link: https://patch.msgid.link/20260803070701.126339-1-sidraya@linux.ibm.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net: atlantic: free RX pages of consumed but not refilled buffers [+ + +]
Author: Yangyu Chen <cyy@cyyself.name>
Date:   Sun Aug 2 23:46:38 2026 +0800

    net: atlantic: free RX pages of consumed but not refilled buffers
    
    commit e8e7471ef686b6c002218fee9671cc61992ae01a upstream.
    
    aq_ring_rx_deinit() only walks [sw_head, sw_tail), the region posted to
    hardware. Since the page reuse strategy was added, a cleaned RX buffer
    keeps its page (and its DMA mapping) in the ring for reuse, and refill
    is batched: aq_ring_rx_fill() returns early until AQ_CFG_RX_REFILL_THRES
    slots are free. Slots that were consumed but not yet reposted therefore
    sit in the complementary [sw_tail, sw_head) gap with a live page, and
    the deinit walk never visits them: up to a refill batch worth of pages
    and DMA mappings leak on every interface down.
    
    Walk the whole ring instead and release whatever is still there. Also
    bail out if the buffer ring is already gone: a partial
    aq_ptp_ring_alloc() failure frees the ring but leaves aq_nic set, so
    aq_ptp_ring_deinit() still gets here on the unwind path.
    
    Cc: stable@vger.kernel.org # v5.2+
    Fixes: 46f4c29d9de6 ("net: aquantia: optimize rx performance by page reuse strategy")
    Reviewed-by: Sukhdeep Singh <sukhdeeps@marvell.com>
    Signed-off-by: Yangyu Chen <cyy@cyyself.name>
    Acked-by: Mina Almasry <almasrymina@google.com>
    Link: https://patch.msgid.link/tencent_607CBA8237DA438E36B844318B21538DE008@qq.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: atlantic: free stranded TX buffers on ring deinit [+ + +]
Author: Yangyu Chen <cyy@cyyself.name>
Date:   Sun Aug 2 23:46:00 2026 +0800

    net: atlantic: free stranded TX buffers on ring deinit
    
    commit 452636ea5410a96e02ebaaf80b21e3620b98e0dd upstream.
    
    aq_vec_deinit() drains the TX rings with a single aq_ring_tx_clean()
    call, which frees at most AQ_CFG_TX_CLEAN_BUDGET (256) descriptors and
    stops at hw_head, which no longer moves once aq_vec_stop() has stopped
    the hardware and NAPI. Completed descriptors beyond the budget and
    everything still posted in [hw_head, sw_tail) keep their skb or
    xdp_frame when the interface goes down: aq_vec_ring_free() then frees
    the buffer ring and the references are lost for good.
    
    Today this is a silent memory leak on every interface down under
    TX/XDP_TX load. With the conversion of the RX path to page_pool posted
    for net-next it becomes much more visible: XDP_TX frames carry fragment
    references on the RX ring's page_pool, so a single stranded frame keeps
    the pool's inflight count above zero forever. page_pool_destroy() then
    never completes, the pool is leaked together with its pages, and
    "page_pool_release_retry() stalled pool shutdown" is warned every 60
    seconds from that point on, on every ifdown, XDP detach or ring resize
    under XDP_TX load.
    
    Bring back aq_ring_tx_deinit() as it was before the removal and use it
    for teardown again, with one extension: TX rings can hold xdp_frames
    nowadays, so release those too. They are returned with
    xdp_return_frame() since this runs in process context.
    
    Fixes: eb36bedf28be ("net: aquantia: remove function aq_ring_tx_deinit")
    Cc: stable@vger.kernel.org # v4.11+
    Reviewed-by: Sukhdeep Singh <sukhdeeps@marvell.com>
    Signed-off-by: Yangyu Chen <cyy@cyyself.name>
    Acked-by: Mina Almasry <almasrymina@google.com>
    Link: https://patch.msgid.link/tencent_EEDC35FAF2750A3A6A0B39BAE0E2C484860A@qq.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: bridge: mrp: fix uninitialised bytes on the wire [+ + +]
Author: Baul Lee <baul.lee@xbow.com>
Date:   Wed Jul 29 22:19:41 2026 +0900

    net: bridge: mrp: fix uninitialised bytes on the wire
    
    commit 63488dba65ef91373ef616575b32eb0eb21459f4 upstream.
    
    br_mrp_alloc_test_skb() builds MRP test frames on an skb from
    dev_alloc_skb(), which does not clear the linear data area.  On the MRA
    ring-role branch the sub-option TLV header is appended with
    
            sub_tlv = skb_put(skb, sizeof(*sub_tlv));
            sub_tlv->type = BR_MRP_SUB_TLV_HEADER_TEST_AUTO_MGR;
    
    so sub_tlv->length is never written, and the two trailing alignment bytes
    are appended with a bare skb_put() that does not clear them either.  The
    neighbouring oui and sub_opt regions are explicitly zeroed, so three
    uninitialised bytes are left in every MRA MRP_Test frame that goes out.
    
    Put the sub-option TLV header and the alignment padding in a single
    skb_put_zero(), which clears both.  The AUTO_MGR sub-TLV carries no
    payload, so the zeroed length field is already the value it should have.
    
    Fixes: f7458934b079 ("net: bridge: mrp: Update the Test frames for MRA")
    Suggested-by: Nikolay Aleksandrov <razor@blackwall.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Baul Lee <baul.lee@xbow.com>
    Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
    Link: https://patch.msgid.link/20260729131941.10254-1-baul.lee@xbow.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: fec: do not release NULL pages when RX buffer allocation fails [+ + +]
Author: Mehmet Fide <mehmet.fide@screeningeagle.com>
Date:   Mon Aug 10 14:39:02 2026 +0200

    net: fec: do not release NULL pages when RX buffer allocation fails
    
    fec_enet_alloc_rxq_buffers() leaves the loop as soon as
    page_pool_dev_alloc_pages() returns NULL and jumps to err_alloc, which
    calls fec_enet_free_buffers(). That helper walks the whole ring and
    hands every rx_skb_info[i].page to page_pool_put_full_page(), including
    the entries the allocation loop never reached. Those are still NULL,
    because the queue was allocated with kzalloc(), and
    page_pool_put_full_page() dereferences the page, so an open that runs
    out of memory oopses instead of returning -ENOMEM:
    
      Unable to handle kernel NULL pointer dereference at virtual address 00000014 when read
      Internal error: Oops: 5 [#1] SMP ARM
      CPU: 0 PID: 384 Comm: connmand Not tainted 6.18.43 #1
      Hardware name: Freescale Vybrid VF5xx/VF6xx (Device Tree)
      PC is at fec_enet_free_buffers+0xb0/0x2a8
      Call trace:
       fec_enet_free_buffers from fec_enet_open+0x1e0/0x504
       fec_enet_open from __dev_open+0x114/0x238
       __dev_open from __dev_change_flags+0x190/0x208
       __dev_change_flags from netif_change_flags+0x1c/0x58
       netif_change_flags from dev_change_flags+0x44/0x74
       dev_change_flags from devinet_ioctl+0x3a4/0x768
    
    Seen on a Colibri VF50, 128 MiB of RAM, on the first ifup after boot.
    
    Skip the entries that hold no page, and clear the ones that do after
    releasing them, so that a later failed open cannot release the same page
    a second time.
    
    Mainline is not affected. Commit a2ae70c0efe4 ("net: fec: add
    fec_alloc_rxq_buffers_pp() to allocate buffers from page pool") replaced
    this loop with fec_free_rxq_buffers(), which skips and clears the empty
    entries. That commit is part of the XDP zero copy series and is not a
    stable candidate, so this is the equivalent minimal fix for 6.18.y.
    
    Fixes: 95698ff6177b ("net: fec: using page pool to manage RX buffers")
    Cc: stable@vger.kernel.org
    Signed-off-by: Mehmet Fide <mehmet.fide@screeningeagle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: fix skb length accounting after generic XDP frag adjustment [+ + +]
Author: Sun Jian <sun.jian.kdev@gmail.com>
Date:   Mon Aug 3 22:40:38 2026 -0700

    net: fix skb length accounting after generic XDP frag adjustment
    
    commit 33f2b2eb33d666ecac68031e0f31424fb70528db upstream.
    
    Generic XDP exposes non-linear skb fragments through an xdp_buff. If an
    XDP program adjusts the fragment area, bpf_prog_run_generic_xdp() copies
    xdp_frags_size back to skb->data_len but leaves skb->len containing the
    old fragment contribution.
    
    After a fragment shrink, this makes skb_headlen() larger than the actual
    linear area. In the reproduced UDP receive path, __skb_datagram_iter()
    copied 1024 bytes past the actual linear tail to userspace, starting at
    struct skb_shared_info. The copied bytes included the affected skb's
    nr_frags, xdp_frags_size and a kernel pointer from
    skb_shinfo(skb)->frags[0]. Real packet data was displaced by the same
    amount and truncated at the end.
    
    Subtract the old data_len before replacing it and add the new data_len
    afterwards, keeping skb->len and skb->data_len synchronized.
    
    A 60000-byte UDP datagram on a veth pair with MTU 64000 was shortened by
    1024 bytes from its fragment area. Before the fix, all 10 runs produced
    corrupted payloads. After the fix, all 10 runs matched the expected
    payload exactly.
    
    Fixes: e6d5dbdd20aa ("xdp: add multi-buff support for xdp running in generic mode")
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/bpf/al9T9Eto%2FhRIzP5W@boxer/
    Reviewed-by: Mohsin Bashir <hmohsin@meta.com>
    Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
    Signed-off-by: Sun Jian <sun.jian.kdev@gmail.com>
    Link: https://patch.msgid.link/20260804054040.613675-2-sun.jian.kdev@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: hisilicon: hix5hd2_gmac: remove redundant NAPI delete [+ + +]
Author: Jiawen Liu <1298662399@qq.com>
Date:   Tue Jul 28 12:17:10 2026 +0400

    net: hisilicon: hix5hd2_gmac: remove redundant NAPI delete
    
    [ Upstream commit f307a7dc32097c11413178fca437a10d20890bc2 ]
    
    hix5hd2_dev_remove() calls netif_napi_del() before unregister_netdev().
    This is not needed because free_netdev() deletes all NAPI instances
    attached to the net_device.
    
    Remove the redundant call and let the networking core tear down the NAPI
    instance during unregister_netdev(). The probe error path still keeps its
    explicit netif_napi_del(), because the device has not been registered
    there.
    
    Fixes: 57c5bc9ad7d7 ("net: hisilicon: add hix5hd2 mac driver")
    Signed-off-by: Jiawen Liu <1298662399@qq.com>
    Link: https://patch.msgid.link/tencent_5FFD37A252B4FEA6A80AD25B17C8E904F005@qq.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: hns3: fix speed configuration residue after driver reload [+ + +]
Author: Jijie Shao <shaojijie@huawei.com>
Date:   Fri Jul 24 17:30:36 2026 +0800

    net: hns3: fix speed configuration residue after driver reload
    
    [ Upstream commit 3860d8748af315bfee6fe669fddc1fc17d3214db ]
    
    After setting a 100G optical port to 40G via ethtool and reloading
    the driver, the port remains at 40G instead of reverting to the
    firmware default speed of 100G.
    
    The commit referenced in Fixes: added two overwrites in
    hclge_init_ae_dev() for non-copper media, so that optical ports
    connected to forced-mode remotes inherit the firmware-preset
    autoneg and speed instead of the hardcoded defaults:
    
      req_autoneg = mac.autoneg
      req_speed   = mac.speed         (when autoneg disabled)
    
    The autoneg overwrite keeps existing behavior:
    hclge_set_autoneg_speed_dup() already uses mac.autoneg (not
    req_autoneg) since it was introduced, so autoneg inheritance from
    firmware was already in place. This part is kept.
    
    The speed overwrite, however, introduces the residue: mac.speed
    reflects whatever was last programmed into the MAC, and after unload
    firmware does not restore the MAC speed to the flash default. So if
    the user changed speed via ethtool in a prior load, mac.speed still
    carries that value on reload and req_speed inherits it.
    
    Fix by dropping the req_speed overwrite only. req_speed keeps the
    firmware default value set in hclge_configure() (cfg.default_speed),
    so a reload reverts the speed to default, matching the expectation
    that a driver reload resets link configuration.
    
    Trade-off: on optical ports whose firmware default speed does not
    match a forced-mode remote, reload now drops the link and the user
    must re-apply ethtool configuration. This is acceptable: a driver
    reload is expected to reset link configuration, not to inherit
    runtime state from before unload. The autoneg inheritance is left
    in place as established behavior; changing it is out of scope for
    this patch and would itself be a user-perceivable behavior change.
    
    Fixes: d9d349c4e8a0 ("net: hns3: differentiate autoneg default values between copper and fiber")
    Signed-off-by: Jijie Shao <shaojijie@huawei.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20260724093036.426631-1-shaojijie@huawei.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: octeontx2-pf: Fix UB in shift operation [+ + +]
Author: Sergey V. Frolov <Sergey.V.Frolov@kaspersky.com>
Date:   Tue Aug 4 15:04:48 2026 +0300

    net: octeontx2-pf: Fix UB in shift operation
    
    commit 7e2d693af0d4c05bddccb3541a0aabd69f4cb244 upstream.
    
    In function otx2_get_egress_burst_cfg, when the parameter `burst` is
    255 and the max mantissa is 255 (0xFFULL), `burst_exp` is set to
    `ilog2(255) - 1`, which equals 6.
    
    This results in an unsigned wrap-around when calculating
    `(1ULL << (*burst_exp - 7))`, since `*burst_exp - 7` becomes -1,
    which makes the shift operand 0xFFFFFFFF. This value is greater than
    the width of the left operand.
    
    According to standard 6.5.7 p.3:
    "The type of the result is that of the promoted left operand.
    If the value of the right operand is negative or is greater than
    or equal to the width of the promoted left operand, the behavior
    is undefined."
    
    Fix the off-by-one boundary condition.
    
    Add a WARN_ON(*burst_exp < 7) before the else branch as an
    explicit safeguard. This ensures that if max_mantissa ever changes
    in a way that reintroduces this condition, it will be immediately
    caught at runtime rather than silently triggering UB.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: e638a83f167e ("octeontx2-pf: TC_MATCHALL egress ratelimiting offload")
    Signed-off-by: Sergey V. Frolov <Sergey.V.Frolov@kaspersky.com>
    Cc: stable@vger.kernel.org
    Reviewed-by: Ratheesh Kannoth <rkannoth@marvell.com>
    Reviewed-by: Sunil Goutham <sgoutham@marvell.com>
    Link: https://patch.msgid.link/20260804120446.1955448-1-Sergey.V.Frolov@kaspersky.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: openvswitch: reallocate update replies for mismatched IDs [+ + +]
Author: Zhiling Zou <zhilinz@nebusec.ai>
Date:   Mon Aug 3 08:29:36 2026 +0800

    net: openvswitch: reallocate update replies for mismatched IDs
    
    commit 5d1c224dd914579524a183a514c12b95095d12ce upstream.
    
    ovs_flow_cmd_new() preallocates the optional reply skb before it takes
    ovs_mutex and before it knows which existing flow will be updated.
    
    That is normally fine because the skb is sized from the request flow
    identifier.  That identifier also becomes the inserted flow's identifier.
    For updates, however, a request with a UFID may miss the UFID lookup and
    then fall back to the flow key lookup.  That lookup can legitimately find
    an existing key-identified flow.  UFIDs are optional and the flow key is
    the primary identifier.
    
    For echoed replies, ovs_flow_cmd_fill_info() writes the matched flow's
    identifier, not the request identifier used for the preallocation.  A short
    request UFID can therefore leave too little room for the key identifier.
    The fill can then fail with -EMSGSIZE and hit the BUG_ON(error < 0) in the
    update path.
    
    Once the update target has been resolved, reallocate the reply skb if the
    matched flow needs a larger reply than the request identifier allowed.  Do
    this before replacing the actions so the request can still fail cleanly if
    the rare extra allocation fails.
    
    Fixes: 74ed7ab9264c ("openvswitch: Add support for unique flow IDs.")
    Cc: stable@vger.kernel.org
    Reported-by: Vega <vega@nebusec.ai>
    Signed-off-by: Zhiling Zou <zhilinz@nebusec.ai>
    Reviewed-by: Ilya Maximets <i.maximets@ovn.org>
    Link: https://patch.msgid.link/f7bbd3c30ce81a39156e226b3872d73abed21d2f.1785644623.git.zhilinz@nebusec.ai
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: prestera: validate firmware header length [+ + +]
Author: Pengpeng Hou <pengpeng@iscas.ac.cn>
Date:   Fri Jul 31 22:19:06 2026 +0800

    net: prestera: validate firmware header length
    
    [ Upstream commit 8ae344eb540af3f457179b52bc6061416752485c ]
    
    prestera_fw_hdr_parse() reads the firmware header before checking
    that the firmware image contains that header.
    
    Reject images shorter than struct prestera_fw_header before decoding the
    magic and version fields.
    
    Fixes: 4c2703dfd7fabb ("net: marvell: prestera: Add PCI interface support")
    Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
    Acked-by: Elad Nachman <enachman@marvell.com>
    Link: https://patch.msgid.link/20260731141500.1-prestera-v2-pengpeng@iscas.ac.cn
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: remove CAP_SYS_RAWIO zero-padding in dev_validate_header [+ + +]
Author: Qihang Tang <q.h.hack.winter@gmail.com>
Date:   Wed Aug 5 20:57:27 2026 +0800

    net: remove CAP_SYS_RAWIO zero-padding in dev_validate_header
    
    commit 3b9a324e646d3657a8d9806dfbfe4f3e4066e882 upstream.
    
    dev_validate_header() reads dev->hard_header_len directly when
    zero-padding short link layer headers for CAP_SYS_RAWIO holders:
    
        if (capable(CAP_SYS_RAWIO)) {
            memset(ll_header + len, 0, dev->hard_header_len - len);
            return true;
        }
    
    Packet send paths call dev_validate_header() on skbs whose headroom was
    allocated from an earlier hard_header_len read. If the device is
    reconfigured so that dev->hard_header_len increases before validation,
    the memset writes past the reserved buffer, an out-of-bounds write.
    
    This out-of-bounds write is masked in some SOCK_RAW paths today because
    the same concurrent increase can first make skb_push() exceed the
    reserved headroom and trigger skb_under_panic(). Remove the zero-padding
    branch before making those hard_header_len reads consistent, so the
    snapshot fixes do not turn a loud panic into a silent overwrite.
    
    This path is only reached for variable length L2 protocols, where
    len < hard_header_len but len >= min_header_len. No remaining in-tree
    variable length L2 protocol implements header_ops->validate, and the
    CAP_SYS_RAWIO bypass that zero-pads and accepts short headers has no
    real value beyond allowing testing of intentionally malformed input.
    
    Drop the CAP_SYS_RAWIO branch. The remaining reads of
    dev->hard_header_len in dev_validate_header() are comparisons only and
    have no memory safety impact.
    
    Suggested-by: Willem de Bruijn <willemb@google.com>
    Fixes: 2793a23aacbd ("net: validate variable length ll headers")
    Cc: stable@vger.kernel.org
    Signed-off-by: Qihang Tang <q.h.hack.winter@gmail.com>
    Reviewed-by: Willem de Bruijn <willemb@google.com>
    Link: https://patch.msgid.link/20260805125729.19220-2-q.h.hack.winter@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: remove WARN_ON_ONCE() from sk_mc_loop() [+ + +]
Author: Eric Dumazet <edumazet@google.com>
Date:   Tue Aug 4 15:20:48 2026 +0000

    net: remove WARN_ON_ONCE() from sk_mc_loop()
    
    [ Upstream commit b8a39a09ae4eaae04309e1e38ed6a1101d967496 ]
    
    sk_mc_loop() can be called for sockets that are neither AF_INET
    nor AF_INET6 (e.g. AF_PACKET sockets when sending packets via raw/packet
    socket over virtual devices such as VRF or ipvlan).
    
    In such cases, sk_family is not AF_INET/AF_INET6 and sk_mc_loop() falls
    through the switch statement and triggers WARN_ON_ONCE(1).
    
    Non-INET sockets do not support IP_MULTICAST_LOOP or IPV6_MULTICAST_LOOP
    options, so loopback should default to true without generating a warning.
    
    Fixes: f60e5990d9c1 ("ipv6: protect skb->sk accesses from recursive dereference inside the stack")
    Reported-by: syzbot+22c3218a6fa219e47321@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/netdev/6a72024c.13623e66.bdc14.0019.GAE@google.com/T/#u
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Link: https://patch.msgid.link/20260804152048.2134341-1-edumazet@google.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: smc: fix splice entry lifetime imbalance in smc_rx_splice [+ + +]
Author: Daming Li <d4n.for.sec@gmail.com>
Date:   Thu Jul 30 22:55:52 2026 +0800

    net: smc: fix splice entry lifetime imbalance in smc_rx_splice
    
    commit 5d9686af2976741bbd79b150d1c9e60b81e7f12e upstream.
    
    smc_rx_splice() passes pages to splice_to_pipe() before taking the
    references that cover the lifetime of each splice entry. In the
    VM-backed RMB path, splice_to_pipe() may drop unqueued entries through
    smc_rx_spd_release(), while queued entries are released later via the
    pipe buffer callback.
    
    The old post-splice accounting also derives the number of queued VM pages
    from an offset mutated while building the descriptor, and a multi-page
    splice pairs one sock_hold() with multiple sock_put() calls.
    
    Take the page and socket references for every candidate entry before
    splice_to_pipe(), and drop the matching private state, page reference,
    and socket reference from smc_rx_spd_release() for entries that never
    get queued. This fixes a refcount imbalance that can underflow page
    refcounts and trigger a use-after-free.
    
    Fixes: 9014db202cb7 ("smc: add support for splice()")
    Cc: stable@vger.kernel.org
    Reported-by: Vega <vega@nebusec.ai>
    Co-developed-by: Xiao Liu <lx24@stu.ynu.edu.cn>
    Signed-off-by: Xiao Liu <lx24@stu.ynu.edu.cn>
    Signed-off-by: Daming Li <d4n.for.sec@gmail.com>
    Signed-off-by: Ren Wei <enjou1224z@gmail.com>
    Reviewed-by: Dust Li <dust.li@linux.alibaba.com>
    Reviewed-by: Sidraya Jayagond <sidraya@linux.ibm.com>
    Link: https://patch.msgid.link/20260730145552.360287-2-enjou1224z@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: thunderbolt: Tear down DMA paths before stopping the rings [+ + +]
Author: Fan XinRan <shinjiangjiang@gmail.com>
Date:   Mon Aug 3 14:38:50 2026 +0000

    net: thunderbolt: Tear down DMA paths before stopping the rings
    
    [ Upstream commit 68bf02b6b4ad3f748c6db71fd77b6c0402d252f4 ]
    
    tbnet_tear_down() stops both rings and frees their frame buffers before
    calling tb_xdomain_disable_paths().  tb_ring_stop() zeroes the ring's
    descriptor base and tbnet_free_buffers() unmaps and frees the pages the
    frames sit in, so by the time __tb_path_deactivate_hop() polls the hop's
    'pending' bit, anything still in flight has nowhere to drain to.
    
    The teardown sequence has been in this order since the driver was added.
    The setup path has not: commit ff7cd07f3064 ("net: thunderbolt: Enable
    DMA paths only after rings are enabled") moved the path enable to the end
    of tbnet_connected_work() and documented why:
    
            /* Both logins successful so enable the rings, high-speed DMA
             * paths and start the network device queue.
             *
             * Note we enable the DMA paths last to make sure we have primed
             * the Rx ring before any incoming packets are allowed to
             * arrive.
             */
    
    Teardown was never updated to match, so the rings and the paths now come
    down in the same order they go up instead of in reverse.
    
    On an ASMedia ASM4242 host router the 'pending' bit then never clears:
    every teardown burns the full 500 ms timeout and
    __tb_path_deactivate_hop() returns -ETIMEDOUT.  Raising the timeout to
    5 s does not help, so the hop is not slow to drain, it never drains
    at all.
    
    The failure is invisible above the thunderbolt core.
    __tb_path_deactivate_hops() is void and only calls tb_port_warn();
    tb_path_deactivate(), tb_tunnel_deactivate() and
    __tb_disconnect_xdomain_paths() are void as well, and
    tb_disconnect_xdomain_paths() ends in an unconditional "return 0".  So
    tb_xdomain_disable_paths() reports success and the netdev_warn() below
    it never fires.  Repeated teardowns eventually take the XDomain control
    channel down, after which the peer node is gone and only a power cycle
    brings the controller back.
    
    Deactivating the paths first fixes it.  Measured with kretprobes on a
    stock v6.17 tree with no other patches applied, on a link that was up
    and had just carried traffic:
    
      before: __tb_path_deactivate_hop() returns 0 for the first hop, then
              -ETIMEDOUT for the second 500335 us later
      after:  0 for both, 525 us apart
    
    Alternating the two orderings ABBA over three load levels, four
    teardowns per arm: every teardown failed before the change (21 of 21
    that ran), none failed after (0 of 24).  The before arms ran short
    because the link died partway through.  The same split shows up when
    the interface is enslaved to a bond instead of just brought down, which
    is how I ran into this in the first place.  Throughput and latency after
    the change are unchanged.
    
    Hosts whose routers drain the hop despite the stale descriptor base see
    no functional difference, since the paths end up deactivated either way.
    
    Fixes: e69b6c02b4c3 ("net: Add support for networking over Thunderbolt cable")
    Signed-off-by: Fan XinRan <shinjiangjiang@gmail.com>
    Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Link: https://patch.msgid.link/20260803-b4-tbnet-teardown-v2-1-27de6a13ca2d@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: usb: ax88179_178a: fix skb leak in ax88179_tx_fixup() [+ + +]
Author: Yi Cong <yicong@kylinos.cn>
Date:   Wed Jul 29 11:04:36 2026 +0800

    net: usb: ax88179_178a: fix skb leak in ax88179_tx_fixup()
    
    commit 1f428e30947395d9b9aacee03e25a4e6cfcad7a4 upstream.
    
    When the interface has NETIF_F_SG enabled and skb_linearize() fails in
    ax88179_tx_fixup(), the function returns NULL without freeing the skb.
    
    usbnet_start_xmit() treats a NULL return from tx_fixup() as a drop
    (info->flags does not set FLAG_MULTI_PACKET for this driver), jumping
    to the "drop" label where it does `if (skb) dev_kfree_skb_any(skb)`.
    Because tx_fixup() returned NULL, the local skb variable in
    usbnet_start_xmit() is NULL, so the original skb is never freed — a
    memory leak on every TX frame whose linearization fails (i.e. under
    memory pressure).
    
    Free the skb before returning, matching the error handling already used
    for the pskb_expand_head() failure path in the same function.
    
    Fixes: 16b1c4e01c89 ("net: usb: ax88179_178a: add TSO feature")
    Cc: stable@vger.kernel.org
    Signed-off-by: Yi Cong <yicong@kylinos.cn>
    Link: https://patch.msgid.link/20260729030436.3420477-1-cong.yi@linux.dev
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: usb: ipheth: fix carrier_work UAF on disconnect [+ + +]
Author: Doruk Tan Ozturk <doruk@0sec.ai>
Date:   Sun Aug 2 14:06:02 2026 +0200

    net: usb: ipheth: fix carrier_work UAF on disconnect
    
    commit fde39b8a521780391fb4e5bda2c0aa4928947f12 upstream.
    
    ipheth_sndbulk_callback() re-arms the carrier-check work on any
    non-zero URB status:
    
            else
                    schedule_delayed_work(&dev->carrier_work, 0);
    
    Nothing ties that to the interface being up, so the work can be armed
    again after ipheth_close() has already drained it, and stay armed
    until the netdev whose private area embeds it is freed.
    
    On unplug with a TX URB in flight, ipheth_disconnect() drains the work
    through unregister_netdev() -> ipheth_close() ->
    cancel_delayed_work_sync() and only then calls ipheth_kill_urbs().
    usb_kill_urb() completes the in-flight TX URB with -ENOENT, so
    ipheth_sndbulk_callback() runs after the drain and re-arms
    carrier_work.
    
    The same completion also re-arms the work if the interface is only
    brought down while a TX URB is in flight, and
    ipheth_carrier_check_work() then keeps re-queueing itself once a
    second. unregister_netdev() does not call ipheth_close() for an
    already-down interface, so nothing drains it on the later unplug
    either.
    
    In both cases free_netdev() frees the netdev while carrier_work is
    still pending, and ipheth_carrier_check_work() dereferences freed
    memory.
    
    Tie the work to the interface state instead of chasing the completion:
    disable it in ipheth_close() and enable it in ipheth_open(), so a
    schedule_delayed_work() from the URB completion is a no-op whenever
    the interface is not up. disable_delayed_work_sync() also waits for a
    running instance, so it fully replaces the cancel_delayed_work_sync()
    it takes the place of. The work starts out disabled in ipheth_probe()
    so the enable/disable counts balance from the first open.
    
    Reproduced under KASAN on linux-next (next-20260731) with dummy_hcd and
    raw-gadget standing in for the device, driving the second path above (the
    interface is already down, so unregister_netdev() does not call
    ipheth_close()): 15 of 15 unpatched boots report a slab-use-after-free in
    __run_timers(), freed by ipheth_disconnect() and re-armed from
    ipheth_sndbulk_callback() via queue_delayed_work_on(). The
    same trigger on a kernel differing only by this patch reports 0 of 15,
    and the carrier check still functions across open/close cycles.
    
    The reproducer needs an attached USB device that stops draining bulk OUT,
    plus a link down and unplug, driven as root. It is not a privilege
    boundary crossing and no exploit primitive was developed.
    
    Found by 0sec (https://0sec.ai).
    
    Fixes: bb1b40c7cb86 ("usbnet: ipheth: prevent TX queue timeouts when device not ready")
    Cc: stable@vger.kernel.org
    Signed-off-by: Doruk Tan Ozturk <doruk@0sec.ai>
    Link: https://patch.msgid.link/20260802120602.42595-1-doruk@0sec.ai
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
netfilter: bridge: release template ct on non-IP path [+ + +]
Author: Zhiling Zou <zhilinz@nebusec.ai>
Date:   Fri Jul 31 14:36:53 2026 +0800

    netfilter: bridge: release template ct on non-IP path
    
    commit d45cc8020d7c0a9f01dee42ff5c40bc14c9af72f upstream.
    
    A bridge nftables ct zone set rule can attach a conntrack template to
    an skb before nf_ct_bridge_pre() sees it. For non-IPv4 and non-IPv6
    EtherTypes, nf_ct_bridge_pre() currently overwrites skb->_nfct with
    IP_CT_UNTRACKED without releasing the existing template reference.
    
    That makes the per-cpu template, and any temporary templates allocated
    for concurrent use, unreachable and leaks memory until the host runs out
    of slab.
    
    Reset the skb conntrack state before marking the frame untracked so the
    existing template reference is dropped on the non-IP path.
    
    Fixes: 3c171f496ef5 ("netfilter: bridge: add connection tracking system")
    Cc: stable@vger.kernel.org
    Reported-by: Vega <vega@nebusec.ai>
    Signed-off-by: Zhiling Zou <zhilinz@nebusec.ai>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

netfilter: ebt_nflog: pin the NFLOG backend [+ + +]
Author: Chengfeng Ye <nicoyip.dev@gmail.com>
Date:   Thu Jul 30 01:31:00 2026 +0800

    netfilter: ebt_nflog: pin the NFLOG backend
    
    commit 30825970339c107bacaf7f61af90fcdb1f597ca1 upstream.
    
    nf_log_unregister() runs after the per-net teardown so its final RCU
    grace period also drains readers that obtained the logger from a per-net
    binding.  However, ebt_nflog passes an explicit ULOG log type to
    nf_log_packet() without holding a reference on the selected logger module,
    unlike the xt_NFLOG and nft_log frontends.
    
    An ebtables nflog rule can therefore remain callable while nfnetlink_log
    is unloaded.  The resulting interleaving is:
    
      CPU 0                               CPU 1
      nfnetlink_log_fini()
        unregister_pernet_subsys()
          kfree(nfnl_log_pernet(net))
                                          ebt_nflog_tg()
                                            nf_log_packet()
                                              nfulnl_log_packet()
                                                instance_lookup_get_rcu()
    
    The global ULOG logger is still registered at this point, so CPU 1
    dereferences the per-net state after CPU 0 has freed it.  KASAN reported:
    
      BUG: KASAN: slab-use-after-free in instance_lookup_get_rcu
      Read of size 8 at addr ff110001052e6210 by task poc/92
      Call Trace:
       instance_lookup_get_rcu+0x1ce/0x1f0 [nfnetlink_log]
       nfulnl_log_packet+0x248/0x2fb0 [nfnetlink_log]
       nf_log_packet+0x204/0x300
       ebt_nflog_tg+0x351/0x550
       ebt_do_table+0xedf/0x22b0
      Allocated by task 90:
       __kmalloc_noprof+0x186/0x470
       ops_init+0x6d/0x420
       register_pernet_operations+0x2f6/0x670
       register_pernet_subsys+0x23/0x40
      Freed by task 93:
       kfree+0x131/0x3c0
       ops_undo_list+0x3e3/0x700
       unregister_pernet_operations+0x232/0x490
       unregister_pernet_subsys+0x1c/0x30
       nfnetlink_log_fini+0x34/0x450 [nfnetlink_log]
    
    Acquire the ULOG logger module reference when an ebt_nflog rule is
    validated and release it when the rule is destroyed.  Request the NFLOG
    backend for legacy callers when needed, matching xt_NFLOG.  This prevents
    module teardown until all ebt_nflog rules have stopped using the logger.
    
    Fixes: c83fa19603bd ("netfilter: nf_log: don't call synchronize_rcu in nf_log_unset")
    Cc: stable@vger.kernel.org
    Signed-off-by: Chengfeng Ye <nicoyip.dev@gmail.com>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

netfilter: ipset: switch ext_size to atomic64_t [+ + +]
Author: Jozsef Kadlecsik <kadlec@netfilter.org>
Date:   Thu Jul 30 20:38:50 2026 +0200

    netfilter: ipset: switch ext_size to atomic64_t
    
    [ Upstream commit 712a6f545c359b427daa9a5a782e30d2f8331e25 ]
    
    The hash types do not acquire set->lock, they use 'region locking' where
    only part of the hash table is locked. Parallel inserts and deletes are
    possible and CPUs can race on ->ext_size update.  Switch to atomic64_t.
    
    This leaves another bug unresolved: there still can be a race on
    comment extension re-init.  This will be handled in a later commit
    when converting to rhashtable backend.
    
    Fixes: f66ee0410b1c ("netfilter: ipset: Fix "INFO: rcu detected stall in hash_xxx" reports")
    Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org>
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

netfilter: nf_conntrack: defer invalid log until after unlock [+ + +]
Author: Zihan Xi <zihanx@nebusec.ai>
Date:   Sat Aug 1 14:27:17 2026 +0000

    netfilter: nf_conntrack: defer invalid log until after unlock
    
    commit 2d19b95c9723001f214f7a47d67b09f46238f200 upstream.
    
    TCP and SCTP conntrack paths can emit invalid-packet logs while ct->lock
    is still held.
    
    When invalid logging is routed to nfnetlink_log and conntrack export is
    enabled, the log path can re-enter conntrack netlink glue and dump the
    same conntrack again. Protocol attribute dumping may take ct->lock, so
    logging while holding that lock can deadlock.
    
    Defer the TCP invalid logs by storing only the minimal log context while
    ct->lock is held and emitting the log after unlocking. Also make the TCP
    timeout-lowering invalid path return whether a log is needed, then emit
    that log after unlocking.
    
    Do the same for the SCTP invalid state-transition log that can be reached
    while ct->lock is held.
    
    Add a lockdep assertion to nf_ct_l4proto_log_invalid() so future callers
    that log invalid conntracks while holding ct->lock are caught outside TCP
    and SCTP as well.
    
    Fixes: 628d694344a0 ("netfilter: conntrack: reduce timeout when receiving out-of-window fin or rst")
    Fixes: d9a6f0d0df18 ("netfilter: conntrack: prepare tcp_in_window for ternary return value")
    Fixes: f71cb8f45d09 ("netfilter: conntrack: sctp: use nf log infrastructure for invalid packets")
    Cc: stable@vger.kernel.org
    Reported-by: Vega <vega@nebusec.ai>
    Assisted-by: Codex:gpt-5.4
    Signed-off-by: Zihan Xi <zihanx@nebusec.ai>
    Reviewed-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
NFS: Pin the 'struct nfs_server' during a FREE_STATEID call [+ + +]
Author: Anna Schumaker <anna.schumaker@hammerspace.com>
Date:   Tue Jun 30 14:31:00 2026 -0400

    NFS: Pin the 'struct nfs_server' during a FREE_STATEID call
    
    [ Upstream commit cf616096a0f3a2b60f7d68b6b39674a6867ded9c ]
    
    Dan Aloni reports that he was able to hit a use-after-free bug if a
    FREE_STATEID operation gets delayed for whatever reason. Fix this by
    bumping the refcount of the 'struct nfs_server' object for the duration
    of the FREE_STATEID so it doesn't get cleaned up from underneath us
    while operations are still in flight.
    
    Reported-by: Dan Aloni <dan.aloni@vastdata.com>
    Fixes: 7c1d5fae4a87 ("NFSv4: Convert nfs41_free_stateid to use an asynchronous RPC call")
    Tested-by: Dan Aloni <dan.aloni@vastdata.com>
    Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
nvmem: layouts: Add fixed-layout driver [+ + +]
Author: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Date:   Fri Jul 24 23:34:04 2026 +0100

    nvmem: layouts: Add fixed-layout driver
    
    commit b5be879519291f139fa7b365fd0dbc84710e4919 upstream.
    
    Current implementation isn't working well when device tree nodes have a
    phandle on a fixed-layout nvmem node. As the fixed layout is handled in
    nvmem core, no driver is ever associated with the layout, and the device
    consumer driver probe is deferred indefinitely.
    
    Remove the specific handling of fixed-layout and add a layout driver.
    This makes the fixed-layout similar to all other layouts, fixing the
    whole issue.
    
    Fixes: fc29fd821d9a ("nvmem: core: Rework layouts to become regular devices")
    Cc: stable@vger.kernel.org
    Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
    Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
    Link: https://patch.msgid.link/20260724223404.629248-3-srini@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ovl: don't warn when the mount is completed from another user namespace [+ + +]
Author: Christian Brauner <brauner@kernel.org>
Date:   Sun Aug 2 20:00:43 2026 +0200

    ovl: don't warn when the mount is completed from another user namespace
    
    commit 63981fc786daaa626cb14d9be1406f674d79f98f upstream.
    
    fsopen() records the caller's user namespace in fc->user_ns and hands
    back an ordinary file descriptor. Nothing ties the task that calls
    fsconfig(FSCONFIG_CMD_CREATE) to the task that created the context. The
    fd is inherited across fork() and exec() and it can be passed over a
    unix socket.
    
    Completing a context from another user namespace is allowed on purpose.
    vfs_cmd_create() authorizes the create with mount_capable(), which for
    FS_USERNS_MOUNT checks ns_capable(fc->user_ns, CAP_SYS_ADMIN), and that
    succeeds for a task holding CAP_SYS_ADMIN in an ancestor of fc->user_ns.
    So an unprivileged task can reach the WARN_ON() in ovl_fill_super():
    create a user and a mount namespace in a child, call fsopen("overlay")
    there, send the fscontext fd to the parent and let the parent issue
    FSCONFIG_CMD_CREATE. Both namespaces come from a plain unshare(1) and no
    capability is needed anywhere:
    
      WARNING: fs/overlayfs/super.c:1551 at ovl_fill_super+0x7b9/0x1e20 [overlay]
      CPU: 3 UID: 1000 PID: 3243376 Comm: fswarn
      Call Trace:
       get_tree_nodev+0x71/0xa0
       ovl_get_tree+0x15/0x20 [overlay]
       vfs_get_tree+0x2a/0x100
       vfs_cmd_create+0x60/0xf0
       __do_sys_fsconfig+0x4b2/0x500
    
    The child needs the mount namespace because fsopen() itself gates on
    may_mount(), which asks for CAP_SYS_ADMIN in the user namespace owning
    the caller's mount namespace. fsconfig() doesn't repeat that check.
    
    It is a WARN_ON() and not a WARN_ON_ONCE(), so the condition can be
    raised in a loop to taint the kernel and flood the log, and it panics a
    kernel booted with panic_on_warn.
    
    Keep refusing the mount and stop warning about it. ovl_parse_param()
    already spells a user namespace check this way for Opt_override_creds.
    
    Fixes: 1784fbc2ed9c ("ovl: port to new mount api")
    Cc: stable@vger.kernel.org # v6.5+
    Link: https://patch.msgid.link/20260802-work-fill_super-warn-v1-1-4e987911a39a@kernel.org
    Reviewed-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
packet: synchronize pressure clearing with ring reconfiguration [+ + +]
Author: Zihan Xi <zihanx@nebusec.ai>
Date:   Wed Jul 29 09:16:53 2026 +0000

    packet: synchronize pressure clearing with ring reconfiguration
    
    commit 1a35da325cac4d5bcad76a2aa943408a6f1d9000 upstream.
    
    packet_set_ring() updates the RX ring state under sk_receive_queue.lock,
    but used to publish the tpacket receive mode through po->prot_hook.func
    after releasing that lock. packet_poll() and packet_recvmsg() can then
    run the pressure clearing path after the ring has been cleared while
    still seeing tpacket_rcv, causing __packet_rcv_has_room() to dereference
    stale or NULL ring storage.
    
    Move the existing receive hook assignment into the same
    sk_receive_queue.lock section as the ring state update. Keep the
    assignment otherwise unchanged, including on TX ring reconfiguration, to
    avoid adding behavior changes that are not required for the fix.
    
    Serialize packet_recvmsg() pressure clearing with the same queue lock
    only after PACKET_SOCK_PRESSURE has been observed. If the flag is clear
    and the socket has moved away from tpacket_rcv, packet_set_ring() has
    already detached the socket and waited for synchronize_net(), so no new
    packet input can set the flag again.
    
    packet_poll() already holds sk_receive_queue.lock, so it uses the new
    unlocked helper directly.
    
    Fixes: 2ccdbaa6d55b ("packet: rollover lock contention avoidance")
    Cc: stable@vger.kernel.org
    Reported-by: Vega <vega@nebusec.ai>
    Assisted-by: Codex:gpt-5.4
    Signed-off-by: Zihan Xi <zihanx@nebusec.ai>
    Link: https://patch.msgid.link/f90b5688311fa278d1361ea8c6be0bf25967d591.1785247446.git.zihanx@nebusec.ai
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

packet: use consistent hard_header_len in non-ring send paths [+ + +]
Author: Qihang Tang <q.h.hack.winter@gmail.com>
Date:   Wed Aug 5 20:57:28 2026 +0800

    packet: use consistent hard_header_len in non-ring send paths
    
    commit 03390aa32e669cc4ecd7d34108e2e1afc13d689d upstream.
    
    packet_snd() reads dev->hard_header_len multiple times while allocating
    and constructing an skb. Device reconfiguration can change this value
    concurrently, for example through bonding device type changes.
    
    For SOCK_RAW, packet_snd() can save a larger value in reserve and later
    allocate headroom using a smaller value. Moving skb->data back by reserve
    then places it before skb->head, and the following copy from userspace can
    attempt an out-of-bounds write.
    
    packet_sendmsg_spkt() has the same issue because it calculates its
    reservation and header offset from separate reads before dropping the RCU
    read lock to allocate the skb.
    
    Add LL_RESERVED_SPACE_EX() for callers that already saved a header length.
    Read hard_header_len once in packet_snd() and use it for allocation and
    construction. In packet_sendmsg_spkt(), preserve the allocation-time value
    through the device lookup retry.
    
    The separate SOCK_DGRAM consistency problem between hard_header_len and
    header_ops->create is not addressed here.
    
    Fixes: b84bbaf7a6c8 ("packet: in packet_snd start writing at link layer allocation")
    Cc: stable@vger.kernel.org
    Signed-off-by: Qihang Tang <q.h.hack.winter@gmail.com>
    Reviewed-by: Willem de Bruijn <willemb@google.com>
    Link: https://patch.msgid.link/20260805125729.19220-3-q.h.hack.winter@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

packet: use consistent hard_header_len in TX_RING send path [+ + +]
Author: Qihang Tang <q.h.hack.winter@gmail.com>
Date:   Wed Aug 5 20:57:29 2026 +0800

    packet: use consistent hard_header_len in TX_RING send path
    
    commit 21b5953e7494c16a42e6cd8cf110e18d13ae4a6b upstream.
    
    tpacket_snd() reads dev->hard_header_len independently for skb
    allocation and header construction in tpacket_fill_skb(). Concurrent
    netdevice reconfiguration can therefore make the reserved headroom
    smaller than the amount later pushed, or make copylen - hard_header_len
    negative.
    
    Snapshot hard_header_len once before processing ring frames and use it
    for the frame limit, headroom allocation, copy length, and skb
    construction. Pass the snapshot to tpacket_fill_skb().
    
    The separate SOCK_DGRAM consistency problem between hard_header_len and
    header_ops->create is not addressed here.
    
    Fixes: 69e3c75f4d54 ("net: TX_RING and packet mmap")
    Cc: stable@vger.kernel.org
    Signed-off-by: Qihang Tang <q.h.hack.winter@gmail.com>
    Reviewed-by: Willem de Bruijn <willemb@google.com>
    Link: https://patch.msgid.link/20260805125729.19220-4-q.h.hack.winter@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
pds_core: cancel pending PCI reset work on AER recovery [+ + +]
Author: Nikhil P. Rao <nikhil.rao@amd.com>
Date:   Mon Jul 27 17:00:30 2026 +0000

    pds_core: cancel pending PCI reset work on AER recovery
    
    [ Upstream commit 57d635329d799b79096155cdf47ee0013d6780d1 ]
    
    pdsc_check_pci_health() queues pci_reset_work when it sees a broken PCI
    connection, and nothing cancels it. When the PCI core starts AER
    recovery, pdsc_pci_error_detected() runs pdsc_reset_prepare() and
    recovers the device, but a pci_reset_work queued just before is left
    pending. If it runs after recovery released the device lock, it resets a
    device the driver now considers healthy, bouncing the link for no reason.
    
    Cancel pci_reset_work in pdsc_pci_error_detected() after
    pdsc_reset_prepare(), which has already stopped the health thread so it
    cannot requeue the work. cancel_work_sync() is safe under the device
    lock here because pdsc_pci_reset_thread() uses pci_try_reset_function(),
    which returns instead of blocking on the lock. Only PFs initialize
    pci_reset_work, so guard the cancel with !is_virtfn.
    
    Fixes: 81665adf25d2 ("pds_core: Fix pdsc_check_pci_health function to use work thread")
    Reported-by: sashiko-bot <sashiko-bot@kernel.org>
    Closes: https://sashiko.dev/#/patchset/20260714180223.1642792-2-nikhil.rao%40amd.com?part=1
    Signed-off-by: Nikhil P. Rao <nikhil.rao@amd.com>
    Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
    Link: https://patch.msgid.link/20260727170030.361116-1-nikhil.rao@amd.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

pds_core: keep the health thread stopped during reset [+ + +]
Author: Nikhil P. Rao <nikhil.rao@amd.com>
Date:   Mon Jul 27 16:45:48 2026 +0000

    pds_core: keep the health thread stopped during reset
    
    [ Upstream commit cd09971dcc1c499ae0879010a00e9dba87abdc4f ]
    
    Commit d9407ff11809 ("pds_core: Prevent health thread from running
    during reset/remove") stops the health thread with cancel_work_sync()
    before a reset, but a devcmd timeout during pdsc_fw_down() re-queues
    health_work, so pdsc_health_thread() runs again mid-reset and double
    allocates the core DMA queues via pdsc_fw_up().
    
    Only the reset path is affected: on remove PDSC_S_STOPPING_DRIVER gates
    the health thread and the workqueue is destroyed.
    
    Use disable_work_sync() to cancel health_work and block further
    queue_work() on it, and enable_work() in pdsc_restart_health_thread() to
    re-allow it after the reset.
    
    disable_work_sync() keeps a disable depth, so every disable must be
    matched by one enable. pdsc_reset_prepare() stops the health thread and
    pdsc_reset_done() restarts it. On the AER path pdsc_pci_error_detected()
    calls pdsc_reset_prepare(), then pdsc_pci_error_resume() re-inits via
    pci_reset_function_locked() (pds_core has no .slot_reset handler), which
    runs the pair again - stopping the thread twice but restarting it once.
    Gate the disable and enable on a health_stopped flag so each fires at
    most once per stopped/running transition.
    
    Fixes: d9407ff11809 ("pds_core: Prevent health thread from running during reset/remove")
    Reported-by: sashiko-bot <sashiko-bot@kernel.org>
    Closes: https://sashiko.dev/#/patchset/20260629200358.2626129-1-nikhil.rao%40amd.com?part=2
    Signed-off-by: Nikhil P. Rao <nikhil.rao@amd.com>
    Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
    Link: https://patch.msgid.link/20260727164548.359562-1-nikhil.rao@amd.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
pinctrl: renesas: rzg2l: Use -ENOTSUPP instead of -EOPNOTSUPP [+ + +]
Author: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Date:   Fri Aug 14 17:35:52 2026 +0300

    pinctrl: renesas: rzg2l: Use -ENOTSUPP instead of -EOPNOTSUPP
    
    commit c1492da3939c89372929e062d731f328f7693f1e upstream.
    
    The pinctrl and GPIO core code make exceptions for the -ENOTSUPP error
    code.  One such example is gpio_set_config_with_argument_optional(),
    which returns success when gpio_set_config_with_argument() returns
    -ENOTSUPP, but reports failure for all other error codes.
    
    Returning -EOPNOTSUPP from the pinctrl driver on the unsupported pinctrl
    operation may lead to boot failures when pinctrl drivers implements
    struct gpio_chip::set_config, the system uses GPIO hogs, and the
    struct gpio_chip::set_config implementation returns -EOPNOTSUPP for the
    unsupported operations.
    
    Return -ENOTSUPP for the unsupported pinctrl operation.
    
    Fixes: 560c633d378a ("pinctrl: renesas: rzg2l: Drop oen_read and oen_write callbacks")
    Fixes: c4c4637eb57f ("pinctrl: renesas: Add RZ/G2L pin and gpio controller driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
    Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
    Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Link: https://patch.msgid.link/20260515124008.2947838-2-claudiu.beznea@kernel.org
    Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
    [claudiu.beznea: fixed conflict by keeping the code v6.12 stable]
    Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ptp: ocp: Fix board ID over-read [+ + +]
Author: Ahmad Byagowi <ahmadexp@gmail.com>
Date:   Tue Aug 4 14:07:51 2026 -0700

    ptp: ocp: Fix board ID over-read
    
    commit 6b69f2ef10cdb018c0b127a7cab88e590bbddba4 upstream.
    
    The EEPROM board ID is a fixed 13-byte field and is not guaranteed to
    contain a NUL terminator. Passing it directly to
    devlink_info_version_fixed_put() treats it as a C string and may read
    beyond the field.
    
    Format at most OCP_BOARD_ID_LEN bytes into the existing local buffer
    before reporting the ID. Use a precision limit because the snprintf()
    output size alone does not bound the source string scan.
    
    Fixes: 0cfcdd1ebcfe ("ptp: ocp: add nvmem interface for accessing eeprom")
    Cc: stable@vger.kernel.org
    Signed-off-by: Ahmad Byagowi <ahmadexp@gmail.com>
    Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
    Link: https://patch.msgid.link/20260804210751.48248-1-ahmadexp@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Revert "drm/amdgpu: fix aperture mapping leak" [+ + +]
Author: Asad Kamal <asad.kamal@amd.com>
Date:   Thu Jul 30 15:00:00 2026 +0800

    Revert "drm/amdgpu: fix aperture mapping leak"
    
    commit b96c529cd2551b78316a4afa3237b2ed96ba03c8 upstream.
    
    devres teardown is LIFO. The aperture devres node was registered after
    the DRM device node, so devres_release_all() unmaps the aperture before
    the DRM device release callback fires amdgpu_device_fini_sw(). IP
    sw_fini callbacks (e.g. vcn_v4_0_sw_fini) write to fw_shared through a
    pointer derived from aper_base_kaddr, causing a kernel page fault on
    probe failure / rollback:
    
      BUG: unable to handle page fault ... PMD 0
      RIP: vcn_v4_0_sw_fini+0x7b/0x170 [amdgpu]
      Call Trace:
        amdgpu_device_fini_sw
        amdgpu_driver_release_kms
        devm_drm_dev_init_release
        devres_release_all
    
    This reverts commit d871e99879cb5fd1fa798b006b4888887e63a17a.
    
    Fixes: d871e99879cb ("drm/amdgpu: fix aperture mapping leak")
    Reported-by: Yuansheng Mao <yuansheng.mao@amd.com>
    Signed-off-by: Asad Kamal <asad.kamal@amd.com>
    Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
    Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 336e0cd576817ac64a4b394ca2b3680029f3e37f)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Revert "net: thunderbolt: Enable end-to-end flow control also in transmit" [+ + +]
Author: Fan Ye <fy15309206903@gmail.com>
Date:   Mon Jul 27 12:29:48 2026 +0000

    Revert "net: thunderbolt: Enable end-to-end flow control also in transmit"
    
    [ Upstream commit 1881f2efbf7f78dc0a79a387b29fde6ff56d3731 ]
    
    This reverts commit a8065af3346ebd7c76ebc113451fb3ba94cf7769.
    
    Per the USB4 spec, a Transmit Descriptor Ring with E2E flow control
    disabled does not require any credits to be available before the Host
    Interface Adapter Layer transmits a tunneled packet from it. Once E2E is
    enabled on that ring the controller must first obtain end-to-end
    credits.
    
    The ASMedia ASM4242 USB4 host router (PCI 1b21:2425) never delivers
    those credits. The controller does accept the configuration: reading the
    ring OPTIONS register back right after tb_ring_start() returns exactly
    what was written, including RING_FLAG_E2E_FLOW_CONTROL (bit 28) and the
    E2E HopID field. No credit ever arrives though, so the Tx ring's
    hardware consumer index never advances and the link carries no traffic
    at all.
    
    Measured on two hosts connected point to point, onboard ASM4242 on MSI
    X870E and X870, v6.17, stock drivers/net/thunderbolt/main.c with only
    this revert applied on top:
    
      before: 100% packet loss to the peer; thunderbolt0 is up and the
              XDomain handshake completes ("new host found"), but iperf3
              fails with "No route to host" once the neighbour entry
              expires
      after:  0% packet loss, 0.28 ms RTT; iperf3 4.21 Gb/s one way and
              5.17 Gb/s the other (5 runs each, stddev <= 0.02), 1
              retransmit in 10 s
    
    An instrumented build additionally showed a frozen-Tx-consumer watchdog
    firing ~30k times in a 10 s window before this change.
    
    Rx-side E2E is not touched by this revert, so peers that do return
    credits keep receive-side flow control.
    
    ASMedia does not look like an isolated case. The out-of-tree
    thunderbolt-ibverbs project disables native E2E on AMD NHI by default,
    noting that "Strix Halo has reproduced TX completion wedges with
    multiple native E2E rings active" -- the same failure mode, on a
    different vendor. Since the driver has no way to tell in advance which
    host router returns the credits, going back to the previous behaviour
    looks safer than adding a quirk per affected part; Tx-side E2E can be
    reintroduced as an opt-in for controllers that are known to implement
    the credit return.
    
    Note that the reverted commit was not fixing a reported problem, it was
    derived from the spec wording alone, so this revert is not expected to
    regress a known workload. Cc'ing the original author in case there was
    one.
    
    Fixes: a8065af3346e ("net: thunderbolt: Enable end-to-end flow control also in transmit")
    Cc: zhangjianrong <zhangjianrong5@huawei.com>
    Signed-off-by: Fan Ye <fy15309206903@gmail.com>
    Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Link: https://patch.msgid.link/20260727123002.25225-1-fy15309206903@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
Revert "thermal/drivers/hwmon: Cleanup coding style a bit" [+ + +]
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Tue Aug 4 22:09:10 2026 +0200

    Revert "thermal/drivers/hwmon: Cleanup coding style a bit"
    
    commit ff8da20b6f47c48d46e47f93f7a59e2d56ee9107 upstream.
    
    Revert commit 030a48b0f6ce ("thermal/drivers/hwmon: Cleanup coding style
    a bit") that introduced a use-after-free into the error path of
    thermal_add_hwmon_sysfs() by removing a valid check from it.
    
    Link: https://lore.kernel.org/linux-hwmon/20260803183915.4ED7D1F000E9@smtp.kernel.org/
    Cc: All applicable <stable@vger.kernel.org>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
    Link: https://patch.msgid.link/5123895.31r3eYUQgx@rafael.j.wysocki
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ring-buffer: Fix crash passing ERR_PTR to kthread_stop() [+ + +]
Author: Hui Su <sh_def@163.com>
Date:   Fri Aug 7 23:41:46 2026 +0800

    ring-buffer: Fix crash passing ERR_PTR to kthread_stop()
    
    commit 91542863abade2fd4f2b361991f5386ad9d19c8c upstream.
    
    In test_ringbuffer()'s out_free cleanup loop, the check
    `!rb_threads[cpu]` only catches NULL entries and misses entries that
    hold an ERR_PTR.
    
    rb_threads[] is static, so unassigned slots are NULL. But when
    kthread_run_on_cpu() fails for a cpu, it stores ERR_PTR(-ENOMEM) (or
    -EINTR) in rb_threads[cpu] before the creation loop jumps to out_free.
    That entry is non-NULL, so the old `!ptr` check does not break, and the
    cleanup proceeds to call kthread_stop() on the ERR_PTR. kthread_stop()
    then dereferences the bogus pointer, crashing the kernel during the
    late_initcall self-test.
    
    crash logs:
      BUG: kernel NULL pointer dereference, address: 000000000000001c
      Oops: 0002 [#1] SMP NOPTI
      CPU: 1 PID: 1 Comm: swapper/0 Not tainted 7.2.0-rc6-dirty #7 PREEMPT(lazy)
      RIP: 0010:kthread_stop+0x2e/0x220
      RBX: fffffffffffffff4
      CR2: 000000000000001c
      Call Trace:
       <TASK>
       test_ringbuffer+0x1ec/0x650
       do_one_initcall+0x6c/0x2c0
       kernel_init_freeable+0x21d/0x420
       kernel_init+0x15/0x1c0
       ret_from_fork+0x21b/0x320
       </TASK>
      Kernel panic - not syncing: Fatal exception
    
    Cc: stable@vger.kernel.org
    Fixes: 64ed3a049e3e ("ring-buffer: make use of the helper function kthread_run_on_cpu()")
    Link: https://patch.msgid.link/20260807154145.2846521-2-sh_def@163.com
    Signed-off-by: Hui Su <sh_def@163.com>
    Reviewed-by: Vincent Donnefort <vdonnefort@google.com>
    Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ring-buffer: Prevent subbuf order change when resizing is disabled [+ + +]
Author: Vincent Donnefort <vdonnefort@google.com>
Date:   Thu Aug 6 22:13:02 2026 +0100

    ring-buffer: Prevent subbuf order change when resizing is disabled
    
    commit bf98d7b0d5a99991e47e66cee4eb1d3fa514be97 upstream.
    
    Because ring_buffer_subbuf_order_set() frees buffer pages, we can't
    allow it when resizing is disabled. A non-consuming reader is at risk of
    use-after-free (rb_advance_iter()).
    
    Return -EBUSY on resize_disabled, matching ring_buffer_resize()
    behaviour.
    
    Cc: stable@vger.kernel.org
    Fixes: f9b94daa542a ("ring-buffer: Set new size of the ring buffer sub page")
    Link: https://patch.msgid.link/20260806211306.3704194-3-vdonnefort@google.com
    Reported-by: syzbot+e0cc44465d6bae735679@syzkaller.appspotmail.com
    Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
s390/zcrypt: Fix missing mem scrub at clear key import in cca_clr2cipherkey() [+ + +]
Author: Harald Freudenberger <freude@linux.ibm.com>
Date:   Mon Aug 10 16:37:19 2026 +0200

    s390/zcrypt: Fix missing mem scrub at clear key import in cca_clr2cipherkey()
    
    [ Upstream commit 01476391aecef36a3b789ee844357b22fbc90665 ]
    
    The helper function _ip_cprb_helper() uses internal buffer memory for
    building and processing CPRBs. After use this buffer was never
    scrubbed which could lead to leaving for example clear key material in
    memory which could be exposed via tricky reuse of this same memory.
    
    Extend the _ip_cprb_helper() function with another parameter 'scrub'
    used to steer scrubbing of this buffer. So now the caller has the
    opportunity to decide if scrubbing is needed or not.
    
    Extend the clear key to secure key token import process in function
    cca_clr2cipherkey() to tell the helper function from above to scrub
    the cprb buffer when the clear key value is part of the request data.
    
    Add explicit scrubbing on return from function cca_clr2cipherkey() for
    the random EXOR buffer and the cprb buffer.
    
    Overall this cleans the internal used buffer in case of clear key
    import to prevent sensitive data to get exposed.
    
    Fixes: 4bc123b18ce6 ("s390/zcrypt: Add low level functions for CCA AES cipher keys")
    Cc: stable@vger.kernel.org
    Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
    Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
    Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
    Signed-off-by: Holger Dengler <dengler@linux.ibm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
sched/psi: Shut down rtpoll_timer in psi_cgroup_free() [+ + +]
Author: Tejun Heo <tj@kernel.org>
Date:   Sun Jul 12 07:23:55 2026 -1000

    sched/psi: Shut down rtpoll_timer in psi_cgroup_free()
    
    commit 5457025fa8ca3c0d2732109513de839e3e797190 upstream.
    
    psi_schedule_rtpoll_work() is called locklessly from the scheduler hotpath
    and can race psi_trigger_destroy() taking down the last rtpoll trigger under
    rtpoll_trigger_lock:
    
      psi_schedule_rtpoll_work()        psi_trigger_destroy()
    
      rcu_read_lock();
      task = rcu_dereference(rtpoll_task);
                                        rcu_assign_pointer(rtpoll_task, NULL);
                                        timer_delete(&rtpoll_timer);
      mod_timer(&rtpoll_timer, ...);
      rcu_read_unlock();
                                        synchronize_rcu();
                                        kthread_stop(task_to_destroy);
    
    The group can then be freed with the re-armed timer still pending, and
    poll_timer_fn() runs on freed memory.
    
    461daba06bdc ("psi: eliminate kthread_worker from psi trigger scheduling
    mechanism") deleted the timer synchronously after the synchronize_rcu(),
    which prevented this but raced trigger creation instead: the deletion could
    cancel the timer that a new trigger set armed during the grace period and,
    as creation also reinitialized the timer at the time, corrupt it.
    8f91efd870ea ("psi: Fix race between psi_trigger_create/destroy") moved the
    initialization into group_init() and the deletion into the locked section,
    trading the creation races for the window above.
    
    Neither placement in the destruction path works. A pending timer firing
    while the group is alive is harmless though. poll_timer_fn() just wakes the
    rtpoll waitqueue and doesn't re-arm itself. Bind the timer to the group's
    lifetime instead and shut it down in psi_cgroup_free(). Nothing can arm it
    by then. timer_shutdown_sync() because the timer is never armed again.
    
    Fixes: 8f91efd870ea ("psi: Fix race between psi_trigger_create/destroy")
    Cc: stable@vger.kernel.org # v5.10+
    Reported-by: Sashiko AI <sashiko-bot@kernel.org>
    Closes: https://lore.kernel.org/all/20260711000434.36C4A1F000E9@smtp.kernel.org/
    Signed-off-by: Tejun Heo <tj@kernel.org>
    Acked-by: Johannes Weiner <hannes@cmpxchg.org>
    Tested-by: Matt Fleming <mfleming@cloudflare.com>
    Acked-by: Suren Baghdasaryan <surenb@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
scsi: scsi_debug: Negate wrapped memcmp() result [+ + +]
Author: Xu Rao <raoxu@uniontech.com>
Date:   Mon Aug 3 17:53:28 2026 +0800

    scsi: scsi_debug: Negate wrapped memcmp() result
    
    commit c4f6916a99cf105c3ff340b6210fcbba3fa66b35 upstream.
    
    comp_write_worker() returns true when the compared data matches.
    memcmp() returns zero for equal data and non-zero for different data, so
    its result must be negated before it is stored in a bool.
    
    The first segment already uses !memcmp(), but the wrapped segment uses
    memcmp() directly, reversing the match result. Use !memcmp() there as
    well.
    
    Fixes: 38d5c8336e60 ("scsi_debug: add Report supported opcodes+tmfs; Compare and write")
    Cc: stable@vger.kernel.org
    Signed-off-by: Xu Rao <raoxu@uniontech.com>
    Reviewed-by: John Garry <john.g.garry@oracle.com>
    Link: https://patch.msgid.link/E5AD42E9C0E18633+20260803095328.3445311-1-raoxu@uniontech.com
    Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
sctp: clear control chunk transport if it is being removed [+ + +]
Author: Xin Long <lucien.xin@gmail.com>
Date:   Wed Aug 5 11:18:40 2026 -0400

    sctp: clear control chunk transport if it is being removed
    
    [ Upstream commit c9158ceaf27780ef64534ad72f44ffde3f8ccc49 ]
    
    sctp_make_heartbeat_ack() caches the destination transport in
    chunk->transport without taking a reference. When src_out_of_asoc_ok is
    enabled, the HEARTBEAT ACK may remain queued on control_chunk_list instead
    of being transmitted immediately.
    
    If the peer transport is removed while the chunk is still queued,
    sctp_assoc_rm_peer() drops the transport and schedules it for RCU freeing,
    but only clears cached transport pointers in out_chunk_list.  The queued
    control chunk therefore retains a dangling transport pointer.
    
    Once an ASCONF_ACK clears the suppression and the queued control chunk is
    transmitted, SCTP dereferences the stale transport pointer, leading to a
    use-after-free.
    
    Fix this by also clearing chunk->transport for queued control chunks in
    control_chunk_list when removing the transport.
    
    Fixes: 8a07eb0a50ae ("sctp: Add ASCONF operation on the single-homed host")
    Reported-by: Daniele Linguaglossa <danielelinguaglossa@gmail.com>
    Signed-off-by: Xin Long <lucien.xin@gmail.com>
    Link: https://patch.msgid.link/7e1168cb722132152a29d47e5eafaeac4a3bf6f3.1785943120.git.lucien.xin@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

sctp: clear new_transport when removing a peer [+ + +]
Author: Qing Ming <a0yami@mailbox.org>
Date:   Tue Aug 11 23:28:03 2026 +0800

    sctp: clear new_transport when removing a peer
    
    commit beb33f8ee1ca83acddb2a5ae80f3d22ec550b4c3 upstream.
    
    sctp_process_asconf_param() stores a newly added peer transport in
    asoc->new_transport. After all parameters in the ASCONF chunk have been
    processed, sctp_sf_do_asconf() uses this pointer to send a HEARTBEAT to the
    new transport.
    
    An authenticated ASCONF from a remote SCTP peer can add a transport and
    remove it again with a wildcard DEL-IP parameter in the same chunk. The
    wildcard deletion preserves the transport on which the ASCONF arrived, but
    removes the newly added transport through
    sctp_assoc_del_nonprimary_peers(). The removal does not clear
    asoc->new_transport, leaving it pointing to the removed transport.
    
    sctp_sf_do_asconf() then creates a HEARTBEAT whose chunk->transport points
    to the removed transport without holding a transport reference. During
    local address replacement, src_out_of_asoc_ok keeps this HEARTBEAT on
    control_chunk_list. After the transport is freed by RCU, a successful
    ASCONF_ACK for the replacement address releases the queued HEARTBEAT and
    sctp_outq_select_transport() reads the freed transport's state.
    
    The issue was found during a static audit of SCTP objects. With an
    authenticated peer, the reproducer triggered the same KASAN report in 2
    of 2 unpatched runs on a KASAN-enabled netdev/main kernel:
    
      BUG: KASAN: slab-use-after-free in sctp_outq_select_transport
      Read of size 4 at addr ffff88800b9bd95c by task python3/197
    
      Call Trace:
       sctp_outq_select_transport+0x549/0x8b0 [sctp]
       sctp_outq_flush+0x306/0x2c60 [sctp]
       sctp_transport_immediate_rtx+0xaf/0x260 [sctp]
       sctp_process_asconf_ack+0xa48/0xf70 [sctp]
    
      Allocated by task 197:
       sctp_transport_new+0x68/0x650 [sctp]
       sctp_assoc_add_peer+0x258/0x12a0 [sctp]
       sctp_process_asconf+0x5e9/0x1090 [sctp]
    
      Last potentially related work creation:
       __call_rcu_common.constprop.0+0x77/0xb70
       sctp_assoc_del_nonprimary_peers+0x7c/0xd0 [sctp]
       sctp_process_asconf+0xd9c/0x1090 [sctp]
    
    The first invalid access was a four-byte read of transport->state at
    net/sctp/outqueue.c:833. The same reproducer completed the full
    authenticated ASCONF and local-address replacement sequence with this
    change without a KASAN report or oops.
    
    Clear new_transport when its peer is removed, before it can be used to
    create the HEARTBEAT.
    
    Fixes: 6af29ccc223b ("sctp: Bundle HEAERTBEAT into ASCONF_ACK")
    Cc: stable@vger.kernel.org
    Signed-off-by: Qing Ming <a0yami@mailbox.org>
    Acked-by: Xin Long <lucien.xin@gmail.com>
    Link: https://patch.msgid.link/20260811152803.5629-1-a0yami@mailbox.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

sctp: fix addip_serial increment on ASCONF_ACK allocation failure [+ + +]
Author: Qing Luo <luoqing@kylinos.cn>
Date:   Tue Aug 4 10:55:14 2026 +0800

    sctp: fix addip_serial increment on ASCONF_ACK allocation failure
    
    [ Upstream commit aa2e13ae8d3cbe2c15ef4f7e971b2de0832794aa ]
    
    In sctp_process_asconf(), when sctp_make_asconf_ack() fails to allocate
    the ASCONF_ACK chunk due to memory pressure, the code jumps to the
    done label where asoc->peer.addip_serial is unconditionally incremented.
    
    This leaves the peer's ASCONF (serial N) unacknowledged while the local
    endpoint now expects serial N+1. When the peer retransmits serial N, it
    falls into the serial < addip_serial + 1 branch ,
    which attempts to look up a cached ACK for serial N. No cached ACK
    exists since the allocation failed, so the retransmission is silently
    discarded. The peer eventually times out and ABORTs the association.
    
    Move the addip_serial increment inside the if (asconf_ack) block so that
    the serial number is only advanced when the ASCONF_ACK is successfully
    created and cached. This way, on allocation failure, the serial number
    is unchanged and the peer's retransmitted ASCONF will be correctly
    re-processed.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Qing Luo <luoqing@kylinos.cn>
    Acked-by: Xin Long <lucien.xin@gmail.com>
    Link: https://patch.msgid.link/20260804025514.241767-1-l1138897701@163.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

sctp: fix use-after-free of cached ASCONF chunk [+ + +]
Author: Yuxiang Yang <yangyx22@mails.tsinghua.edu.cn>
Date:   Sun Aug 9 12:38:06 2026 +0800

    sctp: fix use-after-free of cached ASCONF chunk
    
    commit 8c283e7b56adce00193837f3311b06662466fb21 upstream.
    
    addip_last_asconf caches the outstanding outbound ASCONF chunk. The normal
    ASCONF-ACK completion path releases the chunk and clears the pointer.
    
    However, sctp_asconf_queue_teardown() releases the cached chunk without
    clearing addip_last_asconf. During peer restart handling,
    sctp_sf_do_dupcook_a() queues SCTP_CMD_PURGE_ASCONF_QUEUE, which invokes
    sctp_asconf_queue_teardown() while the association remains alive and leaves
    the pointer dangling.
    
    A delayed authenticated ASCONF-ACK can then reach sctp_sf_do_asconf_ack(),
    which accesses the stale chunk and passes it to sctp_process_asconf_ack(),
    causing a use-after-free and a second release.
    
    Clearing the pointer exposes a race with T4 expiry. Peer restart handling
    queues the timer stop before the purge, but SCTP_CMD_TIMER_STOP uses
    timer_delete(), which does not wait for a callback already running on
    another CPU. Such a callback can reach sctp_sf_t4_timer_expire() after
    the purge and dereference NULL.
    
    Clear addip_last_asconf after releasing the cached chunk, and make
    sctp_sf_t4_timer_expire() consume a stale T4 expiry if no outstanding
    ASCONF remains.
    
    Fixes: a000c01e60e4 ("sctp: stop pending timers and purge queues when peer restart asoc")
    Cc: stable@vger.kernel.org
    Suggested-by: Xin Long <lucien.xin@gmail.com>
    Signed-off-by: Yuxiang Yang <yangyx22@mails.tsinghua.edu.cn>
    Acked-by: Xin Long <lucien.xin@gmail.com>
    Link: https://patch.msgid.link/20260809043806.2768302-1-yangyx22@mails.tsinghua.edu.cn
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

sctp: keep chunk->transport in step with the list it is queued on [+ + +]
Author: Baul Lee <baul.lee@xbow.com>
Date:   Thu Jul 30 01:00:28 2026 +0900

    sctp: keep chunk->transport in step with the list it is queued on
    
    commit 9f2cf069a9a72a2d6b97ca8b4c70e714aac99749 upstream.
    
    __sctp_outq_flush_rtx() moves a gap-acked chunk onto another transport's
    transmitted list without updating chunk->transport:
    
            if (chunk->tsn_gap_acked) {
                    list_move_tail(&chunk->transmitted_list,
                                   &transport->transmitted);
                    continue;
            }
    
    The chunk then sits on a live transport's list while chunk->transport still
    names a different one.  If that transport is removed - sctp_assoc_rm_peer()
    from an ASCONF Delete-IP - sctp_transport_free() RCU-frees it and the chunk
    is left with a dangling pointer.  sctp_assoc_rm_peer() scrubs
    peer->transmitted and asoc->outqueue.out_chunk_list, but the chunk is on
    neither.
    
    The pointer is not followed while tsn_gap_acked is set.  A SACK that
    reneges on the TSN clears the flag, and the next SACK reaches
    
            tchunk->transport->flight_size -= sctp_data_size(tchunk);
    
    inside the freed transport.  KASAN reports a slab-use-after-free read in
    sctp_check_transmitted(), freed from sctp_assoc_rm_peer().  Both the
    removal and the SACKs come from the association peer.
    
    Set chunk->transport at the move.  The ordinary resend path needs nothing:
    it reaches its list_move_tail() only after sctp_packet_append_chunk()
    returned SCTP_XMIT_OK, and __sctp_packet_append_chunk() has rebound the
    chunk by then.
    
    Discovered by XBOW, triaged by Baul Lee <baul.lee@xbow.com>
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable@vger.kernel.org
    Signed-off-by: Baul Lee <baul.lee@xbow.com>
    Acked-by: Xin Long <lucien.xin@gmail.com>
    Link: https://patch.msgid.link/20260729160028.54546-1-baul.lee@xbow.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
selftests/bpf: Adapt sockmap update error handling [+ + +]
Author: Michal Luczaj <mhal@rbox.co>
Date:   Tue Jul 7 06:23:58 2026 +0200

    selftests/bpf: Adapt sockmap update error handling
    
    [ Upstream commit 30581eda4a07ff15db623612cac578e81869e96f ]
    
    Update sockmap_listen to accommodate the recent change in sockmap that
    rejects unbound UDP sockets.
    
    TCP: Reject unbound and bound (unless established or listening).
    UDP: Accept only bound sockets.
    
    While at it, migrate to ASSERT_* and enforce reverse xmas tree.
    
    Signed-off-by: Michal Luczaj <mhal@rbox.co>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
    Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
    Link: https://lore.kernel.org/bpf/20260707-sockmap-lookup-udp-leak-v4-3-f878346f27ab@rbox.co
    Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

selftests/bpf: Ensure UDP sockets are bound [+ + +]
Author: Michal Luczaj <mhal@rbox.co>
Date:   Tue Jul 7 06:23:56 2026 +0200

    selftests/bpf: Ensure UDP sockets are bound
    
    [ Upstream commit fe3ff273767ef22fe8a7cb3816f264927c190e50 ]
    
    Update sockmap_basic tests to bind sockets before they are used. This
    accommodates the recent change in sockmap that rejects unbound UDP sockets.
    
    Signed-off-by: Michal Luczaj <mhal@rbox.co>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
    Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
    Link: https://lore.kernel.org/bpf/20260707-sockmap-lookup-udp-leak-v4-1-f878346f27ab@rbox.co
    Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

selftests/bpf: Fail unbound UDP on sockmap update [+ + +]
Author: Michal Luczaj <mhal@rbox.co>
Date:   Sat Aug 8 09:41:11 2026 -0300

    selftests/bpf: Fail unbound UDP on sockmap update
    
    [ Upstream commit 203b06932777b9ad5085319389dea566f5c2ca63 ]
    
    sockmap now rejects unbound UDP sockets. Adjust test_maps. While at it,
    check socket()'s return value.
    
    This effectively reverts commit c39aa2159974 ("bpf, selftests: Fix
    test_maps now that sockmap supports UDP").
    
    Signed-off-by: Michal Luczaj <mhal@rbox.co>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
    Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
    Link: https://lore.kernel.org/bpf/20260707-sockmap-lookup-udp-leak-v4-4-f878346f27ab@rbox.co
    Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
    Signed-off-by: Ricardo B. Marlière (SUSE) <ricardo@marliere.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
selftests/ftrace: refactor eprobes test to fix argument checks [+ + +]
Author: Martin Kaiser <martin@kaiser.cx>
Date:   Tue Aug 4 21:46:35 2026 +0200

    selftests/ftrace: refactor eprobes test to fix argument checks
    
    [ Upstream commit 6e3abef2a27e7402a94111c9eff85d887e64a309 ]
    
    The add/remove eprobe test installs an eprobe for the openat syscall and
    runs ls. It checks the filenames that were opened by ls against a
    whitelist and a blacklist.
    
    Commit 206b25c09080 ("tracing: eprobe: read the complete FILTER_PTR_STRING
    pointer") fixed access to some string fields in eprobes. This triggers
    test failures as the blacklist does not allow relative paths for the
    openat parameters.
    
    What makes this test unstable is the fact that the openat calls vary a
    lot between different systems.
    
    Refactor the test to make it more robust. "cd <directory>" will issue a
    chdir syscall with the target directory as parameter. Set an eprobe on
    the sys_enter_chdir event and filter for the exact directory name. Allow
    (fault) as fallback.
    
    Link: https://lore.kernel.org/all/20260804194705.760893-1-martin@kaiser.cx/
    
    Fixes: 206b25c09080 ("tracing: eprobe: read the complete FILTER_PTR_STRING pointer")
    Reported-by: kernel test robot <oliver.sang@intel.com>
    Closes: https://lore.kernel.org/oe-lkp/202607151010.b68428e1-lkp@intel.com
    Signed-off-by: Martin Kaiser <martin@kaiser.cx>
    Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
serial: 8250_dma: Clear stale RX state on shutdown [+ + +]
Author: Cunhao Lu <1579567540@qq.com>
Date:   Mon Jul 27 14:25:22 2026 +0800

    serial: 8250_dma: Clear stale RX state on shutdown
    
    commit e2fe6a0efecbef00e3ecc2db64dd5afa8c212b41 upstream.
    
    serial8250_release_dma() terminates RX DMA and releases the channel, but
    leaves rx_running set.  If the port is closed while an RX transfer is
    active, the stale state remains while rxchan is NULL until the channel is
    requested again on the next open.
    
    The DesignWare BUSY workaround added by commit a7b9ce39fbe4
    ("serial: 8250_dw: Ensure BUSY is deasserted") calls
    serial8250_rx_dma_flush() from the LCR write path during startup.  This
    happens before serial8250_request_dma() obtains a new RX channel.  On
    reopen, the stale rx_running state therefore makes the flush path pass a
    NULL channel to dmaengine_pause(), causing a kernel Oops.
    
    Clear rx_running after terminating RX DMA, matching the TX cleanup.  Also
    make the flush helper return if the DMA object or RX channel is not
    available so startup and teardown paths cannot pass a NULL channel to the
    DMAengine API.
    
    Fixes: 0fcb7901f9d6 ("tty: serial: 8250_dma: keep own book keeping about RX transfers")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Cunhao Lu <1579567540@qq.com>
    Link: https://patch.msgid.link/tencent_9EE2945F4C933B4D810C73C2D7485E000F06@qq.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

serial: qcom-geni: fix TX DMA buffer flush [+ + +]
Author: Jan Sebastian Götte <linux@jaseg.de>
Date:   Wed Jul 29 19:41:05 2026 +0200

    serial: qcom-geni: fix TX DMA buffer flush
    
    commit e3c04834ae1ab5e9cfbe8ac54ec734aa4774249d upstream.
    
    When transmit flushing a qcom-geni UART during an ongoing TX DMA, the
    UART gets stuck infinitely repeating corrupted TX DMA frames.
    
    The DMA-mode uart_ops does not provide a flush_buffer callback, so an
    in-flight transfer can complete after serial core has reset the transmit
    kfifo, underflowing its length and resubmitting page-sized transfers
    indefinitely. Add one that stops the transfer and clears tx_remaining
    and tx_queued.
    
    The stop path was also broken: it unmapped the buffer while the serial
    engine could still read it, and never reset the TX DMA state machine.
    Cancel the main sequencer command first, then reset the state machine
    and wait for it before unmapping. Drop the early return so a pending
    mapping is also cleaned up when the main command is inactive.
    
    The bug can be triggered from userspace with a large write immediately
    followed by TCOFLUSH. A following tcdrain will hang forever. The bug was
    reproduced and this fix was validated on Arduino Uno Q (QRB2210)
    using /dev/ttyHS1.
    
    Assisted-by: Claude:claude-5-opus Codex:gpt-5
    Signed-off-by: Jan Sebastian Götte <linux@jaseg.de>
    Fixes: 2aaa43c70778 ("tty: serial: qcom-geni-serial: add support for serial engine DMA")
    Cc: stable <stable@kernel.org>
    Reviewed-by: Praveen Talari <praveen.talari@oss.qualcomm.com>
    Link: https://patch.msgid.link/20260729174105.21838-2-git@jaseg.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
smb: client: Fix use-after-free in cifs_try_adding_channels() [+ + +]
Author: Shuangpeng Bai <shuangpeng.kernel@gmail.com>
Date:   Sat Aug 1 20:48:09 2026 -0400

    smb: client: Fix use-after-free in cifs_try_adding_channels()
    
    commit 4986410316b1ae0e63c6ce418e4eb196723626e7 upstream.
    
    cifs_try_adding_channels() takes a temporary reference to an interface
    before dropping iface_lock. If cifs_ses_add_channel() fails, it drops
    that reference and then increments iface->weight_fulfilled.
    
    A concurrent interface list refresh can remove the list reference while
    channel creation is in progress. In that case, the failure-path
    kref_put() releases the last reference and frees iface. Updating
    weight_fulfilled afterward then accesses freed memory.
    
    Increment weight_fulfilled before dropping the temporary reference,
    keeping iface alive for the final access.
    
    Fixes: 6aac002bcfd5 ("cifs: failure to add channel on iface should bump up weight")
    Cc: stable@vger.kernel.org
    Signed-off-by: Shuangpeng Bai <shuangpeng.kernel@gmail.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
spi: spi-fsl-dspi: Avoid setup_accel logic for DMA transfers [+ + +]
Author: Larisa Grigore <larisa.grigore@nxp.com>
Date:   Thu May 22 15:51:37 2025 +0100

    spi: spi-fsl-dspi: Avoid setup_accel logic for DMA transfers
    
    [ Upstream commit cac7e5054115fcc41b1cb050af8e8971f7c9b22b ]
    
    Repacking multiple smaller words into larger ones to make use of the
    full FIFO doesn't save anything in DMA mode, so don't bother doing it.
    
    Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com>
    Signed-off-by: James Clark <james.clark@linaro.org>
    Link: https://patch.msgid.link/20250522-james-nxp-spi-v2-8-bea884630cfb@linaro.org
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
staging: rtl8723bs: fix missing shared-key auth challenge length check [+ + +]
Author: Panagiotis Petrakopoulos <npetrakopoulos2003@gmail.com>
Date:   Mon Jul 20 11:24:09 2026 +0300

    staging: rtl8723bs: fix missing shared-key auth challenge length check
    
    commit 2c56ef658ac8c6bca36bc5574715e8f717207c6c upstream.
    
    The WEP shared-key authentication handler uses the challenge-text
    element's attacker-controlled length without checking it against the
    fixed 128-byte chg_txt buffer.
    
    In OnAuthClient() the length from rtw_get_ie() - up to 255 - is used
    to perform memcpy() into the 128-byte pmlmeinfo->chg_txt, so a
    malicious AP sending a malformed WLAN_EID_CHALLENGE element can
    overflow/underfill chg_txt by up to 127 bytes. It is reachable over the
    air, before association, during shared-key authentication. In the case
    of an overflow, the driver can write out of bounds. In the case of an
    underfill, the driver can echo stale buffer memory.
    
    The challenge text is defined to be exactly 128 octets, which is
    already provided as the WLAN_AUTH_CHALLENGE_LEN define; require the
    element to be exactly that length before use.
    
    Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Panagiotis Petrakopoulos <npetrakopoulos2003@gmail.com>
    Link: https://patch.msgid.link/20260720082409.168379-1-npetrakopoulos2003@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: rtl8723bs: fix OOB read in rtw_get_wpa_ie() [+ + +]
Author: Muhammad Bilal <meatuni001@gmail.com>
Date:   Sun Jul 19 08:06:31 2026 +0500

    staging: rtl8723bs: fix OOB read in rtw_get_wpa_ie()
    
    commit 1c3e23e78862493e8cf1adad02b10ffcb8b9921c upstream.
    
    rtw_get_wpa_ie() reads bytes at fixed offsets into a vendor-specific
    information element without checking that the element is long enough,
    causing an out-of-bounds read for a short trailing IE.
    
    The function locates a vendor-specific IE (EID 221) with rtw_get_ie()
    and then compares a 4-byte OUI+type at pbuf + 2 and reads a 2-byte
    version word at pbuf + 6. Those accesses require the IE body to be at
    least 6 bytes, but rtw_get_ie() only guarantees that the element fits
    within the buffer; it does not enforce a minimum body length. A
    vendor-specific IE whose length byte is 0 to 5, placed at the end of
    the buffer, therefore makes these reads run past the end of the IE and
    past the end of the buffer itself.
    
    The buffer holds information elements taken from received management
    frames and from the IE blob passed to rtw_cfg80211_set_wpa_ie(), which
    is kmemdup'd to its exact length, so the read can run off the end of
    the allocation.
    
    The sibling helpers rtw_get_sec_ie(), rtw_get_wapi_ie() and
    rtw_get_wps_ie() in this file already reject too-short vendor-specific
    IEs before their OUI memcmp(); rtw_get_wpa_ie() was never brought in
    line with them, and needs a minimum of 6 rather than 4 bytes because
    of the version word. Add the missing length check.
    
    Fixes: 554c0a3abf216 ("staging: Add rtl8723bs sdio wifi driver")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
    Link: https://patch.msgid.link/20260719030631.88254-1-meatuni001@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: rtl8723bs: fix OOB read in WMM_param_handler() [+ + +]
Author: Muhammad Bilal <meatuni001@gmail.com>
Date:   Sun Jul 19 09:15:09 2026 +0500

    staging: rtl8723bs: fix OOB read in WMM_param_handler()
    
    commit ae21407350151bddfd4fea7aa39bd0643c0ca9d3 upstream.
    
    WMM_param_handler() copies a fixed-size WMM parameter element out of a
    received information element without checking that the element is long
    enough, causing an out-of-bounds read for a short WMM IE.
    
    The handler reads sizeof(struct WMM_para_element) (18) bytes at
    pIE->data + 6, so it requires pIE->length to be at least 24
    (WLAN_WMM_LEN), but it never validates the length. Two of its three
    callers reach it after matching only the WMM OUI: OnAssocRsp() in
    rtw_mlme_ext.c matches a 6-byte OUI, and join_cmd_hdl() matches a
    4-byte OUI, before calling the handler. A vendor-specific IE carrying
    the WMM OUI but a length between 6 and 23, placed in an association
    response or in the IE blob handed to join_cmd_hdl(), passes the OUI
    check and then makes the memcmp() and memcpy() at pIE->data + 6 read
    past the end of the element. OnAssocRsp() parses a frame received from
    the AP, so this is reachable from a remote peer.
    
    The remaining caller in rtw_wlan_util.c already guards the handler with
    "pIE->length == WLAN_WMM_LEN". Move the equivalent check into the
    handler itself so every caller is covered; the sibling IE handlers in
    the same parsing loop (HT_caps_handler(), HT_info_handler(),
    ERP_IE_handler()) likewise bound their accesses by pIE->length.
    
    Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
    Link: https://patch.msgid.link/20260719041509.97894-1-meatuni001@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: rtl8723bs: validate monitor transmit frame lengths [+ + +]
Author: Mariano Baragiola <mbaragiola@linux.com>
Date:   Mon Jul 27 13:08:59 2026 -0300

    staging: rtl8723bs: validate monitor transmit frame lengths
    
    commit 6829665d050983907b560173e49dcc6c11cb2730 upstream.
    
    rtw_cfg80211_monitor_if_xmit_entry() removes the radiotap header and
    then reads the 802.11 frame control field without checking that a base
    802.11 header remains.
    
    The data path also pulls the calculated 802.11, QoS and SNAP header
    span before confirming that the skb contains it. A truncated frame can
    therefore cause out-of-bounds reads or leave insufficient data for the
    Ethernet address writes.
    
    Reject frames that do not contain the base 802.11 header and data
    frames that do not contain their complete calculated header span.
    
    Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Mariano Baragiola <mbaragiola@linux.com>
    Link: https://patch.msgid.link/20260727160859.1917096-1-mbaragiola@linux.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
swapfile: call cond_resched() before locking si->lock [+ + +]
Author: Guillaume Morin <guillaume@morinfr.org>
Date:   Wed Aug 12 10:51:47 2026 +0200

    swapfile: call cond_resched() before locking si->lock
    
    The 6.12 backport of commit 66366d291f66 ("mm/swap: add cond_resched()
    in swap_reclaim_full_clusters to prevent softlockup"),
    added a cond_resched() after locking si->lock. Move cond_resched()
    before spin_lock().
    
    Signed-off-by: Guillaume Morin <guillaume@morinfr.org>
    Fixes: 60cbe67d1342 ("mm/swap: add cond_resched() in swap_reclaim_full_clusters to prevent softlockup")
    Link: https://lore.kernel.org/stable/ansgKOOXi6KE3oKf@bender.morinfr.org/
    Cc: stable@vger.kernel.org
    Cc: Chris Li <chrisl@kernel.org>
    Cc: Zijiang Huang <kerayhuang@tencent.com>
    Cc: gregkh@linuxfoundation.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
tcp: do not change rcv_ssthresh in tcp_measure_rcv_mss() [+ + +]
Author: Nathan Gao <zcgao@amazon.com>
Date:   Fri Jul 24 20:08:06 2026 -0700

    tcp: do not change rcv_ssthresh in tcp_measure_rcv_mss()
    
    [ Upstream commit 0e125ecfe20c077625cf0be8d750d5c3abc0dce9 ]
    
    Commit f5da7c45188e ("tcp: adjust rcvq_space after updating scaling
    ratio") replaced the direct window_clamp update in tcp_measure_rcv_mss()
    with a call to tcp_set_window_clamp(), a helper that implements the
    TCP_WINDOW_CLAMP setsockopt. As a side effect, the helper also shrinks
    rcv_ssthresh via __tcp_adjust_rcv_ssthresh().
    
    As a result, each scaling_ratio decrease detected by
    tcp_measure_rcv_mss() also cuts rcv_ssthresh. Elsewhere in TCP,
    rcv_ssthresh is usually cut under memory pressure and grows via
    tcp_grow_window().
    
    Flows whose segment sizes vary keep scaling_ratio oscillating, which
    leads to an unstable rcv_ssthresh: a dip of rcv_ssthresh only recovers
    via tcp_grow_window(), keeping the advertised window at a relatively
    low level even after the ratio itself has recovered, and can even stall
    the sender.
    
    Observed on a customer's proxy gateway after upgrading from kernel 6.1
    to 6.12: in the worst case, rcv_ssthresh was cut in half by a
    scaling_ratio dip. P99 latency jumped from <10ms on 6.1 to ~100ms on
    6.12, and almost returned to the 6.1 level with this patch applied.
    
    Restore the plain WRITE_ONCE() update of window_clamp, as introduced
    in commit a2cbb1603943 ("tcp: Update window clamping condition"), and
    keep the rcvq_space.space adjustment. Now rcv_ssthresh is decoupled from
    scaling_ratio changes in tcp_measure_rcv_mss().
    
    Fixes: f5da7c45188e ("tcp: adjust rcvq_space after updating scaling ratio")
    Signed-off-by: Nathan Gao <zcgao@amazon.com>
    Link: https://patch.msgid.link/20260725030806.28135-1-zcgao@amazon.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

tcp: fix TFO max_qlen accounting across reuseport migration [+ + +]
Author: Jiayuan Chen <jiayuan.chen@linux.dev>
Date:   Mon Aug 3 14:17:38 2026 +0800

    tcp: fix TFO max_qlen accounting across reuseport migration
    
    [ Upstream commit a0ab2ba83e35159d81cec830a92e885ecf8139be ]
    
    A listener's TCP_FASTOPEN max_qlen stops being accurate and lets through
    far more pending Fast Open requests than it was configured for.
    
    This only shows up with SO_REUSEPORT listener migration, where closing a
    listener hands its still-pending TFO children over to a surviving one.
    
    fastopenq.qlen is charged in tcp_fastopen_create_child() when the child
    is created and uncharged in reqsk_fastopen_remove() when the handshake
    completes.  The uncharge follows rsk_listener of the request the child
    points at, and inet_reqsk_clone() has repointed the child at a new
    request owned by the new listener, so the ++ and the -- land on two
    different sockets.  The new listener's qlen drifts negative and its
    limit no longer binds.
    
    Charge the new listener during migration, like reqsk_queue_migrated()
    already does for queue->young and queue->qlen.
    
    Fixes: 54b92e841937 ("tcp: Migrate TCP_ESTABLISHED/TCP_SYN_RECV sockets in accept queues.")
    Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Link: https://patch.msgid.link/20260803061739.134737-1-jiayuan.chen@linux.dev
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
thunderbolt: Bound the DROM dual link port number before indexing sw->ports [+ + +]
Author: Bryam Vargas <hexlabsecurity@proton.me>
Date:   Thu Jun 25 06:54:09 2026 -0500

    thunderbolt: Bound the DROM dual link port number before indexing sw->ports
    
    commit d6764992f17b23d91ff93ce905ab53c2aa7191f0 upstream.
    
    tb_drom_parse_entry_port() validates the device-supplied header->index
    against sw->config.max_port_number before indexing sw->ports[], but the
    sibling field entry->dual_link_port_nr -- a 6-bit value also read from
    the DROM -- indexes the same array with no such check. A malicious or
    malformed Thunderbolt device can set dual_link_port_nr beyond the
    allocated sw->ports[] (max_port_number + 1 entries), producing an
    out-of-bounds tb_port pointer that is stored and later dereferenced.
    
    Reject a port entry whose dual_link_port_nr exceeds max_port_number,
    the same bound already applied to header->index.
    
    Fixes: cd22e73bdf5e ("thunderbolt: Read port configuration from eeprom.")
    Cc: stable@vger.kernel.org
    Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>
    Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

thunderbolt: Fix bandwidth group reservation indexing [+ + +]
Author: Xu Rao <raoxu@uniontech.com>
Date:   Wed Jun 24 14:27:03 2026 +0800

    thunderbolt: Fix bandwidth group reservation indexing
    
    commit d2ee4d47aacbd2ba456092eeec670dba35fde291 upstream.
    
    Valid bandwidth group IDs range from 1 through MAX_GROUPS, while Group
    ID 0 is reserved. tb_consumed_dp_bandwidth() uses the Group ID directly
    to index its local group_reserved[] array.
    
    The array currently has MAX_GROUPS entries, so its valid indices are 0
    through MAX_GROUPS - 1. Group ID MAX_GROUPS therefore accesses one
    element past the end, and the final group's reserved bandwidth is not
    included when the array is summed.
    
    Give group_reserved[] MAX_GROUPS + 1 entries so direct Group ID
    indexing covers the reserved ID 0 and valid IDs 1 through MAX_GROUPS.
    
    Fixes: 52a4490e89d7 ("thunderbolt: Reserve released DisplayPort bandwidth for a group for 10 seconds")
    Cc: stable@vger.kernel.org
    Signed-off-by: Xu Rao <raoxu@uniontech.com>
    Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

thunderbolt: icm: Preserve USB4 proxy data-valid bit [+ + +]
Author: Xu Rao <raoxu@uniontech.com>
Date:   Mon Jul 13 17:32:37 2026 +0800

    thunderbolt: icm: Preserve USB4 proxy data-valid bit
    
    commit e48844ece5e3ed1d1eb865f6da2b16f62cd9f86d upstream.
    
    The ICM USB4 switch operation request encodes two values in
    request.data_len_valid: bit 4 marks the data payload valid, while bits
    3:0 hold the payload length in dwords.  A zero length with the valid bit
    set represents the full 16-dword data array.
    
    icm_usb4_switch_op() sets the valid bit when a transmit payload is
    present.  For payloads shorter than the full 16 dwords, it then assigns
    the length to the whole field and clears the valid bit that was just set.
    The payload is still copied into the request, but the descriptor sent to
    firmware marks that data as invalid.
    
    This affects USB4 router operations that send short payloads through the
    firmware connection manager.  In particular, USB4 NVM writes can send a
    short final block when the image size is not aligned to the 64-byte proxy
    payload size.  Firmware may then ignore or reject that final block, while
    full 16-dword blocks are unaffected because they are encoded as length 0
    with the valid bit set.
    
    OR the short payload length into data_len_valid so the valid bit is
    preserved.
    
    Fixes: 9039387e166e ("thunderbolt: Add USB4 router operation proxy for firmware connection manager")
    Cc: stable@vger.kernel.org
    Signed-off-by: Xu Rao <raoxu@uniontech.com>
    Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tipc: read le->link under the node lock in tipc_node_link_down() [+ + +]
Author: Jun Yang <junvyyang@tencent.com>
Date:   Mon Aug 10 18:21:38 2026 +0800

    tipc: read le->link under the node lock in tipc_node_link_down()
    
    commit cba9ccb47e9fa4cc77692fb896cc5ab57a667882 upstream.
    
    tipc_node_link_down() caches the link pointer before taking n->lock:
    
            struct tipc_link *l = le->link;         /* unlocked */
    
            if (!l)
                    return;
            tipc_node_write_lock(n);
            if (!tipc_link_is_establishing(l)) {    /* deref l */
            ...
                    tipc_link_reset(l);             /* write into l */
            if (delete) {
                    kfree(l);
                    le->link = NULL;
    
    The delete=true caller frees that very object under n->lock, so the lock
    does not protect the cached pointer against it:
    
     - CPU A, delete=false: tipc_rcv() on TIPC_LINK_DOWN_EVT, or the link
       supervision timer via tipc_node_timeout(), reads l unlocked and then
       dereferences it under n->lock;
     - CPU B, delete=true: netlink TIPC_NL_BEARER_DISABLE -> bearer_disable()
       -> tipc_node_delete_links() -> tipc_node_link_down(n, bearer_id, true)
       -> kfree(l).
    
    The link is freed with plain kfree(), not kfree_rcu(), and for UDP bearers
    disable_media() only schedules the asynchronous cleanup_bearer() work, so
    its synchronize_net() runs after the links are already gone.  An in-flight
    CPU A that has read l therefore dereferences freed memory once B frees it:
    a use-after-free read in tipc_link_is_establishing(), and a use-after-free
    write via tipc_link_reset() on the establishing branch.
    
    The following trace was captured on 7.2.0-rc5-00284-gaf39eb111ce6:
    
      BUG: KASAN: slab-use-after-free in tipc_link_is_establishing (net/tipc/link.c:285)
      Read of size 4 at addr ffff88802e2aa068 by task swapper/2/0
       tipc_link_is_establishing (net/tipc/link.c:285)
       tipc_node_link_down (net/tipc/node.c:1076)
       tipc_node_timeout (net/tipc/node.c:843)
      Allocated by task 9549:
       tipc_link_create (net/tipc/link.c:490)
       tipc_node_check_dest (net/tipc/node.c:1279)
       tipc_disc_rcv (net/tipc/discover.c:252)
       tipc_udp_recv (net/tipc/udp_media.c:389)
      Freed by task 9549:
       tipc_node_link_down (net/tipc/node.c:1084)
       tipc_node_delete_links (net/tipc/node.c:1320)
       bearer_disable (net/tipc/bearer.c:414)
       __tipc_nl_bearer_disable (net/tipc/bearer.c:992)
    
    Move the le->link read inside tipc_node_write_lock(), so it is serialised
    against the kfree() in the delete path.  A racing teardown now either has
    not run yet, and we see a valid link, or has already run, and we see NULL.
    
    Fixes: 73f646cec354 ("tipc: delay ESTABLISH state event when link is established")
    Cc: stable@kernel.org
    Reported-by: TencentOS Corvus AI <corvus@tencent.com>
    Assisted-by: tencentos-corvus-ai:kimi-k3
    Signed-off-by: Jun Yang <junvyyang@tencent.com>
    Reviewed-by: Tung Nguyen <tung.quang.nguyen@est.tech>
    Link: https://patch.msgid.link/20260810102147.48191-1-juny24602@gmail.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tls: don't abort the connection on signal-interrupted sends [+ + +]
Author: Maximilian Immanuel Brandtner <maxbr@linux.ibm.com>
Date:   Wed Aug 5 08:22:48 2026 +0200

    tls: don't abort the connection on signal-interrupted sends
    
    [ Upstream commit af0e5cdd031f4f4a8f6d4160bfbda4f36872b0ed ]
    
    When a signal interrupts a blocking send, tls_tx_records() treats the
    resulting -ERESTARTSYS as a transmission failure and marks the socket
    errored via tls_err_abort() with the raw error code. Later syscalls
    return the kernel-internal errno 512 (ERESTARTSYS) to userspace, as the
    signal it stems from is no longer pending during syscall exit and thus
    never translated.
    
    An interrupted send is not a connection error: the partially sent record
    stays queued and is resent later. Interrupt error codes are therefore
    excluded from the abort in the same way as -EAGAIN.
    
    Fixes: b341ca51d267 ("tls: Fix tls_sw_sendmsg error handling")
    Signed-off-by: Maximilian Immanuel Brandtner <maxbr@linux.ibm.com>
    Link: https://patch.msgid.link/20260805063109.1772314-1-maxbr@linux.ibm.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

tls: don't leave a full plaintext sk_msg ring unpushed [+ + +]
Author: chanyoung <ppoo1220@gmail.com>
Date:   Tue Aug 4 14:28:35 2026 +0900

    tls: don't leave a full plaintext sk_msg ring unpushed
    
    commit 7bca91d63341274e857f4aeaad54d229405e93dc upstream.
    
    When the copy path in tls_sw_sendmsg_locked() adds the fragment that fills
    the plaintext sk_msg ring, it does not set full_record, so the record is
    left full and unpushed.  A later splice() then adds to an already full
    ring: sk_msg_page_add() has no fullness check of its own, so sg.end wraps
    onto sg.start and the ring appears empty.  Fragments added after that
    overwrite live entries, and sg.size no longer matches what is reachable
    between sg.start and sg.end, so pushing the record runs the scatterwalk off
    the end of the scatterlist.
    
    An unprivileged user can trigger this on a loopback TCP socket with the
    "tls" ULP attached:
    
      BUG: kernel NULL pointer dereference, address: 0000000000000008
      RIP: 0010:memcpy_from_scatterwalk+0x32/0xc0
      Call Trace:
       skcipher_walk_next+0x1d1/0x2c0
       gcm_encrypt_aesni_avx+0x1e9/0x220
       bpf_exec_tx_verdict+0x3bb/0x860
       tls_sw_sendmsg+0xa1a/0xca0
       __sys_sendto+0x1da/0x1f0
    
    Set full_record in the copy path when the ring becomes full, and push a
    record that is already full on entry to the sendmsg loop.
    
    Suggested-by: Sabrina Dubroca <sd@queasysnail.net>
    Fixes: fe1e81d4f73b ("tls/sw: Support MSG_SPLICE_PAGES")
    Cc: stable@vger.kernel.org
    Signed-off-by: chanyoung <ppoo1220@gmail.com>
    Link: https://patch.msgid.link/20260804052837.49015-2-ppoo1220@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tracing: Fix race between update_event_fields and, event_define_fields [+ + +]
Author: Michael Wu <michael@allwinnertech.com>
Date:   Mon Aug 10 14:32:30 2026 +0800

    tracing: Fix race between update_event_fields and, event_define_fields
    
    commit c3730b8373bb5059d735509b9e6a00d7eb337d7c upstream.
    
    The following sequence may leads race between event_define_fields()
    and update_event_fields():
    
     CPU0 (loads module A)                      CPU1 (loads module B)
     ===============================            ===============================
     load_module(A)                             load_module(B)
       notifier_call_chain                        notifier_call_chain
         trace_module_notify                        trace_module_notify
           mutex_lock(&event_mutex)                   trace_event_update_all()
             trace_module_add_events(A)                 down_write(&trace_event_sem)
                __register_event(call_A)
                  __add_event_to_tracers(call_A)
                    event_define_fields(call_A)
                      for each f:                         list_for_each_entry(field,
                        list_add(&f->link,                                    &class->fields, link)
                                 &class->fields)            field = class->fields->next;
    
    Where access to the class->fields is not protected by the event_mutex in
    trace_event_update_all().
    
    This produces the following panic:
       Unable to handle kernel access ... at virtual address 0000000000000018
       pc : update_event_fields+0xf8/0x368
       Call trace:
        update_event_fields+0xf8/0x368
        trace_event_update_all+0x7c/0x2b4
        trace_module_notify+0x4c/0x1dc
        notifier_call_chain+0x84/0x168
        blocking_notifier_call_chain_robust+0x64/0xd4
        load_module+0x10c8/0x123c
        __arm64_sys_finit_module+0x230/0x31c
    
    Fix by taking event_mutex in trace_event_update_all() before
    trace_event_sem.
    
    Cc: stable@vger.kernel.org
    Fixes: b3bc8547d3be ("tracing: Have TRACE_DEFINE_ENUM affect trace event types as well")
    Link: https://patch.msgid.link/2e5730d2-c631-da41-3a3a-ae35bb4895f3@allwinnertech.com
    Signed-off-by: Michael Wu <michael@allwinnertech.com>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
udp: fix potential use-after-free in tunnel segmentation [+ + +]
Author: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
Date:   Thu Jul 30 17:35:54 2026 +0800

    udp: fix potential use-after-free in tunnel segmentation
    
    [ Upstream commit d0f86fb36eb260abd10007b62c9dcc1028e03e61 ]
    
    __skb_udp_tunnel_segment() gets the UDP header before ensuring the
    tunnel header is in the skb head. If the pull reallocates skb->head,
    the saved UDP header pointer is no longer valid.
    
    Get the UDP header after the pull to avoid a potential use-after-free.
    
    Fixes: dbef491ebe7f ("udp: Use uh->len instead of skb->len to compute checksum in segmentation")
    Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
    Reviewed-by: Antoine Tenart <atenart@kernel.org>
    Link: https://patch.msgid.link/20260730093554.68127-1-xuanqiang.luo@linux.dev
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
usb: atm: cxacru: properly kill rcv_urb on error in cxacru_cm() [+ + +]
Author: Aleksandr Nogikh <nogikh@google.com>
Date:   Fri Jul 31 10:15:20 2026 +0000

    usb: atm: cxacru: properly kill rcv_urb on error in cxacru_cm()
    
    commit c2f811314be351d86b6ab41e9297ae80d8da6f86 upstream.
    
    If cxacru_cm() encounters an error while submitting or waiting for snd_urb,
    it aborts and returns the error without killing the already submitted
    rcv_urb. This leaves the rcv_urb active.
    
    When this happens during initialization (e.g., in cxacru_atm_start()), the
    driver may ignore the error and proceed to call cxacru_poll_status(), which
    invokes cxacru_cm() again. Attempting to submit the still-active rcv_urb
    triggers a warning in usb_submit_urb():
    
    cxacru 1-1:1.0: send of cm 0x84 failed (-104)
    ATM dev 0: cxacru_atm_start: CHIP_ADSL_LINE_START returned -104
    ------------[ cut here ]------------
    URB ffff88812658d200 submitted while active
    WARNING: drivers/usb/core/urb.c:379 at usb_submit_urb+0x79/0x18b0
    drivers/usb/core/urb.c:379
    ...
    Call Trace:
     <TASK>
     cxacru_cm+0x21a/0xf10 drivers/usb/atm/cxacru.c:631
     cxacru_cm_get_array drivers/usb/atm/cxacru.c:722 [inline]
     cxacru_poll_status+0x178/0x1110 drivers/usb/atm/cxacru.c:828
     cxacru_atm_start+0x185/0x360 drivers/usb/atm/cxacru.c:814
     usbatm_atm_init+0x144/0x3a0 drivers/usb/atm/usbatm.c:927
     usbatm_usb_probe+0x15cb/0x1db0 drivers/usb/atm/usbatm.c:1178
     cxacru_usb_probe+0x17f/0x220 drivers/usb/atm/cxacru.c:1370
    ...
    
    To fix this, ensure that rcv_urb is properly killed if cxacru_cm() aborts
    early. We can safely call usb_kill_urb() on rcv_urb in the error path, as
    it is safe to call even if the URB is not active (e.g., if it failed to
    submit in the first place, or if it already completed).
    
    Fixes: 1b0e61465234 ("[PATCH] USB ATM: driver for the Conexant AccessRunner chipset cxacru")
    Cc: stable <stable@kernel.org>
    Assisted-by: Gemini:gemini-3.5-flash Gemini:gemini-3.1-pro-preview syzbot
    Reported-by: syzbot+c9dff578c3a41775176a@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=c9dff578c3a41775176a
    Link: https://syzkaller.appspot.com/ai_job?id=75fec6f2-c8a6-43b1-b184-4d26baba86cc
    Signed-off-by: Aleksandr Nogikh <nogikh@google.com>
    Link: https://patch.msgid.link/91edfa4c-a63d-400c-9f00-31f3e1f98c00@mail.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: cdnsp: fix incorrect endian conversions for APB timeout register [+ + +]
Author: Pawel Laszczak <pawell@cadence.com>
Date:   Mon Jul 20 13:11:58 2026 +0200

    usb: cdnsp: fix incorrect endian conversions for APB timeout register
    
    commit 50b303f3d0f7de543ee90d50879970783d06da33 upstream.
    
    readl() already returns a CPU-endian value. Passing its return value to
    le32_to_cpu() is therefore redundant and causes an incorrect double byte
    swap on big-endian systems.
    
    Similarly, writel() expects a CPU-endian value, so passing the result of
    cpu_to_le32() is incorrect.
    
    Remove the unnecessary conversions and operate on the MMIO register value
    as a CPU-endian u32.
    
    Fixes: 241e2ce88e5a ("usb: cdnsp: Fix issue with resuming from L1")
    Suggested-by: Arnd Bergmann <arnd@arndb.de>
    Cc: stable <stable@kernel.org>
    Signed-off-by: Pawel Laszczak <pawell@cadence.com>
    Acked-by: Arnd Bergmann <arnd@arndb.de>
    Link: https://patch.msgid.link/20260720-endian-fix-v1-v1-1-b5681fa1ea9f@cadence.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: gadget: f_ncm: Use unsigned int for ndp_index [+ + +]
Author: Sonali Pradhan <sonalipradhan@google.com>
Date:   Mon Jul 20 16:56:54 2026 +0000

    usb: gadget: f_ncm: Use unsigned int for ndp_index
    
    commit 6b1c8a9403a26cb0fed7a648916c74dc236da591 upstream.
    
    The variable ndp_index is declared as a signed integer, but it stores
    the return value of get_ncm(), which is unsigned.
    
    A malicious host can supply a large offset that overflows the signed
    ndp_index, making it negative. Because ndp_index is compared against
    unsigned bounds, this negative value bypasses sanity checks and leads
    to an out-of-bounds read when calculating the address of the NDP
    block (ntb_ptr + ndp_index).
    
    Fix this by changing ndp_index to unsigned int to ensure consistent
    unsigned comparisons throughout the function.
    
    Fixes: 370af734dfaf ("usb: gadget: NCM: RX function support multiple NDPs")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Sonali Pradhan <sonalipradhan@google.com>
    Link: https://patch.msgid.link/20260720165654.2224591-1-sonalipradhan@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
vdpa/mlx5: Fix buffer length in create_direct_keys() [+ + +]
Author: Christian Borntraeger <borntraeger@linux.ibm.com>
Date:   Mon Jul 6 16:15:37 2026 +0200

    vdpa/mlx5: Fix buffer length in create_direct_keys()
    
    [ Upstream commit 727e1f569855df83579edbd73dcb4a0723543a12 ]
    
    We have seen in our CI the following KASAN message:
    BUG: KASAN: slab-out-of-bounds in cmd_exec+0x550/0xca0 [mlx5_core]
    Read of size 272 at addr 0000000176795020 by task qemu-system-s39/82764
    [...]
    [<000011388ab3a7a0>] cmd_exec+0x550/0xca0 [mlx5_core]
    [<000011388ab3b61c>] mlx5_cmd_exec_cb+0x25c/0x4f0 [mlx5_core]
    [<000011388b21e82e>] mlx5_vdpa_exec_async_cmds+0x22e/0x5e0 [mlx5_vdpa]
    [<000011388b21fd44>] create_direct_keys+0x954/0xef0 [mlx5_vdpa]
    [...]
    The buggy address is located 4128 bytes inside of
    allocated 4384-byte region [0000000176794000, 0000000176795120)
    
    So in essence we read 16 bytes beyond 4384-byte allocation.
    create_direct_keys calculates the pointer and length for in and out
    buffers.
    The size calculation for in includes the entire structure
    size (out + in + mtt[]) but the pointer passed to cmd_exec points only
    to the 'in' field, skipping the 'out' field.
    
    This causes mlx5_copy_to_msg() to read beyond the allocated buffer
    by sizeof(out) bytes when copying command data.
    
    Properly calculate the input size to match the pointer and allocation size.
    
    Fixes: 0071b138d44a ("vdpa/mlx5: Create direct MKEYs in parallel")
    Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
    Tested-by: Dragos Tatulea <dtatulea@nvidia.com>
    Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Message-ID: <20260706141537.3510294-1-borntraeger@linux.ibm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
veth: fix skb length accounting after XDP frag adjustment [+ + +]
Author: Sun Jian <sun.jian.kdev@gmail.com>
Date:   Mon Aug 3 22:40:39 2026 -0700

    veth: fix skb length accounting after XDP frag adjustment
    
    commit cb6379feaaff11c4e1e79c26c745ffa23182768a upstream.
    
    veth exposes non-linear skb fragments through an xdp_buff. If an XDP
    program adjusts the fragment area, veth_xdp_rcv_skb() copies
    xdp_frags_size back to skb->data_len but leaves skb->len containing the
    old fragment contribution.
    
    After a fragment shrink, this makes skb_headlen() larger than the actual
    linear area. In the reproduced UDP receive path, __skb_datagram_iter()
    copied 1024 bytes past the actual linear tail to userspace, starting at
    struct skb_shared_info. The copied bytes included the affected skb's
    nr_frags, xdp_frags_size, and a kernel pointer from
    skb_shinfo(skb)->frags[0]. Real packet data was displaced by the same
    amount and truncated at the end.
    
    Subtract the old data_len before replacing it and add the new data_len
    afterwards, keeping skb->len and skb->data_len synchronized.
    
    Additionally, bpf_xdp_pull_data() can advance data_end while leaving
    frags present. The skb is then still non-linear, so the old
    __skb_put(skb, off) triggers SKB_LINEAR_ASSERT().
    
    Use skb_set_tail_pointer() and update skb->len explicitly instead,
    following bpf_prog_run_generic_xdp(). Unlike __skb_put(),
    skb_set_tail_pointer() does not require a linear skb.
    
    A 60000-byte UDP datagram on a veth pair with MTU 64000 was shortened by
    1024 bytes from its fragment area. Before the fix, all 10 runs produced
    corrupted payloads. After the fix, all 10 runs matched the expected
    payload exactly. A forced-tailroom reproducer also exercises
    bpf_xdp_pull_data() with frags still present; the old code triggers
    SKB_LINEAR_ASSERT(), while this fix passes 10/10 runs.
    
    Fixes: 718a18a0c8a6 ("veth: Rework veth_xdp_rcv_skb in order to accept non-linear skb")
    Cc: stable@vger.kernel.org
    Reported-by: Mohsin Bashir <mohsin.bashr@gmail.com>
    Link: https://lore.kernel.org/bpf/80687d9c-9c27-494c-b3f2-efd0230b1895@gmail.com/
    Suggested-by: Lorenzo Bianconi <lorenzo@kernel.org>
    Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
    Signed-off-by: Sun Jian <sun.jian.kdev@gmail.com>
    Link: https://patch.msgid.link/20260804054040.613675-3-sun.jian.kdev@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
vhost/vdpa: reject overflowing PA map page counts on 32-bit [+ + +]
Author: Yousef Alhouseen <alhouseenyousef@gmail.com>
Date:   Wed Jun 24 15:02:02 2026 -0700

    vhost/vdpa: reject overflowing PA map page counts on 32-bit
    
    [ Upstream commit 0619aaa34c0c2a2dcb07f0e9c8a34e7efb8c4cdf ]
    
    vhost_vdpa_pa_map() adds the IOVA page offset to the user-controlled map
    size before computing the number of pages to pin. On 32-bit systems,
    where unsigned long is narrower than u64, that addition can overflow and
    the code can pin and map fewer pages than the requested IOTLB range.
    
    Reject sizes that overflow the unsigned long page-count calculation.
    
    Fixes: 22af48cf91aa ("vdpa: factor out vhost_vdpa_pa_map() and vhost_vdpa_pa_unmap()")
    Acked-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Yousef Alhouseen <alhouseenyousef@gmail.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Message-ID: <CAMuQ4bX-iDvcUOPPY+NLz95tkRJYwWqvzAr=U48uNaub_HZLGw@mail.gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
vhost: reset the vring metadata cache on vring reconfiguration [+ + +]
Author: Jun Yang <junvyyang@tencent.com>
Date:   Mon Aug 3 09:45:14 2026 +0800

    vhost: reset the vring metadata cache on vring reconfiguration
    
    commit de845981da67a6b049080c87e605130b0c30adc5 upstream.
    
    vq->meta_iotlb[] caches the vhost_iotlb_map that backs each vring
    metadata region, and iotlb_access_ok() returns early on a cache hit,
    taking the hit as proof that the region has already been validated:
    
            if (vhost_vq_meta_fetch(vq, addr, len, type))
                    return true;
    
    The cache is reset on VHOST_IOTLB_UPDATE and VHOST_IOTLB_INVALIDATE, on
    device IOTLB (re)initialisation and on vq reset, but not when
    VHOST_SET_VRING_ADDR replaces vq->desc, vq->avail and vq->used, nor when
    VHOST_SET_VRING_NUM changes the region sizes.
    
    With a device IOTLB attached both ioctls are accepted while the vq is
    live, and neither validates the addresses at ioctl time: vq_access_ok()
    and vq_log_used_access_ok() return true early because the addresses are
    GIOVAs, deferring validation to prefetch time.  Once the cache has been
    populated that deferred validation no longer runs -- vq_meta_prefetch()
    hits the stale entry and returns true -- and vhost_vq_meta_fetch() keeps
    translating through the old mapping as
    
            map->addr + addr - map->start
    
    for an address the mapping no longer covers.  vhost_copy_to_user() and
    vhost_copy_from_user() consume the result with __copy_to_user() and
    __copy_from_user(), which do not check it either, so a subsequent used
    ring update or descriptor fetch accesses memory outside the region the
    IOTLB actually maps.
    
    Reset the metadata cache whenever the vring is reconfigured, so the new
    addresses are pushed back through iotlb_access_ok()'s slow path.
    
    Fixes: f88949138058 ("vhost: introduce O(1) vq metadata cache")
    Cc: stable@vger.kernel.org
    Assisted-by: tencentos-corvus-ai:kimi-k3
    Signed-off-by: Jun Yang <junvyyang@tencent.com>
    Message-ID: <20260803014823.68623-1-juny24602@gmail.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
vsock/virtio: avoid refilling the RX queue after teardown [+ + +]
Author: Weiming Shi <bestswngs@gmail.com>
Date:   Wed Jul 29 12:16:55 2026 -0700

    vsock/virtio: avoid refilling the RX queue after teardown
    
    commit a31e0ad444698d8aa7534a0f89fda543730f97a5 upstream.
    
    Commit b917507e5ad9 ("vsock/virtio: stop workers during the .remove()")
    made the RX worker jump to its common exit when rx_run is clear.  That
    exit still refills the RX queue when the buffer count is low, so work
    queued across virtio_vsock_vqs_del() can add buffers after the virtqueues
    have been deleted.
    
    BUG: KASAN: slab-use-after-free in virtqueue_add_sgs
    Read of size 4 by task kworker/0:1
    Workqueue: virtio_vsock virtio_transport_rx_work
    Call Trace:
     virtqueue_add_sgs (drivers/virtio/virtio_ring.c:2796)
     virtio_vsock_rx_fill (net/vmw_vsock/virtio_transport.c:332)
     virtio_transport_rx_work (net/vmw_vsock/virtio_transport.c:701)
     process_one_work (kernel/workqueue.c:3314)
     worker_thread (kernel/workqueue.c:3478)
     kthread (kernel/kthread.c:436)
     ret_from_fork (arch/x86/kernel/process.c:158)
     ret_from_fork_asm (arch/x86/entry/entry_64.S:245)
    ...
    Freed by task 141:
     kfree (mm/slub.c:6566)
     vp_del_vq (drivers/virtio/virtio_pci_common.c:259)
     vp_del_vqs (drivers/virtio/virtio_pci_common.c:285)
     virtio_vsock_freeze (net/vmw_vsock/virtio_transport.c:912)
     virtio_device_freeze (drivers/virtio/virtio.c:658)
     virtio_pci_freeze (drivers/virtio/virtio_pci_common.c:601)
     pci_pm_freeze (drivers/pci/pci-driver.c:1098)
     device_suspend (drivers/base/power/main.c:1968)
    Kernel panic - not syncing: KASAN: panic_on_warn set ...
    
    Jump to a no-refill exit when rx_run is clear, leaving the normal exit
    to replenish a running queue.
    
    Fixes: b917507e5ad9 ("vsock/virtio: stop workers during the .remove()")
    Cc: stable@vger.kernel.org
    Reported-by: Xiang Mei <xmei5@asu.edu>
    Link: https://lore.kernel.org/r/20260727035804.1860862-1-bestswngs@gmail.com
    Suggested-by: Stefano Garzarella <sgarzare@redhat.com>
    Signed-off-by: Weiming Shi <bestswngs@gmail.com>
    Reviewed-by: Bobby Eshleman <bobbyeshleman@meta.com>
    Link: https://patch.msgid.link/f9c8c1d64cad9d262f305d02ffe164c2f900fadf.1785352330.git.bestswngs@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

vsock/virtio: read virtqueues under worker locks [+ + +]
Author: Weiming Shi <bestswngs@gmail.com>
Date:   Wed Jul 29 12:16:54 2026 -0700

    vsock/virtio: read virtqueues under worker locks
    
    commit ebac8f6b1ef0e9278afe204b8692a7479988dace upstream.
    
    Commit bd50c5dc182b ("vsock/virtio: add support for device
    suspend/resume") made the *_run flags transition from false to true when
    restore installs replacement virtqueues.  The RX, TX and event workers
    read their virtqueue before locking and checking the corresponding flag,
    so a worker delayed across freeze and restore can observe the replacement
    queue's running state while retaining a pointer to the deleted queue.
    
    Read each virtqueue under its mutex after checking the run flag, keeping
    the pointer and state in the same queue generation.
    
    Fixes: bd50c5dc182b ("vsock/virtio: add support for device suspend/resume")
    Cc: stable@vger.kernel.org
    Reported-by: Xiang Mei <xmei5@asu.edu>
    Link: https://lore.kernel.org/r/20260727035804.1860862-1-bestswngs@gmail.com
    Signed-off-by: Weiming Shi <bestswngs@gmail.com>
    Reviewed-by: Bobby Eshleman <bobbyeshleman@meta.com>
    Link: https://patch.msgid.link/e79f68ad9284c983364fc3ac46904b6d9ef50231.1785352330.git.bestswngs@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
vt: add permission check for KDSKBMETA ioctl [+ + +]
Author: Joshua Rogers <linux@joshua.hu>
Date:   Fri Jul 31 09:56:17 2026 +0200

    vt: add permission check for KDSKBMETA ioctl
    
    commit a7ad0034453ba4c353f9b8f810ee2569de33d283 upstream.
    
    KDSKBMETA modifies keyboard meta mode but lacks the !perm check that all
    other keyboard setter ioctls in vt_k_ioctl() enforce, allowing a process
    to change meta mode on a non-controlling console without authorization.
    
    Assisted-by: AISLE:Snapshot
    Cc: stable <stable@kernel.org>
    Signed-off-by: Joshua Rogers <linux@joshua.hu>
    Link: https://patch.msgid.link/20260731-tty-vt-stuff-v1-2-be99b9da8e30@linuxfoundation.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

vt: stabilize tty reference in kbd_keycode with tty_port_tty_get [+ + +]
Author: Joshua Rogers <linux@joshua.hu>
Date:   Fri Jul 31 09:56:16 2026 +0200

    vt: stabilize tty reference in kbd_keycode with tty_port_tty_get
    
    commit e25d47a526939ad44b75f778b8a7500562b84fc1 upstream.
    
    kbd_keycode() reads vc->port.tty without acquiring a tty reference,
    racing against con_shutdown() which clears port.tty under a different
    lock. Use tty_port_tty_get()/tty_kref_put() to hold a proper reference
    for the duration the tty pointer is needed.
    
    Assisted-by: AISLE:Snapshot
    Signed-off-by: Joshua Rogers <linux@joshua.hu>
    Cc: stable <stable@kernel.org>
    Link: https://patch.msgid.link/20260731-tty-vt-stuff-v1-1-be99b9da8e30@linuxfoundation.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
vxlan: do not arm the ageing timer on a device that is down [+ + +]
Author: Baul Lee <baul.lee@xbow.com>
Date:   Sun Aug 9 20:18:29 2026 +0900

    vxlan: do not arm the ageing timer on a device that is down
    
    commit b37971686ec59fb027fa4910ba16805e68fddb97 upstream.
    
    vxlan_changelink() arms vxlan->age_timer whenever the requested ageing
    interval differs from the configured one:
    
            if (conf.age_interval != vxlan->cfg.age_interval)
                    mod_timer(&vxlan->age_timer, jiffies);
    
    There is no netif_running() test, so the timer is armed even on a device
    that was never brought up.  The only synchronous cancel in the driver is
    the timer_delete_sync() in vxlan_stop(), which is .ndo_stop.
    netif_close_many() drops devices without IFF_UP before
    __dev_close_many() runs, so that cancel is skipped for such a device.
    
    vxlan_setup() sets dev->needs_free_netdev = true and age_timer is a
    member of struct vxlan_dev, so free_netdev() releases the allocation the
    timer lives in while it is still queued on a timer_base.
    expire_timers() unlinks the entry before it loads timer->function, so
    the timer core writes through the freed object's list pointers:
    
      BUG: KASAN: slab-use-after-free in __run_timers+0x208/0x654
      Write of size 8 at addr ffff00001adace68 by task true/192
       __asan_store8+0x84/0xac
       __run_timers+0x208/0x654
       run_timer_softirq+0x154/0x18c
      Allocated by task 189:
       alloc_netdev_mqs+0x64/0x720
       rtnl_create_link+0x4ac/0x520
       rtnl_newlink+0x758/0xd00
      Freed by task 191:
       netdev_release+0x40/0x58
       netdev_run_todo+0x4a4/0x8c0
       rtnl_dellink+0x200/0x4e8
    
    The rtnl operations involved are netns-scoped, so an unprivileged user
    can perform them in a new user and network namespace.
    
    Arming the timer on a down device never had an effect: vxlan_cleanup()
    returns early on !netif_running(), and vxlan_open() arms the timer for
    any non-zero interval once the device is brought up.  Add the missing
    test.
    
    Discovered by XBOW, triaged by Baul Lee <baul.lee@xbow.com>
    
    Fixes: 40051c4dcad5 ("vxlan: Allow changing ageing time")
    Cc: stable@vger.kernel.org
    Signed-off-by: Baul Lee <baul.lee@xbow.com>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Link: https://patch.msgid.link/20260809111829.78834-1-baul.lee@xbow.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
watchdog: bd96801_wdt: Fix timeout for enabled WDG [+ + +]
Author: Matti Vaittinen <mazziesaccount@gmail.com>
Date:   Fri Jul 31 12:36:28 2026 +0300

    watchdog: bd96801_wdt: Fix timeout for enabled WDG
    
    [ Upstream commit 1246aa2b6ccc8944676bd24ff3e37cc56b93b51b ]
    
    When watchdog is enabled at the probe time, the bd96801 driver retrieves
    the timeout configuration from the registers to set-up the heart-beat
    values.
    
    As Sashiko pointed out at
    https://lore.kernel.org/all/20260722085819.495211F000E9@smtp.kernel.org/
    the timeout values are incorrectly computed in driver, resulting wrong
    heartbeat. This leads to devere problems if watchdog was enabled at probe
    time.
    
    According to the data-sheet, the "too fast" ping limit is configured as
    multiple of FASTNG_MIN. Furthermore, the "too slow" ping limit is
    configured as multiples of "too fast" timeout. The FASTNG_MIN is set to
    11, meaning 1.1 mS and "too fast" and "too slow" limits are computed from
    this. Hence, converting the limits to mS should be done by dividing by 10,
    not by dividing by USEC_PER_MSEC.
    
    Fix this by dividing the timeout values with correct scaling factor.
    
    While at it, fix whitespace problem (double empty line).
    
    Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
    Fixes: 09dad69757b6 ("watchdog: ROHM BD96801 PMIC WDG driver")
    Link: https://lore.kernel.org/r/amxskHmQbi9v-8_l@mva-rohm
    [groeck: Added reference to whitespace change to description]
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
xdp: reject clones that overrun skb_shared_info tailroom [+ + +]
Author: Zhiling Zou <zhilinz@nebusec.ai>
Date:   Mon Aug 3 20:15:32 2026 +0800

    xdp: reject clones that overrun skb_shared_info tailroom
    
    commit e48e8edbef2eb824201495daa5234560f632b23c upstream.
    
    xdpf_clone() clones broadcast copies into a single page and sets
    frame_sz to PAGE_SIZE. __xdp_build_skb_from_frame() later treats that
    page like a normal XDP frame and expects the usual skb_shared_info
    tailroom at the end of the buffer.
    
    The current check only rejects frames whose linear xdp_frame header,
    headroom, and packet data exceed PAGE_SIZE. A source frame backed by a
    larger allocation can still satisfy that check while extending into the
    clone's required shared-info area. When such a clone is converted back
    into an skb, build_skb_around() places skb_shared_info over live packet
    bytes and later writes can corrupt XDP return metadata.
    
    Reject clones unless their linear area fits inside
    SKB_WITH_OVERHEAD(PAGE_SIZE), matching the tailroom requirement already
    enforced by the XDP-to-skb conversion path.
    
    Fixes: e624d4ed4aa8 ("xdp: Extend xdp_redirect_map with broadcast support")
    Cc: stable@vger.kernel.org
    Reported-by: Vega <vega@nebusec.ai>
    Signed-off-by: Zhiling Zou <zhilinz@nebusec.ai>
    Link: https://patch.msgid.link/6b2afef5d1738763c6965e8e466eb16e43e4f956.1785757386.git.zhilinz@nebusec.ai
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
xsk: require at least 16 bytes of TX metadata [+ + +]
Author: Stanislav Fomichev <sdf.kernel@gmail.com>
Date:   Mon Jul 27 09:19:54 2026 -0700

    xsk: require at least 16 bytes of TX metadata
    
    [ Upstream commit 1bb30b181d9f0484e141f8411e15ed906d5c6780 ]
    
    AF_XDP accepts a TX metadata length as small as eight bytes, but every
    supported request needs the flags plus at least one eight-byte request
    field. Such short metadata also lets the kernel read beyond the registered
    area.
    
    Require 16 bytes rather than sizeof(struct xsk_tx_metadata) to preserve
    compatibility with applications that do not use launch-time metadata.
    
    Fixes: 341ac980eab9 ("xsk: Support tx_metadata_len")
    Reported-by: AutonomousCodeSecurity@microsoft.com
    Reported-by: Cen Zhang (Microsoft) <blbllhy@gmail.com>
    Link: https://lore.kernel.org/netdev/20260720155210.34229-1-blbllhy@gmail.com/
    Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
    Link: https://patch.msgid.link/20260727161959.885642-2-sdf@fomichev.me
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>