Changelog in Linux kernel 6.18.44

 
accel/qaic: use sizeof(*trans_hdr) for transaction length check [+ + +]
Author: Muhammad Bilal <[email protected]>
Date:   Thu Jun 18 02:25:20 2026 +0500

    accel/qaic: use sizeof(*trans_hdr) for transaction length check
    
    [ Upstream commit d6c075f797a672a6e3bd2fd44aee713801698ec2 ]
    
    In encode_message() the per-transaction lower-bound check compares
    trans_hdr->len against sizeof(trans_hdr), i.e. the size of the pointer,
    instead of sizeof(*trans_hdr), the size of struct qaic_manage_trans_hdr.
    
    Every other length check in this file (encode_message() at the loop
    guard, decode_message(), etc.) correctly uses sizeof(*trans_hdr), so
    this is an inconsistency. On 64-bit builds the pointer and the struct
    are both 8 bytes, so the check is correct by coincidence and there is
    no behavioural change. On 32-bit builds the pointer is 4 bytes, which
    weakens the minimum-length check below the 8-byte header size.
    
    Use sizeof(*trans_hdr) so the check validates against the actual
    transaction header size on all builds.
    
    Fixes: ea33cb6fc278 ("accel/qaic: tighten bounds checking in encode_message()")
    Signed-off-by: Muhammad Bilal <[email protected]>
    Reviewed-by: Jeff Hugo <[email protected]>
    Signed-off-by: Jeff Hugo <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
af_unix: fix listen() succeeding on sockets in the wrong state [+ + +]
Author: John Ericson <[email protected]>
Date:   Sat Jul 18 14:29:01 2026 -0400

    af_unix: fix listen() succeeding on sockets in the wrong state
    
    [ Upstream commit f0d9c3ffc2b5fc2ffacb56b3036155ce7a940a12 ]
    
    Commit fd0a109a0f6b ("net, pidfs: prepare for handing out pidfds for
    reaped sk->sk_peer_pid") inserted a prepare_peercred() call between err
    = -EINVAL and the socket-state check in unix_listen(). Since
    prepare_peercred() leaves err at 0 on success, listen() on an AF_UNIX
    socket that is not in TCP_CLOSE or TCP_LISTEN state (e.g. one that is
    already connected) now silently returns success without doing anything,
    instead of failing with EINVAL as it did before.
    
    Fixes: fd0a109a0f6b ("net, pidfs: prepare for handing out pidfds for reaped sk->sk_peer_pid")
    Signed-off-by: John Ericson <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
afs: Fix afs_fs_fetch_data() to set call->async [+ + +]
Author: David Howells <[email protected]>
Date:   Thu Jul 23 12:34:46 2026 +0100

    afs: Fix afs_fs_fetch_data() to set call->async
    
    commit d568a43f6dbba3ba006304d95fd09862bd482a2f upstream.
    
    Fix afs_fs_fetch_data() to set call->async on an async operation as does
    afs_fs_fetch_data64().
    
    Fixes: eddf51f2bb2c ("afs: Make {Y,}FS.FetchData an asynchronous operation")
    Link: https://sashiko.dev/#/patchset/20260702144919.172295-1-dhowells%40redhat.com
    Signed-off-by: David Howells <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    cc: Marc Dionne <[email protected]>
    cc: Jeffrey Altman <[email protected]>
    cc: [email protected]
    cc: [email protected]
    Signed-off-by: Christian Brauner (Amutable) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

afs: Fix afs_fs_fetch_data() to subtract transferred from len [+ + +]
Author: David Howells <[email protected]>
Date:   Thu Jul 23 12:34:47 2026 +0100

    afs: Fix afs_fs_fetch_data() to subtract transferred from len
    
    commit 222052c6be186f2074b3a4d741d5de200f654c43 upstream.
    
    Fix afs_fs_fetch_data() to subtract subreq->transferred from subreq->len
    rather than adding it.
    
    Fixes: f28fc2010d62 ("afs: Eliminate afs_read")
    Link: https://sashiko.dev/#/patchset/20260713081022.2186481-1-dhowells%40redhat.com
    Signed-off-by: David Howells <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    cc: Marc Dionne <[email protected]>
    cc: Jeffrey Altman <[email protected]>
    cc: [email protected]
    cc: [email protected]
    Signed-off-by: Christian Brauner (Amutable) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

afs: Fix UAF when sending a message [+ + +]
Author: David Howells <[email protected]>
Date:   Thu Jul 23 12:34:48 2026 +0100

    afs: Fix UAF when sending a message
    
    commit 4af1ec68d54b3871155914d584fb10669c41a861 upstream.
    
    In afs_make_call(), there's a race with async call reception and
    destruction.  If a call is dispatched that doesn't have call->write_iter
    set (used to specify the data content for FS.StoreData), then the first
    rxrpc_kernel_send_data() will not set MSG_MORE in the msghdr.
    
    Once rxrpc_send_data() queues the last request packet, the response could
    come in at any time and cause the call to be completed and put.  However,
    afs_make_call() will look at the call again to see it ->write_iter should
    be handled - something it's only allowed to do if it has its own ref on the
    call.  Whilst this is the case for synchronous calls, it isn't true for
    async calls such as FS.FetchData.
    
    There's also a potential UAF in afs_make_call() in the event that an
    asynchronous call is being sent, but the call fails in some way (e.g. it
    gets aborted from the server).  The problem there is that afs_make_call()
    tries to abort a call if the rxrpc send fails, but the asynchronous
    notification from rxrpc may have caused the afs_call to be torn down.
    
    generic/650 plays games with randomly taking CPUs offline, and can
    interject a significant delay such that the call is deallocated before
    afs_make_call() gets to check call->write_iter - and a UAF ensues (caught
    by KASAN).
    
       BUG: KASAN: slab-use-after-free in afs_make_call+0x1c90/0x2210 [kafs]
       Read of size 8 at addr ffff888035e050e8 by task fsstress/1409
    
    Fix this by making afs_make_op_call() give the op->call its own ref rather
    than transferring the caller's ref to it and then dropping the ref when
    afs_make_call() returns.
    
    This also means that the afs_make_call() func never loses its ref on the
    call now.
    
    Fixes: eddf51f2bb2c ("afs: Make {Y,}FS.FetchData an asynchronous operation")
    Fixes: e49c7b2f6de7 ("afs: Build an abstraction around an "operation" concept")
    Link: https://sashiko.dev/#/patchset/20260702144919.172295-1-dhowells%40redhat.com
    Reported-by: Marc Dionne <[email protected]>
    Signed-off-by: David Howells <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    cc: Jeffrey Altman <[email protected]>
    cc: [email protected]
    cc: [email protected]
    Signed-off-by: Christian Brauner (Amutable) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ALSA: 6fire: Fix UAF at error handling during probe [+ + +]
Author: Takashi Iwai <[email protected]>
Date:   Sun Jul 26 09:48:19 2026 +0200

    ALSA: 6fire: Fix UAF at error handling during probe
    
    commit a54bf16965f896415c3337bc4fbb40fb11941d99 upstream.
    
    Although 6fire driver had a few fixes for dealing with the early error
    handling during the probe phase, it forgot a pending URB before
    freeing the resources, which may lead to a UAF.
    
    This patch addresses it by doing the almost same cleanup procedure
    like the normal disconnect phase at the error path.
    
    Reported-and-tested-by: Shuangpeng Bai <[email protected]>
    Closes: https://lore.kernel.org/[email protected]
    Cc: <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: hda/realtek: add quirk for HP Dragonfly Folio G3 2-in-1 [+ + +]
Author: Fabian Lippold <[email protected]>
Date:   Tue May 26 17:41:01 2026 +0200

    ALSA: hda/realtek: add quirk for HP Dragonfly Folio G3 2-in-1
    
    [ Upstream commit 0a10faad5ca58332ad70f7663ba82611f4daf736 ]
    
    Add PCI quirk for HP Dragonfly Folio G3 (PCI ID 103c:8a06) to select the
    CS35L41 SPI4 & GPIO LED fixup variant.
    
    Signed-off-by: Fabian Lippold <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ALSA: hda/realtek: Add quirk for TongFang X6SP45xU [+ + +]
Author: Eckhart Mohr <[email protected]>
Date:   Fri Jul 24 21:00:13 2026 +0200

    ALSA: hda/realtek: Add quirk for TongFang X6SP45xU
    
    commit 26a94400ffa4fcbeff32e23abebb83a1a20eb401 upstream.
    
    TongFang X6KK45xU and X6SP45xU have actually different PCI IDs. This patch
    Adds the missing PCI ID to fix headphone detection and clarifies the
    naming.
    
    Fixes: d595255241e5 ("ALSA: hda/realtek: Add quirk for TongFang X6xx45xU")
    Signed-off-by: Eckhart Mohr <[email protected]>
    Cc: [email protected]
    Signed-off-by: Werner Sembach <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: lx6464es: fix period byte count for 16-bit streams [+ + +]
Author: Xu Rao <[email protected]>
Date:   Thu Jul 23 16:57:10 2026 +0800

    ALSA: lx6464es: fix period byte count for 16-bit streams
    
    commit 6437033bffe8bd2af174d139af552d90d40c7ac6 upstream.
    
    The lx6464es driver advertises both 16-bit and packed 24-bit PCM formats,
    but lx_trigger_start() and lx_interrupt_request_new_buffer() calculate the
    DMA period size as runtime->period_size * runtime->channels * 3.  That is
    only correct for the packed 24-bit formats.
    
    For 16-bit streams the driver submits buffers that are 50% larger than the
    actual ALSA period and advances the DMA address by the same wrong amount.
    For example, with 2 channels, 256 frames and 4 periods, the third buffer
    already extends beyond the ALSA buffer and the fourth buffer starts outside
    it.
    
    Use snd_pcm_lib_period_bytes() so the byte count matches the runtime
    format, channel count and period size.
    
    Fixes: 02bec4904508 ("ALSA: lx6464es - driver for the digigram lx6464es interface")
    Cc: [email protected]
    Signed-off-by: Xu Rao <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: pcm: wake linked drain waiters on unlink [+ + +]
Author: Norbert Szetei <[email protected]>
Date:   Tue Jul 28 14:50:01 2026 +0200

    ALSA: pcm: wake linked drain waiters on unlink
    
    commit f495b6c4c8594122918552c9be2b51eb71647cd9 upstream.
    
    snd_pcm_drain() on a linked stream parks an on-stack wait entry on the
    drained peer's runtime->sleep, and after schedule_timeout() removes it
    only if that peer is still found in the caller's group.  If group
    membership changes during the wait and the sleep ends by signal or
    timeout (so autoremove_wake_function() does not run), finish_wait() is
    skipped and snd_pcm_drain() returns with the entry still queued on that
    stream's sleep list; a later wake_up() then walks a freed stack frame.
    This is reachable by unlinking either the drained or the draining stream.
    
    Unlike the close path (snd_pcm_drop() -> snd_pcm_post_stop()),
    snd_pcm_unlink() never wakes the sleep queues.  Wake every group member
    under the group lock before the membership change, so a linked drainer is
    released and drops its entry while the streams are still grouped.
    
    The window was opened when snd_pcm_link_rwsem stopped being held across
    the wait and the removal became conditional on group membership (see
    Fixes). The later switch to finish_wait() kept that conditional removal,
    so the signal/timeout case remained.
    
    Fixes: f57f3df03a8e ("ALSA: pcm: More fine-grained PCM link locking")
    Cc: [email protected]
    Assisted-by: Claude:claude-opus-5
    Signed-off-by: Norbert Szetei <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: seq: Fix division by zero in initialize_timer() [+ + +]
Author: Norbert Szetei <[email protected]>
Date:   Sat Jul 25 08:33:45 2026 +0200

    ALSA: seq: Fix division by zero in initialize_timer()
    
    commit 21e19688433452dfbbbe6b2bb670dea6eb92f0f6 upstream.
    
    A userspace-driven ALSA timer (SND_UTIMER) lets an unprivileged user set
    the backing snd_timer's hardware resolution to an arbitrary 64-bit value
    via SNDRV_TIMER_IOCTL_CREATE. snd_utimer_create() only rejects zero.
    
    When such a timer is bound to a sequencer queue, initialize_timer()
    computes the tick period as
    
            tmr->ticks = 1000000000 / (r * freq);
    
    where r is that user-controlled resolution and freq is the sequencer
    update rate in Hz, clamped to MIN_FREQUENCY..MAX_FREQUENCY (10..6250).
    A resolution of 2^63 makes the 64-bit product r * freq wrap to zero for
    any even freq, including DEFAULT_FREQUENCY (1000), so the division faults
    with a divide-by-zero.
    
    The division runs under tmr->lock with interrupts disabled, so the oops
    leaves the spinlock held and hangs the CPU. It is reachable by an
    unprivileged user with access to /dev/snd/timer and /dev/snd/seq.
    
      Oops: divide error: 0000 [#1] SMP KASAN PTI
      CPU: 7 UID: 1000 PID: 456 Comm: alsa_seq_utimer Not tainted 7.2.0-rc4+
      RIP: 0010:initialize_timer.constprop.0+0x20a/0x2d0
       snd_seq_timer_start+0x15e/0x2b0
       snd_seq_control_queue+0x56f/0xba0
       snd_seq_write+0x3e0/0x730
    
    Reject an overflowing product with check_mul_overflow() and fall back to
    a single tick, which also avoids feeding a wrapped-but-nonzero divisor
    (e.g. 2^63 * 1000 mod 2^64 == 0, or other resolutions wrapping to a small
    value) into the period computation.
    
    Fixes: 37745918e0e7 ("ALSA: timer: Introduce virtual userspace-driven timers")
    Cc: <[email protected]>
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: Norbert Szetei <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: timer: Clear SNDRV_TIMER_IFLG_DEAD once the close completes [+ + +]
Author: Norbert Szetei <[email protected]>
Date:   Sun Jul 26 10:01:45 2026 +0200

    ALSA: timer: Clear SNDRV_TIMER_IFLG_DEAD once the close completes
    
    commit c2744d5f3aea474513fd2298daecb94a952ce441 upstream.
    
    snd_timer_close_locked() marks an instance with SNDRV_TIMER_IFLG_DEAD
    and returns early when the flag is already set, but the flag is never
    cleared again.  A completed close ends in remove_slave_links(), which
    leaves timeri->timer NULL, so a second close is already harmless through
    the timer == NULL path; the early return can only be reached by an
    instance that was opened again in between.  For such an instance the
    close unlinks nothing, so snd_timer_instance_free() frees an object that
    is still on timer->open_list_head, still on snd_timer_master_list if it
    was opened with a slave key, still owns any adopted slaves, and still
    holds its timer and module references.
    
    snd_seq_timer_open() reopens an instance exactly like that: it retries
    its fallback open on the same object after a failure that has already
    run snd_timer_close_locked() internally.  An unprivileged user with
    access to /dev/snd/timer and /dev/snd/seq can force that failure, since
    snd_timer_check_master() returns -EBUSY when a pending slave matches the
    new master's (slave_class, slave_id) key and the target timer has
    reached max_instances, and SNDRV_TIMER_IOCTL_SELECT with dev_class =
    SNDRV_TIMER_CLASS_SLAVE keeps the caller-supplied dev_sclass, so a
    sequencer queue's key can be forged.  The freed instance is afterwards
    dereferenced by any further snd_timer_open() on that timer, by
    snd_timer_check_slave(), and by /proc/asound/timers, which faults on the
    stale ti->owner pointer.
    
    The flag only has to be visible while the close is in progress, which is
    all its other users need.  Clear it in remove_slave_links(), under the
    same timer->lock that sets it, once the instance is off every list.
    
    Fixes: da3039e91d1f ("ALSA: timer: Forcibly close timer instances at closing")
    Cc: [email protected]
    Assisted-by: Claude:claude-opus-5
    Signed-off-by: Norbert Szetei <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: ump: fix double free of out_cvts on rawmidi error [+ + +]
Author: Baul Lee <[email protected]>
Date:   Sun Jul 26 14:16:33 2026 +0900

    ALSA: ump: fix double free of out_cvts on rawmidi error
    
    commit 70c977815af0d997feb2d0c5d284d55689bf7051 upstream.
    
    snd_ump_attach_legacy_rawmidi() allocates the legacy conversion array
    ump->out_cvts and, on the snd_rawmidi_new() error path, frees it with
    kfree() but leaves ump->out_cvts pointing at the freed memory.  When the
    endpoint is later torn down, snd_ump_endpoint_free() frees ump->out_cvts
    a second time, resulting in a double free.
    
    The host snd-usb-audio driver attaches the legacy rawmidi for any USB
    MIDI 2.0 (UMP) device, so a device that makes snd_rawmidi_new() fail
    reaches this path on enumeration.
    
    Clear ump->out_cvts after freeing it on the error path so it is not
    freed again during teardown.
    
    Discovered by XBOW, triaged by Baul Lee <[email protected]>
    
    Fixes: 33cd7630782d ("ALSA: ump: Export MIDI1 / UMP conversion helpers")
    Reported-by: Federico Kirschbaum <[email protected]>
    Reported-by: Baul Lee <[email protected]>
    Cc: [email protected]
    Signed-off-by: Baul Lee <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: usb-audio: Clamp frame size in implicit-feedback mode [+ + +]
Author: Sonali Pradhan <[email protected]>
Date:   Tue Jul 28 20:24:32 2026 +0000

    ALSA: usb-audio: Clamp frame size in implicit-feedback mode
    
    commit 8d7a30c50c2e58a6839634ed0acde14466d1dc61 upstream.
    
    snd_usb_handle_sync_urb() scales received sync packet sizes by the sender's
    stride and stores the result directly in out_packet->packet_size[i]. If a
    connected USB device sends an oversized sync packet, this frame count can
    exceed ep->maxframesize.
    
    The un-clamped frame count then propagates to the playback endpoint queue,
    potentially driving packet transfers beyond the endpoint's hardware frame
    limits.
    
    Cap the calculated frame count against ep->maxframesize in
    snd_usb_handle_sync_urb() to prevent oversized packets from entering the
    playback queue.
    
    Fixes: 28acb12014fb ("ALSA: usb-audio: use sender stride for implicit feedback")
    Cc: [email protected]
    Assisted-by: Jetski:Gemini-3.6-Flash
    Signed-off-by: Sonali Pradhan <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: usb-audio: Fix DMA buffer out-of-bounds write when fill_max is set [+ + +]
Author: Sonali Pradhan <[email protected]>
Date:   Tue Jul 28 20:17:16 2026 +0000

    ALSA: usb-audio: Fix DMA buffer out-of-bounds write when fill_max is set
    
    commit d0199ae1666ff9ae2d1d568d64c3430d4c47f0e5 upstream.
    
    When a USB audio endpoint requests full packet transfers via the fill_max
    descriptor flag, data_ep_set_params() promotes ep->curpacksize to
    ep->maxpacksize. However, maxsize is left at the original sample-rate
    derived value.
    
    Since u->buffer_size is allocated as maxsize * packets, the resulting
    DMA buffer is far too small for the requested transfer length. When the
    USB host controller streams up to curpacksize bytes per packet, it writes
    past the end of the buffer via DMA, corrupting kernel heap memory.
    
    Update maxsize to curpacksize when fill_max is set so that the allocated
    DMA buffer size matches the actual transfer request size.
    
    [ changed to reassign maxsize only when ep->fill_max is set -- tiwai ]
    
    Fixes: 8fdff6a319e7 ("ALSA: snd-usb: implement new endpoint streaming model")
    Cc: [email protected]
    Assisted-by: Jetski:Gemini-3.6-Flash
    Signed-off-by: Sonali Pradhan <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: usb-audio: fix OOB write in snd_usbmidi_akai_output() [+ + +]
Author: Baul Lee <[email protected]>
Date:   Sun Jul 26 16:45:00 2026 +0900

    ALSA: usb-audio: fix OOB write in snd_usbmidi_akai_output()
    
    commit 0970274613fb463d376211450cab066d34ebfe6a upstream.
    
    snd_usbmidi_akai_output() computes its fill-loop bound
    
            buf_end = ep->max_transfer - MAX_AKAI_SYSEX_LEN - 1;
    
    as a signed int, so a small device-advertised bulk-OUT max_transfer
    makes buf_end negative.  The loop guard then compares the u32
    urb->transfer_buffer_length against that negative int: the usual
    arithmetic conversion turns buf_end into a large unsigned value, so the
    guard stays true and each iteration keeps appending SysEx framing and
    payload bytes past the end of the URB transfer buffer, which is only
    max_transfer bytes long.
    
    A USB device that advertises a tiny bulk-OUT endpoint can therefore
    trigger an attacker-length- and content-controlled heap out-of-bounds
    write when a process writes to the created /dev/snd/midiC*D* node.
    
    Return early when there is no room for even one SysEx, so the loop is
    never entered with a bound that would wrap.  The loop is the last
    statement of the function, so bailing out is equivalent to it not
    running.
    
    Discovered by XBOW, triaged by Baul Lee <[email protected]>
    
    Fixes: 4434ade8c933 ("ALSA: usb-audio: add support for Akai MPD16")
    Suggested-by: Takashi Iwai <[email protected]>
    Reported-by: Federico Kirschbaum <[email protected]>
    Reported-by: Baul Lee <[email protected]>
    Cc: [email protected]
    Signed-off-by: Baul Lee <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: usb-audio: fix stack info leak in RME Digiface status [+ + +]
Author: Baul Lee <[email protected]>
Date:   Sun Jul 26 15:50:20 2026 +0900

    ALSA: usb-audio: fix stack info leak in RME Digiface status
    
    commit 441aaad150c57edaf57ee482a79a3bf4c5b7e353 upstream.
    
    snd_rme_digiface_read_status() reads a four-word status block from the
    device into an uninitialised on-stack __le32 buf[4] and, whenever the
    vendor control-IN transfer does not return a negative error, copies all
    four words into the caller's status[].
    
    snd_usb_ctl_msg() copies the full requested size back into the caller's
    buffer regardless of how many bytes the data stage actually delivered:
    
            buf = kmemdup(data, size, GFP_KERNEL);
            err = usb_control_msg(dev, pipe, request, requesttype,
                                  value, index, buf, size, timeout);
            memcpy(data, buf, size);
    
    usb_control_msg() returns the transferred length on a short control-IN,
    which is a non-negative value, and writes only that many bytes.  The
    remainder of the copy back is the kmemdup()ed image of the caller's
    buffer, so a device answering with a short data stage leaves the
    trailing words of buf[] holding leftover kernel stack.  The only guard
    in the caller is err < 0, so those words are stored into status[].
    
    They then reach user space: snd_rme_digiface_get_status_val() selects a
    16-bit halfword of status[] per the control's reg/mask, and the eight
    Digiface status controls together expose the whole 16-byte frame to an
    unprivileged reader of /dev/snd/controlC*.
    
    Zero-initialise the buffer so a short read yields zeros instead of stack
    residue.  This mirrors snd_rme_get_status1(), which already clears its
    output word before the same kind of vendor read.
    
    Discovered by XBOW, triaged by Baul Lee <[email protected]>
    
    Fixes: 611a96f6acf2 ("ALSA: usb-audio: Add mixer quirk for RME Digiface USB")
    Reported-by: Federico Kirschbaum <[email protected]>
    Reported-by: Baul Lee <[email protected]>
    Cc: [email protected]
    Signed-off-by: Baul Lee <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: usb-audio: fix use-after-free in ump_to_endpoint() [+ + +]
Author: Baul Lee <[email protected]>
Date:   Sun Jul 26 14:13:37 2026 +0900

    ALSA: usb-audio: fix use-after-free in ump_to_endpoint()
    
    commit 4a05b2d1b4642df74f30b6f54843e825c4a2bfd3 upstream.
    
    create_midi2_ump() registers a card-owned snd_ump_endpoint and stores a
    back-pointer to its per-interface snd_usb_midi2_ump object in
    ump->private_data, but it never installs an ump->private_free hook and
    never clears that pointer.
    
    If a later step of snd_usb_midi_v2_create() fails, its error path calls
    free_all_midi2_umps(), which kfree()s the snd_usb_midi2_ump object while
    the already-registered endpoint keeps pointing at it.  The created
    /dev/snd/umpC*D* node stays exposed, so the first operation of any UMP
    open, ump_to_endpoint(), dereferences the dangling ump->private_data and
    reads rmidi->eps[dir] out of freed memory.
    
    A malicious USB MIDI 2.0 device that makes creation fail after the
    endpoint is registered can thus trigger a slab use-after-free read on a
    subsequent open of the UMP node.
    
    Clear the endpoint's back-pointer before freeing the object, and let
    ump_to_endpoint() tolerate a NULL private_data so the open/close/trigger
    callbacks fail cleanly (their callers already handle a NULL endpoint)
    instead of dereferencing a stale pointer.
    
    Discovered by XBOW, triaged by Baul Lee <[email protected]>
    
    Fixes: ff49d1df79ae ("ALSA: usb-audio: USB MIDI 2.0 UMP support")
    Reported-by: Federico Kirschbaum <[email protected]>
    Reported-by: Baul Lee <[email protected]>
    Cc: [email protected]
    Signed-off-by: Baul Lee <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
arch/x86: mshyperv: Discover Confidential VMBus availability [+ + +]
Author: Roman Kisel <[email protected]>
Date:   Wed Oct 8 16:34:05 2025 -0700

    arch/x86: mshyperv: Discover Confidential VMBus availability
    
    [ Upstream commit 7c8b6c326d830ca5c6b95f390c703966e14167e6 ]
    
    Confidential VMBus requires enabling paravisor SynIC, and
    the x86_64 guest has to inspect the Virtualization Stack (VS)
    CPUID leaf to see if Confidential VMBus is available. If it is,
    the guest shall enable the paravisor SynIC.
    
    Read the relevant data from the VS CPUID leaf. Refactor the
    code to avoid repeating CPUID and add flags to the struct
    ms_hyperv_info. For ARM64, the flag for Confidential VMBus
    is not set which provides the desired behaviour for now as
    it is not available on ARM64 just yet. Once ARM64 CCA guests
    are supported, this flag will be set unconditionally when
    running such a guest.
    
    Signed-off-by: Roman Kisel <[email protected]>
    Reviewed-by: Michael Kelley <[email protected]>
    Signed-off-by: Wei Liu <[email protected]>
    Stable-dep-of: 8c7ab779c885 ("Drivers: hv: vmbus: Replace lockdep_hardirq_threaded() with lockdep annotation")
    Signed-off-by: Sasha Levin <[email protected]>

 
ASoC: fsl_asrc: fix m2m_init error path to use goto instead of bare return [+ + +]
Author: Shengjiu Wang <[email protected]>
Date:   Wed Jul 15 10:47:57 2026 +0800

    ASoC: fsl_asrc: fix m2m_init error path to use goto instead of bare return
    
    commit 890b4253134f3a39883af7d5bea67af9c494c56d upstream.
    
    When fsl_asrc_m2m_init() fails in fsl_asrc_probe(), the code did a
    bare return ret, bypassing pm_runtime_disable() in err_pm_get_sync.
    Use goto err_pm_get_sync to ensure proper cleanup on failure.
    
    Fixes: 286d658477a4 ("ASoC: fsl_asrc: register m2m platform device")
    Cc: [email protected]
    Signed-off-by: Shengjiu Wang <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ASoC: fsl_easrc: fix m2m_init error path to use goto instead of bare return [+ + +]
Author: Shengjiu Wang <[email protected]>
Date:   Wed Jul 15 10:47:58 2026 +0800

    ASoC: fsl_easrc: fix m2m_init error path to use goto instead of bare return
    
    commit a54bc0eef90ea760039c14bb7f3b5db42529f84d upstream.
    
    When fsl_asrc_m2m_init() fails in fsl_easrc_probe(), the code did a
    bare return ret, bypassing pm_runtime_disable() in err_pm_disable.
    Use goto err_pm_disable to ensure proper cleanup on failure.
    
    Fixes: b62eaff0650d ("ASoC: fsl_easrc: register m2m platform device")
    Cc: [email protected]
    Signed-off-by: Shengjiu Wang <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ASoC: max98090: fix missing IS_ERR() before PTR_ERR() on mclk lookup [+ + +]
Author: Uday Khare <[email protected]>
Date:   Mon Jul 20 16:12:54 2026 +0530

    ASoC: max98090: fix missing IS_ERR() before PTR_ERR() on mclk lookup
    
    [ Upstream commit a792ce0fad61a70793ec565743f11d6ca534de59 ]
    
    In max98090_probe(), the -EPROBE_DEFER check after devm_clk_get() is
    broken due to a missing IS_ERR() guard.
    
    The code intends to return -EPROBE_DEFER only when the clock lookup
    fails with that specific error.  However, without IS_ERR() the check:
    
        if (PTR_ERR(max98090->mclk) == -EPROBE_DEFER)
    
    is called unconditionally, including when devm_clk_get() succeeds and
    returns a valid pointer.  Calling PTR_ERR() on a valid pointer
    reinterprets its address as a signed long; the result is arbitrary
    and is almost never equal to -EPROBE_DEFER, so the check silently
    does nothing in the success case.  When devm_clk_get() fails with
    any error other than -EPROBE_DEFER the check is also skipped, leaving
    max98090->mclk holding an error pointer with no indication to the caller.
    
    This means a deferred probe will never actually be triggered for this
    device, and any non-EPROBE_DEFER clock error is silently swallowed with
    the error pointer left in the mclk field.
    
    Fix this by adding the missing IS_ERR() guard around the PTR_ERR() call,
    matching the pattern already used in the sibling max98088 and wm8960
    drivers.
    
    Fixes: b10ab7b838bd ("ASoC: max98090: Add master clock handling")
    Signed-off-by: Uday Khare <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ASoC: max98095: fix missing IS_ERR() before PTR_ERR() on mclk lookup [+ + +]
Author: Uday Khare <[email protected]>
Date:   Mon Jul 20 16:09:50 2026 +0530

    ASoC: max98095: fix missing IS_ERR() before PTR_ERR() on mclk lookup
    
    [ Upstream commit 317e21532e6ffa1de026bdbce5ba98e1b70ca5c6 ]
    
    In max98095_probe(), the -EPROBE_DEFER check after devm_clk_get() is
    broken due to a missing IS_ERR() guard.
    
    The code intends to return -EPROBE_DEFER only when the clock lookup
    fails with that specific error.  However, without IS_ERR() the check:
    
        if (PTR_ERR(max98095->mclk) == -EPROBE_DEFER)
    
    is called unconditionally, including when devm_clk_get() succeeds and
    returns a valid pointer.  Calling PTR_ERR() on a valid pointer
    reinterprets its address as a signed long; the result is arbitrary
    and is almost never equal to -EPROBE_DEFER, so the check silently
    does nothing in the success case.  When devm_clk_get() fails with
    any error other than -EPROBE_DEFER the check is also skipped, leaving
    max98095->mclk holding an error pointer with no indication to the caller.
    
    This means a deferred probe will never actually be triggered for this
    device, and any non-EPROBE_DEFER clock error is silently swallowed with
    the error pointer left in the mclk field.
    
    Fix this by adding the missing IS_ERR() guard around the PTR_ERR() call,
    matching the pattern already used in the sibling max98088 and wm8960
    drivers.
    
    Fixes: e3048c3d2be5 ("ASoC: max98095: Add master clock handling")
    Signed-off-by: Uday Khare <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ASoC: SDCA: Ensure that Control Range is large enough for header [+ + +]
Author: Charles Keepax <[email protected]>
Date:   Wed Jul 22 11:35:00 2026 +0100

    ASoC: SDCA: Ensure that Control Range is large enough for header
    
    [ Upstream commit 951e921b039b793bef7050eaf5c5fb1a4a5341d1 ]
    
    When reading the Ranges structure from an SDCA Control, ensure that the
    read data is large enough to encompass the required header before
    accessing it.
    
    Fixes: 64fb5af1d1bb ("ASoC: SDCA: Add parsing for Control range structures")
    Signed-off-by: Charles Keepax <[email protected]>
    Reviewed-by: Pierre-Louis Bossart <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ASoC: tas2562: fix broken entries in the volume lookup table [+ + +]
Author: Haidar Lee <[email protected]>
Date:   Wed Jul 15 14:04:41 2026 +0800

    ASoC: tas2562: fix broken entries in the volume lookup table
    
    commit bdb0fd6de403fcea7b85dc9d38f0a571583ebe80 upstream.
    
    The float_vol_db_lookup table is supposed to hold
    round(10^(dB/20) * 2^30) for every 2 dB step from -110 dB to 0 dB,
    which is 56 entries, but it only has 55: the -90 dB entry duplicates
    the -92 dB value (0x0000695b) and the -20 dB entry (0x06666666) is
    missing altogether. As a result every step between -90 dB and -22 dB
    is off by 2 dB, and the control's maximum raw value of 110 indexes one
    element past the end of the array.
    
    Replace the duplicated -90 dB entry with the correct value 0x000084a3
    and add the missing -20 dB entry, bringing the table to the full 56
    entries so index 55 (raw value 110, 0 dB) is in range again.
    
    Fixes: bf726b1c86f2 ("ASoC: tas2562: Add support for digital volume control")
    Cc: [email protected]
    Signed-off-by: Haidar Lee <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ASoC: tas2562: fix DVC coefficient write order [+ + +]
Author: Haidar Lee <[email protected]>
Date:   Wed Jul 15 14:04:40 2026 +0800

    ASoC: tas2562: fix DVC coefficient write order
    
    commit 8e957e4907c58e9ca944f98799524f2bbb9cf68a upstream.
    
    The TAS2562 applies the 32-bit digital volume coefficient to the
    playback path when the last byte, DVC_CFG4 (book 0 page 2 reg 0x0F), is
    written. tas2562_volume_control_put() wrote DVC_CFG4 first and DVC_CFG1
    (the MSB) last, so every volume change latched a value made of the
    previous coefficient's upper three bytes combined with the new LSB; the
    remaining bytes only took effect on the next volume change.
    
    In practice the control was unusable: the first setting after power-on
    always played at roughly 0 dB no matter what value was requested (the
    chip's default upper bytes were still latched), and most subsequent
    changes muted the output entirely or produced a distorted, over-unity
    gain.
    
    Verified on a TAS2562 (ADLINK OSM-520 / MT8189 board) by tracing the
    I2C writes with ftrace and by writing the same coefficients manually in
    both byte orders: written MSB-first the register block behaves exactly
    as the driver expects, LSB-first reproduces the broken behaviour.
    
    Write the bytes MSB first with DVC_CFG4 last so the complete new
    coefficient is latched atomically.
    
    Fixes: bf726b1c86f2 ("ASoC: tas2562: Add support for digital volume control")
    Cc: [email protected]
    Signed-off-by: Haidar Lee <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ASoC: tas2781: Use correct calibration data for SINEGAIN2 register [+ + +]
Author: wangdicheng <[email protected]>
Date:   Mon Jul 20 16:16:16 2026 +0800

    ASoC: tas2781: Use correct calibration data for SINEGAIN2 register
    
    [ Upstream commit dd88cf6273de61f2f7206c2066af97798dbb38b0 ]
    
    The SINEGAIN2_REG case in cali_reg_update() references t->sin_gn[]
    rather than t->sin_gn2[], causing the second pilot tone gain
    calibration to be programmed with the wrong register address.
    
    These are distinct fields in struct fct_param_address and are
    populated from separate firmware parameters by the parser in
    tas2781-fmwlib.c.
    
    Fixes: 84d6a465f211 ("ASoC: tas2781: Support dsp firmware Alpha and Beta seaies")
    Signed-off-by: wangdicheng <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
assoc_array: trim the final shortcut word using the current chunk end [+ + +]
Author: Michael Bommarito <[email protected]>
Date:   Sun Jul 19 12:15:05 2026 -0400

    assoc_array: trim the final shortcut word using the current chunk end
    
    [ Upstream commit a82c8a05e86f3f84e09698f65b4515b5d04633f6 ]
    
    assoc_array_walk() masks off the bits past shortcut->skip_to_level in the
    word that contains skip_to_level, gated on
    round_up(sc_level, ASSOC_ARRAY_KEY_CHUNK_SIZE) > skip_to_level.
    
    That guard is wrong in two opposite ways:
    
     - When sc_level is word-aligned (every word after the first) round_up()
       is a no-op, so the guard is sc_level > skip_to_level and never fires for
       the word that holds skip_to_level.  A shortcut that spans more than one
       word and ends in the middle of its last word leaves that word untrimmed,
       and its stale high bits leak into the dissimilarity word and can steer
       the walk down the wrong descendant.
    
     - When sc_level is unaligned (the first word) and skip_to_level sits on
       the next chunk boundary, sc_level + CHUNK would exceed skip_to_level and
       fire the trim with shift = skip_to_level & CHUNK_MASK == 0, which clears
       the whole dissimilarity word and makes a differing shortcut compare
       equal.
    
    Use the end of the chunk that contains sc_level instead:
    
            skip_to_level < round_down(sc_level, CHUNK) + CHUNK
    
    For an aligned sc_level whose word holds skip_to_level this now fires (the
    first bug); for an unaligned sc_level with skip_to_level on the following
    boundary it does not, so shift is never 0 when the branch runs and the trim
    never clears the whole word.
    
    Fixes: 3cb989501c26 ("Add a generic associative array implementation.")
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: Michael Bommarito <[email protected]>
    Reviewed-by: Jarkko Sakkinen <[email protected]>
    Tested-by: Jarkko Sakkinen <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jarkko Sakkinen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ata: ahci_ceva: fix error paths in ceva_ahci_platform_enable_resources() [+ + +]
Author: Radhey Shyam Pandey <[email protected]>
Date:   Fri Jul 17 23:55:26 2026 +0530

    ata: ahci_ceva: fix error paths in ceva_ahci_platform_enable_resources()
    
    [ Upstream commit 4d99a91574c420decab56cc880fad0dc15b8a7a3 ]
    
    On phy_init() failure the error path fallsthrough to disable_rsts, which
    deasserts the controller reset and then enters disable_phys calling
    phy_power_off() on PHYs that were never powered on. That corrupts the PHY
    power_count and triggers an extra runtime PM put.
    
    Use a separate exit_phys path that unwinds with phy_exit() only and falls
    through to disable_clks while the controller remains in reset.  Reserve
    phy_power_off() for the phy_power_on() failure path only, and skip
    masked-out ports in both unwind loops.
    
    On phy_power_on() failure re-assert the controller reset before disabling
    clocks and regulators, matching the teardown order used by
    ahci_platform_enable_resources() and ahci_platform_disable_resources().
    
    Fixes: 26c8404e162b ("ata: ahci_ceva: fix error handling for Xilinx GT PHY support")
    Signed-off-by: Radhey Shyam Pandey <[email protected]>
    Signed-off-by: Damien Le Moal <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ata: libata-eh: Increase STANDBY IMMEDIATE timeout [+ + +]
Author: Matt Vollrath <[email protected]>
Date:   Fri Jul 24 03:39:42 2026 -0400

    ata: libata-eh: Increase STANDBY IMMEDIATE timeout
    
    commit 1e024d2b41ee32bc06818f7f09a3562c58842cf9 upstream.
    
    Correct a previous change (see Fixes) which reduced the standby timeout
    from 30 to 5 seconds. Increase it to 15 seconds.
    
    I was troubleshooting an error spotted during system suspend:
    
        [ 1217.152867] ata1.00: Entering standby power mode
        [ 1222.322948] ata1.00: qc timeout after 5000 msecs (cmd 0xe0)
        [ 1222.324010] ata1.00: STANDBY IMMEDIATE failed (err_mask=0x4)
    
    This drive is a Samsung 870 EVO SSD in good SMART standing, and I wasn't
    aware of any reason it should be taking so long to standby. The issue is
    intermittent, but I observed it sometimes taking 7 seconds to manually
    standby. I assume this was interruption of background maintenance after
    a power outage.
    
    As a desktop user, I would prefer to wait the extra 2 seconds at suspend
    to let the drive finish its business rather than drop the rails from
    under it.
    
    The change from 30 to 5 seconds was implicit when switching suspend
    from START STOP UNIT to an internal command with no timeout table entry.
    No reason was stated for the change.
    
    Fixes: aa3998dbeb3a ("ata: libata-scsi: Disable scsi device manage_system_start_stop")
    Cc: [email protected]
    Signed-off-by: Matt Vollrath <[email protected]>
    Assisted-by: Claude:claude-5-fable
    Signed-off-by: Damien Le Moal <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ata: libata-sata: fix ata_scsi_lpm_supported() iteration [+ + +]
Author: Niklas Cassel <[email protected]>
Date:   Tue Jul 28 13:38:42 2026 +0200

    ata: libata-sata: fix ata_scsi_lpm_supported() iteration
    
    commit 3fd70e96914d761c17c376aadd0b0d1a3c9badba upstream.
    
    The inner loop of ata_scsi_lpm_supported() uses the wrong variable when
    iterating.
    
    It should obviously use the link that we are currently iterating over,
    rather than always using the host link.
    
    ata_scsi_lpm_supported() is used to control if a user should be allowed
    to change lpm policy (from the default) via sysfs.
    
    Thus, this bug could potentially disallow users to change the LPM policy
    for certain SATA devices via sysfs.
    
    Cc: [email protected]
    Fixes: 0060beec0bfa ("ata: libata-sata: Add link_power_management_supported sysfs attribute")
    Reported-by: Sashiko <[email protected]>
    Link: https://lore.kernel.org/linux-ide/[email protected]/
    Signed-off-by: Niklas Cassel <[email protected]>
    Signed-off-by: Damien Le Moal <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ata: sata_mv: accept 1 or 2 resources in platform probe [+ + +]
Author: Rosen Penev <[email protected]>
Date:   Sun Jul 12 15:31:37 2026 -0700

    ata: sata_mv: accept 1 or 2 resources in platform probe
    
    [ Upstream commit ef19a9cf037957fe3a35df8355c76ff0a63a0436 ]
    
    Board files in arch/arm/plat-orion, arch/arm/mach-dove,
    arch/arm/mach-mv78xx0 and arch/arm/mach-orion5x still register the
    "sata_mv" device with two resources (IORESOURCE_MEM plus IORESOURCE_IRQ).
    Those devices are rejected with -EINVAL, so SATA no longer probes on
    legacy Marvell Orion/Kirkwood-style boards.
    
    Accept both 1 resource (DT, IRQ fetched via platform_get_irq()) and 2
    resources (legacy, IRQ supplied as a second resource) so both probing
    paths work.
    
    Fixes: b3b2bec9646e ("ata: sata_mv: Fixes expected number of resources now IRQs are gone")
    Assisted-by: opencode:big-pickle
    Signed-off-by: Rosen Penev <[email protected]>
    Signed-off-by: Damien Le Moal <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
audit: fix potential integer overflow in audit_log_n_string() [+ + +]
Author: Zhan Xusheng <[email protected]>
Date:   Sat Jul 18 13:09:22 2026 +0800

    audit: fix potential integer overflow in audit_log_n_string()
    
    commit f865c143629d4094866a811dba5f329250bad486 upstream.
    
    audit_log_n_string() computes new_len as "slen + 3" (enclosing quotes
    plus the NUL terminator) and stores it into an int, while slen is a
    size_t.  For a sufficiently large slen the addition can overflow and/or
    the result be truncated when assigned to the int new_len, so the
    "new_len > avail" check can be bypassed and the subsequent
    memcpy(ptr, string, slen) can write past the skb tail.
    
    This is the same class of bug that was fixed for the hex sibling in
    commit 65dfde57d1e2 ("audit: fix potential integer overflow in
    audit_log_n_hex()"); both helpers are reached through
    audit_log_n_untrustedstring() with the same length source.
    
    Make new_len a size_t and use check_add_overflow() to catch the
    overflow, mirroring the audit_log_n_hex() fix.  No functional change for
    the in-tree callers, which all pass bounded lengths.
    
    Cc: [email protected]
    Fixes: 168b7173959f ("AUDIT: Clean up logging of untrusted strings")
    Signed-off-by: Zhan Xusheng <[email protected]>
    Signed-off-by: Paul Moore <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

audit: fix potential use-after-free in audit_del_rule() [+ + +]
Author: Luxiao Xu <[email protected]>
Date:   Tue Jul 21 23:37:41 2026 +0800

    audit: fix potential use-after-free in audit_del_rule()
    
    commit 246df90b5f1a8a6e6abbd2f058b029558720adec upstream.
    
    `audit_del_rule()` destroys `e->rule.exe` via `audit_remove_mark_rule()`
    before unlinking the rule from RCU-visible filter lists and waiting for a
    grace period. Concurrent readers in `audit_filter()` and
    `audit_filter_rules()` still dereference `e->rule.exe`, while the fsnotify
    mark can be freed on an independent lifetime path. This creates a
    use-after-free window during rule deletion.
    
    Fix this by unlinking the rule from the RCU-visible lists and invoking
    `synchronize_rcu()` before calling `audit_remove_mark_rule()` (and other
    rule removal helpers). This ensures that all existing RCU readers have
    exited the critical section before any underlying resources are destroyed.
    
    Cc: [email protected]
    Fixes: 34d99af52ad4 ("audit: implement audit by executable")
    Reported-by: Vega <[email protected]>
    Assisted-by: Codex:gpt-5.4
    Signed-off-by: Luxiao Xu <[email protected]>
    Signed-off-by: Ren Wei <[email protected]>
    Signed-off-by: Paul Moore <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
binfmt_misc: don't let an 'F' entry pin its own instance [+ + +]
Author: Christian Brauner <[email protected]>
Date:   Tue Jul 28 14:26:32 2026 +0200

    binfmt_misc: don't let an 'F' entry pin its own instance
    
    commit 79055d82772b9584f259b747fe40ff56a076678d upstream.
    
    An entry registered with 'F' opens its interpreter at registration time
    and holds that file until the entry is freed. Any entry nobody removes
    by hand only gets closed once the binfmt_misc superblock is shut down.
    If the interpreter lives on a mount that keeps that superblock alive the
    two pin each other:
    
        binfmt_misc sb -> inode -> entry -> interp_file -> vfsmount -> binfmt_misc sb
    
    TL;DR the file is never closed. Once the mount namespace is gone there
    is nothing left to unregister through either.
    
    There are two ways to trigger this bug:
    
    - Point the interpreter at the instance itself. Its files are regular
      files owned by the mounter and both bm_get_inode() and
      simple_fill_super() leave i_op at empty_iops. So notify_change() falls
      back to simple_setattr() and chmod +x works. We never set SB_I_NOEXEC
      and so open_exec() accepts it.
    
    - Use the instance as an overlayfs lower layer. The overlay superblock
      holds a clone_private_mount() of every layer until it is destroyed and
      that clone is in no namespace. So umount_tree() never reaches it.
    
    That's a DoS. And it isn't only the superblock that leaks. It pins the
    user namespace it was mounted in, so every iteration permanently eats
    one of the caller's user namespace charges.
    
    So let's just do the sane thing. SB_I_NOEXEC makes open_exec() fail on
    the instance's own files and s_stack_depth makes overlayfs reject the
    layer before it ever takes a clone. That also covers the ecryptfs and
    fuse passthrough variants. What 'F' promises is unchanged.
    
    The stable tag is narrower than the Fixes tags on purpose. Before
    sandboxed mounts this needed global root against the single instance
    everyone shares, and the change doesn't apply to those trees anyway.
    
    Note that SB_I_NODEV is implicitly raised for userns mounts but raise it
    explicitly here as well.
    
    Link: https://patch.msgid.link/[email protected]
    Fixes: 948b701a607f ("binfmt_misc: add persistent opened binary handler for containers")
    Fixes: 21ca59b365c0 ("binfmt_misc: enable sandboxed mounts")
    Cc: [email protected] # v6.7+
    Signed-off-by: Christian Brauner (Amutable) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

binfmt_misc: reject a flag character as the field delimiter [+ + +]
Author: Christian Brauner <[email protected]>
Date:   Fri Jul 10 11:33:04 2026 +0200

    binfmt_misc: reject a flag character as the field delimiter
    
    commit 8e85d50ba1117fd446bf9a250bd8a97d48384bdc upstream.
    
    The registration string starts with a user chosen delimiter that
    separates the individual fields. So that the field parsers terminate
    even on a truncated string create_entry() pads the buffer with that
    same delimiter:
    
            memset(buf + count, del, 8);
    
    Most fields are scanned for the delimiter with strchr()/scanarg() and
    happily stop on the padding. The flags field is different: instead of
    scanning for the delimiter check_special_flags() consumes the flag
    characters 'P', 'O', 'C' and 'F' and stops at the first byte that is
    none of them, relying on the trailing delimiter to end the scan.
    
    If the delimiter is itself a flag character the padding no longer acts
    as a terminator. The scan swallows all eight padding bytes and keeps
    reading past the end of the allocation until it hits a byte that is
    not a flag character. For example registering
    
            PaPEPPxPPiP
    
    with 'P' as the delimiter (name "a", type extension, magic "x",
    interpreter "i", empty flags) leaves the flag scan running off the end
    of the buffer. The registration is rejected in the end because the
    parser does not stop exactly at buf + count, but only after the out of
    bounds read has already happened. With an unlucky allocation layout the
    scan can walk into an unmapped page; under KASAN it is reported as a
    slab out of bounds read. binfmt_misc mounts are available to
    unprivileged users in a user namespace so the read is reachable without
    privileges.
    
    Reject a delimiter that is one of the flag characters up front. Such a
    registration was always rejected anyway, only after the out of bounds
    read, so no valid registration string changes meaning.
    
    Link: https://patch.msgid.link/[email protected]
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: [email protected]
    Signed-off-by: Christian Brauner (Amutable) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

binfmt_misc: restore write access when removing an entry [+ + +]
Author: Christian Brauner <[email protected]>
Date:   Fri Jul 10 11:33:02 2026 +0200

    binfmt_misc: restore write access when removing an entry
    
    commit db1856ea9196cf6e015d12199a34c0b9313c7bfa upstream.
    
    Registering an entry with the MISC_FMT_OPEN_FILE flag opens the
    interpreter via open_exec() which denies write access to it for as
    long as the entry exists. Removing the entry closes the interpreter
    file via filp_close() but never restores write access, leaving the
    inode's i_writecount permanently negative. Opening the interpreter
    for writing keeps failing with ETXTBSY long after the entry is gone
    until the inode is evicted from the inode cache.
    
    Commit 90f601b497d7 ("binfmt_misc: restore write access before
    closing files opened by open_exec()") fixed the same imbalance in the
    error path of bm_register_write() but the actual removal path has
    been leaking the write denial since the introduction of the flag.
    
    Restore write access in put_binfmt_handler() before closing the
    interpreter file.
    
    Link: https://patch.msgid.link/[email protected]
    Fixes: 948b701a607f ("binfmt_misc: add persistent opened binary handler for containers")
    Cc: [email protected]
    Signed-off-by: Christian Brauner (Amutable) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

binfmt_misc: use exe_file_deny_write_access() for the interpreter clone [+ + +]
Author: Christian Brauner <[email protected]>
Date:   Fri Jul 10 11:33:03 2026 +0200

    binfmt_misc: use exe_file_deny_write_access() for the interpreter clone
    
    commit fa5990ca8fd917003e526036bcc50413edb9722c upstream.
    
    For MISC_FMT_OPEN_FILE entries load_misc_binary() clones the
    registered interpreter file and denies write access to the clone via
    plain deny_write_access(). The clone is installed as
    bprm->interpreter and later released by the exec machinery through
    exe_file_allow_write_access() which skips the i_writecount increment
    for files with FMODE_FSNOTIFY_HSM set.
    
    The deny and allow side can therefore come to different conclusions
    when pre-content watches are in play: if a pre-content watch is added
    to the interpreter after registration every subsequent exec through
    that entry takes a write denial on the clone that is never paired
    with a write allowance, driving the interpreter inode's i_writecount
    further down with each exec and leaving the interpreter unwritable
    even after the entry and all its users are gone.
    
    Take the write denial via exe_file_deny_write_access() so both sides
    of the pairing base their decision on the same file mode, and
    propagate failure instead of silently ignoring it: an interpreter
    that is concurrently open for writing now fails the exec with
    ETXTBSY, exactly like an interpreter freshly opened via open_exec()
    would.
    
    Link: https://patch.msgid.link/[email protected]
    Fixes: 0357ef03c94e ("fs: don't block write during exec on pre-content watched files")
    Cc: [email protected]
    Signed-off-by: Christian Brauner (Amutable) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
Bluetooth: btintel: Validate length before parsing diagnostics TLV [+ + +]
Author: Zijun Hu <[email protected]>
Date:   Sat Jul 25 01:54:40 2026 -0700

    Bluetooth: btintel: Validate length before parsing diagnostics TLV
    
    [ Upstream commit b640ff9af3c809ff5ea2077fbba17df1594ec1e4 ]
    
    btintel_diagnostics() accesses tlv->val[0] without first validating
    that the diagnostics VSE is long enough to contain that field, so
    may cause reading data beyond the received frame.
    
    Fix by validating the length before access.
    
    Fixes: af395330abed ("Bluetooth: btintel: Add Intel devcoredump support")
    Signed-off-by: Zijun Hu <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: btmtk: Fix short read errors in btmtk_usb_uhw_reg_read() [+ + +]
Author: Greg Kroah-Hartman <[email protected]>
Date:   Mon Jul 27 17:57:32 2026 +0200

    Bluetooth: btmtk: Fix short read errors in btmtk_usb_uhw_reg_read()
    
    commit b186c18c4843dd58adc29443369bddc71cb626a3 upstream.
    
    If btmtk_usb_uhw_reg_read() gets a "short" read from a device, it will
    accidentally treat that as a "real" read and populate the returned value
    with some unknown and probably totally invalid data.
    
    Fix this logic error up by calling usb_control_msg_recv() which
    guarantees a "full" read happens, and then simplify the error checking
    for when btmtk_usb_uhw_reg_read() is called.
    
    Note, one caller of btmtk_usb_uhw_reg_read() does not check the return
    value, but as we pre-initialize the return value as 0, an incorrect read
    will not do anything wrong.
    
    Cc: stable <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

Bluetooth: btusb: Fix short read errors in btusb_qca_send_vendor_req() [+ + +]
Author: Greg Kroah-Hartman <[email protected]>
Date:   Mon Jul 27 17:57:34 2026 +0200

    Bluetooth: btusb: Fix short read errors in btusb_qca_send_vendor_req()
    
    commit cac43d360c928bc0cbbd18809632388265649761 upstream.
    
    If btusb_qca_send_vendor_req() gets a "short" read from a device, it
    will accidentally treat that as a "real" read and populate the returned
    value with some unknown and probably totally invalid data.
    
    Fix this logic error up by calling usb_control_msg_recv() which
    guarantees a "full" read happens, and then simplify the error checking
    for when btusb_qca_send_vendor_req() is called.
    
    Cc: stable <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

Bluetooth: HCI: Add initial support for PAST [+ + +]
Author: Luiz Augusto von Dentz <[email protected]>
Date:   Tue Sep 2 11:11:40 2025 -0400

    Bluetooth: HCI: Add initial support for PAST
    
    [ Upstream commit 33b2835f0b7e2a458473b0e3a23b54b92108b6b0 ]
    
    This adds PAST related commands (HCI_OP_LE_PAST,
    HCI_OP_LE_PAST_SET_INFO and HCI_OP_LE_PAST_PARAMS) and events
    (HCI_EV_LE_PAST_RECEIVED) along with handling of PAST sender and
    receiver features bits including new MGMG settings (
    HCI_EV_LE_PAST_RECEIVED and MGMT_SETTING_PAST_RECEIVER) which
    userspace can use to determine if PAST is supported by the
    controller.
    
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Stable-dep-of: 4311fd6f4290 ("Bluetooth: ISO: lock sk in iso_connect_ind")
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: hci_conn: hold conn reference in abort_conn_sync() [+ + +]
Author: Pauli Virtanen <[email protected]>
Date:   Sat Jul 25 12:59:17 2026 +0300

    Bluetooth: hci_conn: hold conn reference in abort_conn_sync()
    
    [ Upstream commit 5761d003daa987ac81463f570713ce9c9dd204e5 ]
    
    There is theoretical UAF if the conn is freed while the hci_sync task is
    running.
    
    Hold refcount to avoid that.
    
    Fixes: 227a0cdf4a02 ("Bluetooth: MGMT: Fix not generating command complete for MGMT_OP_DISCONNECT")
    Signed-off-by: Pauli Virtanen <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: hci_sync: Fix advertising data UAFs [+ + +]
Author: Chengfeng Ye <[email protected]>
Date:   Thu Jul 23 23:34:40 2026 +0800

    Bluetooth: hci_sync: Fix advertising data UAFs
    
    commit cdc36db204ffd97b947d64374cf23a210dc74777 upstream.
    
    hci_find_adv_instance() returns an adv_info pointer that is valid only
    while hdev->lock is held.  The advertising command-sync paths perform
    instance lookups without that lock and, in some cases, retain the pointer
    while waiting for a controller response.
    
    An advertising termination event can therefore interleave as follows:
    
      hci_cmd_sync_work                 hci_rx_work
      hci_find_adv_instance()
      __hci_cmd_sync_status()
        wait for controller reply       hci_dev_lock()
                                        hci_remove_adv_instance()
                                          kfree(adv)
      adv->scan_rsp_changed = false
    
    KASAN reported:
    
      BUG: KASAN: slab-use-after-free in hci_set_ext_scan_rsp_data_sync+0x2e1/0x300
      Write of size 1 at addr ffff88810a45d21d by task kworker/u17:0/88
      Workqueue: hci0 hci_cmd_sync_work
      Call Trace:
       hci_set_ext_scan_rsp_data_sync+0x2e1/0x300
       hci_schedule_adv_instance_sync+0x390/0x4c0
       hci_cmd_sync_work+0x173/0x300
      Allocated by task 87:
       hci_add_adv_instance+0x538/0xac0
       add_advertising+0x885/0x1160
      Freed by task 89:
       kfree+0x131/0x3c0
       hci_remove_adv_instance+0x1d8/0x3b0
       hci_le_ext_adv_term_evt+0x17b/0x730
    
    Protect the instance lookup and payload construction in the extended
    advertising, scan response, and periodic advertising data paths.  Snapshot
    the advertising parameters under hdev->lock, but release the lock before
    waiting for the controller.
    
    Clear advertising-data dirty bits before issuing their commands and
    restore them after a failure using a fresh lookup.  Likewise, update the
    reported transmit power through a fresh lookup after the parameter command
    completes.  No adv_info pointer then survives an HCI command wait.
    
    Fixes: cba6b758711c ("Bluetooth: hci_sync: Make use of hci_cmd_sync_queue set 2")
    Cc: [email protected]
    Suggested-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Chengfeng Ye <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

Bluetooth: hci_sync: fix hci_conn_del() use in hci_le_create_conn_sync [+ + +]
Author: Pauli Virtanen <[email protected]>
Date:   Sat Jul 25 12:59:22 2026 +0300

    Bluetooth: hci_sync: fix hci_conn_del() use in hci_le_create_conn_sync
    
    [ Upstream commit 2c1e4e00613dfd105f978be2276e5e265801ec9f ]
    
    hci_conn_del() caller must hold hdev->lock, check the conn was not
    concurrently deleted, and usually inform socket the conn is going to be
    deleted.
    
    Use hci_abort_conn_sync() instead of calling hci_conn_del() without
    locks etc.
    
    Fixes: 8e8b92ee60de5 ("Bluetooth: hci_sync: Add hci_le_create_conn_sync")
    Signed-off-by: Pauli Virtanen <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: hci_sync: make hci_cmd_sync_run_once return -EEXIST if exists [+ + +]
Author: Pauli Virtanen <[email protected]>
Date:   Wed Mar 25 21:07:45 2026 +0200

    Bluetooth: hci_sync: make hci_cmd_sync_run_once return -EEXIST if exists
    
    [ Upstream commit d288f4db0909c22342eb50cd1632b4d850517281 ]
    
    hci_cmd_sync_run_once() needs to indicate whether a queue item was
    added, so caller can know if callbacks are called, so it can avoid
    leaking resources.
    
    Change the function to return -EEXIST if queue item already exists.
    
    Modify all callsites vs. the changes.  The only callsite is
    hci_abort_conn().
    
    Signed-off-by: Pauli Virtanen <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Stable-dep-of: 5761d003daa9 ("Bluetooth: hci_conn: hold conn reference in abort_conn_sync()")
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: HIDP: reject frames without a transaction header [+ + +]
Author: Sangho Lee <[email protected]>
Date:   Thu Jul 23 12:28:06 2026 +0900

    Bluetooth: HIDP: reject frames without a transaction header
    
    commit 47778d2c2087b5d192398f6fddf692d16a5431cf upstream.
    
    hidp_recv_ctrl_frame() and hidp_recv_intr_frame() read skb->data[0]
    before checking that the L2CAP SDU contains a transaction header. A
    connected HIDP peer can send an empty basic-mode SDU and make both paths
    use an uninitialized byte from skb tailroom.
    
    KMSAN reports the use in hidp_session_run(), with the uninitialized value
    originating in __alloc_skb() through vhci_write(). The control path
    produces two reports and the interrupt path produces one.
    
    The byte can also be controlled by a malformed lower-layer packet. If an
    HCI ACL packet contains an L2CAP PDU with a declared zero-length payload
    followed by an extra 0x15 byte, l2cap_recv_acldata() reduces skb->len to
    the declared PDU length before dispatch. The current HIDP path nevertheless
    consumes the extra byte as HIDP_TRANS_HID_CONTROL |
    HIDP_CTRL_VIRTUAL_CABLE_UNPLUG and terminates the HIDP session. With this
    change, the same packet is discarded and a subsequent feature report
    request succeeds.
    
    Pull the transaction header with skb_pull_data() and discard frames that
    do not contain it.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: [email protected]
    Signed-off-by: Sangho Lee <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

Bluetooth: HIDP: validate numbered report payloads [+ + +]
Author: Sangho Lee <[email protected]>
Date:   Thu Jul 23 12:28:07 2026 +0900

    Bluetooth: HIDP: validate numbered report payloads
    
    commit 34f53d27b81a16a02828c8fdfa4e02badc326f17 upstream.
    
    When hidp_get_raw_report() waits for a numbered report,
    hidp_process_data() compares the expected report number with skb->data[0].
    A connected HIDP peer can reply with only a DATA transaction header,
    leaving the skb empty after the header is removed.
    
    KMSAN reports an uninitialized-value use in hidp_session_run(), with the
    value originating in __alloc_skb() through vhci_write(). The transaction
    header checks remove the empty-frame reports, but this report remains until
    the payload check is added.
    
    The comparison can also consume a peer-controlled byte beyond the declared
    L2CAP PDU. A DATA | FEATURE response followed by an extra 0x01 byte made
    the current code accept that byte as report ID 1 and complete
    HIDIOCGFEATURE with a zero-byte result. With this change the malformed
    response is rejected with -EIO, while a subsequent valid response still
    succeeds.
    
    Require a payload byte before comparing a numbered report ID. Unnumbered
    reports continue to accept an empty payload.
    
    Fixes: 0ff1731a1ae5 ("HID: bt: Add support for hidraw HIDIOCGFEATURE and HIDIOCSFEATURE")
    Cc: [email protected]
    Signed-off-by: Sangho Lee <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

Bluetooth: ISO: avoid deadlocks in iso_sock_timeout [+ + +]
Author: Pauli Virtanen <[email protected]>
Date:   Fri Jul 24 23:20:31 2026 +0300

    Bluetooth: ISO: avoid deadlocks in iso_sock_timeout
    
    [ Upstream commit 200fa1629c57a3ca2b03d3ca63fd3a9bfd910c43 ]
    
    iso_sock_timeout() takes lock_sock, so sync disabling the timer while
    holding that lock may deadlock.
    
    iso_sock_timeout() may also run concurrently with iso_conn_del(), which
    leads to UAF
    
            [Task 1]                      [Task hdev->workqueue]
            iso_sock_timeout              iso_conn_del
              iso_conn_hold_unless_zero     iso_chan_del
                               `------------> iso_conn_put
                                          caller frees hcon
              iso_conn_put
                iso_conn_free
                  conn->hcon->iso_data = NULL; /* UAF */
    
    Fix the deadlock by removing the disable from the lock_sock sections.
    Move the timer from iso_conn to iso_pinfo to decouple it from iso_conn
    which may need to be freed in lock_sock section. Convert some of the
    clear_timer to disable_timer.
    
    Fixes: dc26097bdb86 ("Bluetooth: ISO: Use kref to track lifetime of iso_conn")
    Signed-off-by: Pauli Virtanen <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: ISO: clear iso_data always when detaching conn from hcon [+ + +]
Author: Pauli Virtanen <[email protected]>
Date:   Mon Jul 20 17:53:33 2026 +0300

    Bluetooth: ISO: clear iso_data always when detaching conn from hcon
    
    [ Upstream commit d57e506f6a1e3929611340fae87c1e4823f4d85c ]
    
    When setting conn->hcon = NULL, also conn->hcon->iso_data = NULL is
    necessary, otherwise later iso_conn_free() will UAF.
    
    Fix clearing of iso_data in iso_sock_disconn()
    
    Fixes KASAN: slab-use-after-free in iso_conn_hold_unless_zero on
    iso_sock_release() followed by hci_abort_conn_sync().
    
    Fixes: fbdc4bc47268 ("Bluetooth: ISO: Use defer setup to separate PA sync and BIG sync")
    Signed-off-by: Pauli Virtanen <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: ISO: ensure no dangling hcon references in iso_conn [+ + +]
Author: Pauli Virtanen <[email protected]>
Date:   Fri Jul 24 23:20:32 2026 +0300

    Bluetooth: ISO: ensure no dangling hcon references in iso_conn
    
    [ Upstream commit aa9f7cb2bd3a2be998ceb739fc9a2f986eba43eb ]
    
    After iso_conn_del(), ISO sockets should not dereference the hcon any
    more.  Currently, clearing iso_conn::hcon relies on iso_conn_del()
    releasing the last reference to the iso_conn.
    
    Simplify this by explicitly clearing conn->hcon in iso_conn_del(), to
    avoid more complex reasoning on races about who holds the last
    reference.
    
    Signed-off-by: Pauli Virtanen <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Stable-dep-of: fdfde532ab1c ("Bluetooth: ISO: fix refcounting of iso_conn")
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: ISO: fix CONNECTED -> CLOSED transition on shutdown/release [+ + +]
Author: Pauli Virtanen <[email protected]>
Date:   Fri Jul 24 23:20:24 2026 +0300

    Bluetooth: ISO: fix CONNECTED -> CLOSED transition on shutdown/release
    
    [ Upstream commit 0786469ee242952008628ed0e2d386098e2065ab ]
    
    Commit d57e506f6a1e ("Bluetooth: ISO: clear iso_data always when detaching conn from hcon")
    merged a version of the UAF fix that breaks releasing connected
    ISO sockets. Since hci_conn::iso_data is set to NULL, iso_chan_del() won't
    be called when the hci_conn disconnects, and the ISO socket does not emit
    POLLHUP correctly.
    
    Fix by retaining full hci_conn <-> iso_conn association while in
    BT_DISCONNECT state, so that local disconnect via shutdown() follows
    similar ISO socket code path as remote disconnect.  Use a separate flag
    to track whether hci_conn_drop() is needed, instead of setting
    iso_conn::hcon = NULL
    
    In iso_sock_ready(), disallow disconnecting socket going BT_CONNECTED,
    in case hcon connects while its drop is pending.
    
    Fixes: d57e506f6a1e ("Bluetooth: ISO: clear iso_data always when detaching conn from hcon")
    Fixes: fbdc4bc47268 ("Bluetooth: ISO: Use defer setup to separate PA sync and BIG sync")
    Signed-off-by: Pauli Virtanen <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Stable-dep-of: 0d255e63fcf3 ("Bluetooth: ISO: hold sk properly in iso_conn_ready")
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: ISO: Fix data-race on iso_pi(sk) in socket and HCI event paths [+ + +]
Author: SeungJu Cheon <[email protected]>
Date:   Tue Apr 21 11:51:22 2026 +0900

    Bluetooth: ISO: Fix data-race on iso_pi(sk) in socket and HCI event paths
    
    [ Upstream commit f958c7805b18e9d69f6b322b231ecee46ec6f331 ]
    
    Several iso_pi(sk) fields (qos, qos_user_set, bc_sid, base, base_len,
    sync_handle, bc_num_bis) are written under lock_sock in
    iso_sock_setsockopt() and iso_sock_bind(), but read and written under
    hci_dev_lock only in two other paths:
    
      - iso_connect_bis() / iso_connect_cis(), invoked from connect(2),
        read qos/base/bc_sid and reset qos to default_qos on the
        qos_user_set validation failure -- all without lock_sock.
    
      - iso_connect_ind(), invoked from hci_rx_work, writes sync_handle,
        bc_sid, qos.bcast.encryption, bc_num_bis, base and base_len on
        PA_SYNC_ESTABLISHED / PAST_RECEIVED / BIG_INFO_ADV_REPORT /
        PER_ADV_REPORT events. The BIG_INFO handler additionally passes
        &iso_pi(sk)->qos together with sync_handle / bc_num_bis / bc_bis
        to hci_conn_big_create_sync() while setsockopt may be mutating
        them.
    
    Acquire lock_sock around the affected accesses in both paths.
    
    The locking order hci_dev_lock -> lock_sock matches the existing
    iso_conn_big_sync() precedent, whose comment documents the same
    requirement for hci_conn_big_create_sync(). The HCI connect/bind
    helpers do not wait for command completion -- they enqueue work via
    hci_cmd_sync_queue{,_once}() / hci_le_create_cis_pending() and
    return -- so the added hold time is comparable to iso_conn_big_sync().
    
    KCSAN report:
    
    BUG: KCSAN: data-race in iso_connect_cis / iso_sock_setsockopt
    
    read to 0xffffa3ae8ce3cdc8 of 1 bytes by task 335 on cpu 0:
     iso_connect_cis+0x49f/0xa20
     iso_sock_connect+0x60e/0xb40
     __sys_connect_file+0xbd/0xe0
     __sys_connect+0xe0/0x110
     __x64_sys_connect+0x40/0x50
     x64_sys_call+0xcad/0x1c60
     do_syscall_64+0x133/0x590
     entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
    write to 0xffffa3ae8ce3cdc8 of 60 bytes by task 334 on cpu 1:
     iso_sock_setsockopt+0x69a/0x930
     do_sock_setsockopt+0xc3/0x170
     __sys_setsockopt+0xd1/0x130
     __x64_sys_setsockopt+0x64/0x80
     x64_sys_call+0x1547/0x1c60
     do_syscall_64+0x133/0x590
     entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
    Reported by Kernel Concurrency Sanitizer on:
    CPU: 1 UID: 0 PID: 334 Comm: iso_setup_race Not tainted 7.0.0-10949-g8541d8f725c6 #44 PREEMPT(lazy)
    
    The iso_connect_ind() races were found by inspection.
    
    Fixes: ccf74f2390d6 ("Bluetooth: Add BTPROTO_ISO socket type")
    Signed-off-by: SeungJu Cheon <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Stable-dep-of: 4311fd6f4290 ("Bluetooth: ISO: lock sk in iso_connect_ind")
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: ISO: fix leaking sk after socket release [+ + +]
Author: Pauli Virtanen <[email protected]>
Date:   Fri Jul 24 23:20:30 2026 +0300

    Bluetooth: ISO: fix leaking sk after socket release
    
    [ Upstream commit ce57442a379212fe3fda59c9437ee8217eceb5b1 ]
    
    iso_sock_kill() tests !sock_flag(sk, SOCK_ZAPPED) || sk->sk_socket ||
    sock_flag(sk, SOCK_DEAD) for early return, but this is always true since
    sock_orphan(sk) sets SOCK_DEAD, so the sk reference released by socket
    always leaks, iso_sock_destruct is never called.
    
    The socket reference also leaks when __iso_sock_close() does not set
    SOCK_ZAPPED, since iso_conn_del() does not call iso_sock_kill() after
    zapping.
    
    Fix by replacing SOCK_DEAD by BT_SK_KILLED flag that is not used for
    something else, and lock_sock to ensure iso_sock_kill() puts sk only
    after socket release only once. Release and iso_conn_del may run
    concurrently. Call iso_sock_kill() from iso_conn_del() to clean sk up
    after zapping.
    
    Remove call to iso_sock_kill() from iso_sock_close(), as it's generally
    no-op there.
    
    Fixes: ccf74f2390d6 ("Bluetooth: Add BTPROTO_ISO socket type")
    Signed-off-by: Pauli Virtanen <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: ISO: Fix not updating BIS sender source address [+ + +]
Author: Luiz Augusto von Dentz <[email protected]>
Date:   Mon Oct 6 16:53:35 2025 -0400

    Bluetooth: ISO: Fix not updating BIS sender source address
    
    [ Upstream commit 577cf4c0a1e8471a0d6c0f36bb3716285e27ad5e ]
    
    The source address for a BIS sender/Broadcast Source shall be updated
    with the advertisement address since in case privacy is enabled it may
    use an RPA rather than an identity address.
    
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Stable-dep-of: 0d255e63fcf3 ("Bluetooth: ISO: hold sk properly in iso_conn_ready")
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: ISO: fix refcounting of iso_conn [+ + +]
Author: Pauli Virtanen <[email protected]>
Date:   Fri Jul 24 23:20:33 2026 +0300

    Bluetooth: ISO: fix refcounting of iso_conn
    
    [ Upstream commit fdfde532ab1caa165fcd8985001157ac8b4db365 ]
    
    iso_conn_del() and iso_chan_del() have a race that results to double-put
    of iso_conn:
    
        [Task hdev->workqueue]         [Task 2]
        iso_conn_del                   iso_chan_del
          iso_conn_hold_unless_zero      iso_conn_lock
          iso_conn_lock                  conn->sk = NULL
                                         iso_conn_unlock
          sk = iso_sock_hold(conn)  <---------´
          if (!sk) iso_conn_put          iso_conn_put
          iso_conn_put /* UAF */
    
    The extra put for !sk in iso_conn_del() is currently required since
    failing iso_chan_add() may leave iso_conn not associated with any sk.
    
    Fix by having iso_pi(sk)->conn own refcount when non-NULL, so
    iso_conn_del does not need to put it.  Adjust the iso_conn_add()
    refcounting so that conn is put if it does not get associated with an
    sk.
    
    Fixes: dc26097bdb86 ("Bluetooth: ISO: Use kref to track lifetime of iso_conn")
    Signed-off-by: Pauli Virtanen <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: ISO: fix timeout vs sync_timeout typo in check_bcast_qos [+ + +]
Author: Pauli Virtanen <[email protected]>
Date:   Fri Jul 24 23:20:27 2026 +0300

    Bluetooth: ISO: fix timeout vs sync_timeout typo in check_bcast_qos
    
    [ Upstream commit e9cb51813d79fc9aae4a2098aab3ab6ebd7fb6c8 ]
    
    In iso.c check_bcast_qos(), missing bcast.timeout is not set to its
    default value, and appears typoed as bcast.sync_timeout.
    
    Fix the typo.
    
    Fixes: b37cab587aa3 ("Bluetooth: ISO: Don't reject BT_ISO_QOS if parameters are unset")
    Signed-off-by: Pauli Virtanen <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: ISO: hold sk properly in iso_conn_ready [+ + +]
Author: Pauli Virtanen <[email protected]>
Date:   Fri Jul 24 23:20:29 2026 +0300

    Bluetooth: ISO: hold sk properly in iso_conn_ready
    
    [ Upstream commit 0d255e63fcf3f13a570d7ac11678fa1164ac015c ]
    
    sk deref in iso_conn_ready must be done either under conn->lock, or
    holding a refcount, to avoid concurrent close. conn->sk is currently
    accessed without either:
    
        [Task 1]            [Task 2]
                            iso_sock_release
        iso_conn_ready
          sk = conn->sk
                              lock_sock(sk)
                                conn->sk = NULL
          lock_sock(sk)
                              release_sock(sk)
                              iso_sock_kill(sk)
           UAF on sk deref
    
    Fix possible UAF by holding sk refcount in iso_conn_ready().  Also
    recheck after lock_sock that the socket is still valid.  Adjust locking
    so conn->sk is cleared only under lock_sock.
    
    Fixes: 27c24fda62b60 ("Bluetooth: switch to lock_sock in SCO")
    Signed-off-by: Pauli Virtanen <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: ISO: lock sk in iso_connect_ind [+ + +]
Author: Pauli Virtanen <[email protected]>
Date:   Fri Jul 24 23:20:26 2026 +0300

    Bluetooth: ISO: lock sk in iso_connect_ind
    
    [ Upstream commit 4311fd6f429065a8ba208660360a895627a00cf3 ]
    
    Accessing iso_pi(sk)->conn requires lock_sock, which is not taken in the
    "ev3" part of iso_connect_ind.  It may also be NULL if socket has
    transitioned away from the LISTEN/CONNECT states before locking.
    
    Fix by adding lock/release. Recheck hcon is valid after lock acquire
    where needed.
    
    Fixes: 168d9bf9c7f0 ("Bluetooth: ISO: Reassemble PA data for bcast sink")
    Signed-off-by: Pauli Virtanen <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: ISO: lock sk in iso_sock_getname [+ + +]
Author: Pauli Virtanen <[email protected]>
Date:   Fri Jul 24 23:20:25 2026 +0300

    Bluetooth: ISO: lock sk in iso_sock_getname
    
    [ Upstream commit 89cf154d7c18e6e94a3da83051f3cf2bac317ae2 ]
    
    Accessing iso_pi(sk)->conn requires lock_sock, which is not held here.
    
    Fix by adding the lock/release.
    
    Fixes: 2df108c227b2 ("Bluetooth: ISO: Fix using BT_SK_PA_SYNC to detect BIS sockets")
    Signed-off-by: Pauli Virtanen <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: ISO: validate sockaddr_iso first in iso_sock_rebind_bis() [+ + +]
Author: Pauli Virtanen <[email protected]>
Date:   Fri Jul 24 23:20:28 2026 +0300

    Bluetooth: ISO: validate sockaddr_iso first in iso_sock_rebind_bis()
    
    [ Upstream commit 4e20192d46a685d73e590a60a4a2419a0a8afcbf ]
    
    iso_sock_rebind_bis() updates socket iso_pi(sk)->bc_num_bis before
    validating the BIS values, so it's possible to end up with bc_num_bis
    inconsistent.
    
    Assign to iso_pi(sk)->bc_num_bis only after validation.
    
    Fixes: 80837140c1f2 ("Bluetooth: ISO: Allow binding a PA sync socket")
    Signed-off-by: Pauli Virtanen <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: L2CAP: fix UAF in l2cap_le_connect_rsp [+ + +]
Author: Jiale Yao <[email protected]>
Date:   Thu Jul 23 14:48:45 2026 +0800

    Bluetooth: L2CAP: fix UAF in l2cap_le_connect_rsp
    
    [ Upstream commit c4740e7f23ff9a8210198d8b4703259e21b9f69d ]
    
    l2cap_le_connect_rsp() obtains a channel via
    __l2cap_get_chan_by_ident() but neither holds a reference nor uses
    l2cap_chan_hold_unless_zero() before locking and operating on it.
    A concurrent l2cap_chan_del() triggered by a remote disconnect can
    free the channel between the lookup and l2cap_chan_lock(), causing
    a use-after-free.
    
    The BR/EDR counterpart l2cap_connect_rsp() and the sibling handler
    l2cap_le_command_rej() already use l2cap_chan_hold_unless_zero()
    to safely hold a reference, but l2cap_le_connect_rsp() was left
    unprotected.
    
    Fix by adding l2cap_chan_hold_unless_zero() after the ident lookup
    and l2cap_chan_put() on the exit path, consistent with other L2CAP
    response handlers.
    
    Fixes: f1496dee9cbd ("Bluetooth: Add initial code for LE L2CAP Connect Request")
    Assisted-by: Claude:deepseek-v4-pro
    Signed-off-by: Jiale Yao <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: mgmt: fix pending command UAF in EIR updates [+ + +]
Author: Zihan Xi <[email protected]>
Date:   Fri Jul 24 00:43:46 2026 +0800

    Bluetooth: mgmt: fix pending command UAF in EIR updates
    
    commit 8f2f62855a41d1730fb9e8122912bd2c8d6bed5d upstream.
    
    MGMT_OP_SET_LOCAL_NAME is handled asynchronously on powered controllers
    and can run set_name_sync().  When the controller is BR/EDR capable,
    set_name_sync() updates the local name and then rebuilds EIR data through
    eir_create().  The EIR builder walks hdev->uuids, but the UUID list can
    be changed and entries can be freed by MGMT_OP_ADD_UUID and
    MGMT_OP_REMOVE_UUID.
    
    pending_eir_or_class() is meant to serialize management commands that
    can change EIR or the class of device, but it did not include
    MGMT_OP_SET_LOCAL_NAME.  In addition, it walked hdev->mgmt_pending
    without hdev->mgmt_pending_lock even though pending commands are added
    and removed under that mutex.  A racing command completion can therefore
    remove and free a pending command while pending_eir_or_class() is still
    inspecting it, leading to a use-after-free in the pending-command list or
    allowing a local name update to rebuild EIR while UUID entries are being
    removed.
    
    Take hdev->mgmt_pending_lock while scanning hdev->mgmt_pending and treat
    MGMT_OP_SET_LOCAL_NAME as an EIR/class-affecting pending command on the
    powered asynchronous path.  Check for a conflicting pending command before
    copying the new short name so a rejected SET_LOCAL_NAME request does not
    modify hdev->short_name.
    
    Fixes: 6fe26f694c82 ("Bluetooth: MGMT: Protect mgmt_pending list with its own lock")
    Cc: [email protected]
    Reported-by: Vega <[email protected]>
    Assisted-by: Codex:gpt-5.4
    Signed-off-by: Zihan Xi <[email protected]>
    Signed-off-by: Ren Wei <[email protected]>
    Reported-by: Vega <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

Bluetooth: mgmt: fix UAF in pair command cancellation [+ + +]
Author: Zihan Xi <[email protected]>
Date:   Tue Jul 21 22:36:07 2026 +0800

    Bluetooth: mgmt: fix UAF in pair command cancellation
    
    commit d0a7b48ad0921bd88effaee10bf970ab1d5d0ddd upstream.
    
    The pairing completion and authentication failure callbacks look up the
    pending MGMT_OP_PAIR_DEVICE command by walking hdev->mgmt_pending. The
    lookup returned a command that was still linked on the shared pending list,
    without keeping mgmt_pending_lock held for the later dereference and
    removal.
    
    A concurrent MGMT_OP_CANCEL_PAIR_DEVICE request can remove and free the
    same pending command before the callback uses it. The reverse race is also
    possible when cancel_pair_device() gets a command from pending_find() and a
    callback removes it before the cancel path dereferences it. This can lead
    to a use-after-free and a second list_del().
    
    Make the pairing lookup helpers transfer ownership of the pending command
    by removing it from hdev->mgmt_pending while holding mgmt_pending_lock.
    The callbacks and cancel path then complete the command and free it
    directly, so racing paths cannot find or free the same command again. Take
    a temporary hci_conn reference in cancel_pair_device() because the command
    completion drops the reference stored in the pending command.
    
    Fixes: e9a416b5ce0c ("Bluetooth: Add mgmt_pair_device command")
    Cc: [email protected]
    Reported-by: Vega <[email protected]>
    Assisted-by: Codex:gpt-5.4
    Signed-off-by: Zihan Xi <[email protected]>
    Reviewed-by: Ren Wei <[email protected]>
    Reported-by: Vega <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

Bluetooth: SCO: give the socket its own sco_conn reference [+ + +]
Author: Aldo Ariel Panzardo <[email protected]>
Date:   Sat Jul 25 16:52:30 2026 -0300

    Bluetooth: SCO: give the socket its own sco_conn reference
    
    commit abd93c85c8667add738ee82aeab95dd9fc8265a2 upstream.
    
    sco_conn_del() drops a reference it does not own. It takes one transient
    reference via sco_conn_hold_unless_zero() and releases it with the
    sco_conn_put() that follows sco_sock_hold(); the additional put in the
    !sk branch releases a second one:
    
        conn = sco_conn_hold_unless_zero(conn);
        ...
        sk = sco_sock_hold(conn);
        sco_conn_unlock(conn);
        sco_conn_put(conn);
    
        if (!sk) {
                sco_conn_put(conn);
                return;
        }
    
    When close() races the controller's Disconnection Complete, sco_chan_del()
    clears conn->sk and drops the socket's reference while sco_conn_del() is
    running. sco_conn_del() then sees sk == NULL, its own put drops the count
    to zero and frees the conn, and the second put writes to the freed kref:
    
        BUG: KASAN: slab-use-after-free in sco_conn_put.part.0+0x1a/0x190
        Write of size 4 at addr ffff8881099dec74 by task kworker/u17:3/413
        Workqueue: hci1 hci_rx_work
        Call Trace:
         sco_conn_put.part.0+0x1a/0x190
         hci_disconn_complete_evt+0x1ee/0x3e0
         hci_event_packet+0x54a/0x650
         hci_rx_work+0x321/0x3d0
        Allocated by task 413:
         sco_conn_add+0x72/0x1a0
         sco_connect_cfm+0x88/0x670
        Freed by task 413:
         sco_conn_del.isra.0+0x3f/0xf0
         hci_disconn_complete_evt+0x1ee/0x3e0
        refcount_t: underflow; use-after-free.
    
    The root cause is that the socket stores the connection without holding a
    reference of its own. __sco_chan_add() does:
    
        sco_pi(sk)->conn = conn;
    
    so the socket borrows whatever reference its caller happened to hold, and
    the callers paper over that with ad-hoc holds and puts. Give the socket a
    counted reference instead: __sco_chan_add() takes one and it is released
    together with the channel (sco_chan_del()) and in sco_sock_destruct().
    With the socket holding its own reference, sco_conn_del() no longer needs
    the extra put and the redundant hold in sco_conn_ready() goes away.
    
    Making the socket own its reference means the connection is now actually
    freed on the error paths of sco_connect() where it used to leak, which in
    turn runs sco_conn_free() and its hci_conn_drop(conn->hcon). To keep the
    hci_conn accounting balanced, make that ownership explicit as well:
    sco_conn_add() consumes one hci_conn reference and the sco_conn owns it for
    its lifetime. sco_connect() hands over the reference returned by
    hci_connect_sco() and no longer drops it on the error paths;
    sco_connect_cfm(), which is not given a reference, takes one with
    hci_conn_hold() before handing it to sco_conn_add() (and drops it again if
    the allocation fails); and the explicit hci_conn_hold() in sco_conn_ready()
    is removed. Every reference then has a single, clear owner.
    
    Fixes: e6720779ae61 ("Bluetooth: SCO: Use kref to track lifetime of sco_conn")
    Cc: [email protected]
    Suggested-by: Pauli Virtanen <[email protected]>
    Signed-off-by: Aldo Ariel Panzardo <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
bpf: lwt: Fix dst reference leak on reroute failure [+ + +]
Author: Xuanqiang Luo <[email protected]>
Date:   Thu Jul 23 14:04:45 2026 +0800

    bpf: lwt: Fix dst reference leak on reroute failure
    
    commit 88c17de85ddb459c3fe1e3c65d61fa366b1cf0a8 upstream.
    
    bpf_lwt_xmit_reroute() obtains a referenced dst from the route
    lookup. When skb_cow_head() fails before that dst is installed on the
    skb, the error path only frees the skb. The skb still owns its previous
    dst, so the newly looked up dst reference is leaked.
    
    Release the new dst reference before freeing the skb on this error
    path.
    
    Fixes: 3bd0b15281af ("bpf: add handling of BPF_LWT_REROUTE to lwt_bpf.c")
    Cc: [email protected]
    Signed-off-by: Xuanqiang Luo <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
btrfs: fix leaking BTRFS_FS_STATE_REMOUNTING flag [+ + +]
Author: Qu Wenruo <[email protected]>
Date:   Sat Jul 4 17:58:56 2026 +0930

    btrfs: fix leaking BTRFS_FS_STATE_REMOUNTING flag
    
    [ Upstream commit 6881f45d0eb541f2cee8c37c84b3860a23823bb3 ]
    
    [BUG]
    The following script can lead to unexpected qgroup rescan failure:
    
      # mkfs.btrfs -f -O quota $dev
      # mount $dev $mnt
      # mount -o remount,rescue=ibadroots $mnt
        ^^^^^ This above command is expected to fail
    
      # btrfs quota rescan -w $mnt
        ^^^^^ The above qgroup rescan is not expected to fail
    
      # btrfs qgroup show $mnt
      WARNING: qgroup data inconsistent, rescan recommended
      Qgroupid    Referenced    Exclusive   Path
      --------    ----------    ---------   ----
      0/5           16.00KiB     16.00KiB   <toplevel>
    
    The above short script will be converted to a proper fstests case.
    
    [CAUSE]
    Inside btrfs_reconfigure(), if either btrfs_check_options() or
    btrfs_check_features() failed, we will always have
    BTRFS_FS_STATE_REMOUNTING set for the fs until the next successful
    remount.
    
    That BTRFS_FS_STATE_REMOUNTING flag will interrupt several operations,
    including:
    
    - Qgroup rescan
    - Auto defrag
    - Space reclaim
    
    [FIX]
    Change the error handling of btrfs_check_options() and
    btrfs_check_features() to goto restore label.
    
    Fixes: eddb1a433f26 ("btrfs: add reconfigure callback for fs_context")
    Reviewed-by: Johannes Thumshirn <[email protected]>
    Signed-off-by: Qu Wenruo <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

btrfs: raid56: fix an incorrect csum skip during scrub [+ + +]
Author: Qu Wenruo <[email protected]>
Date:   Sun Jul 12 13:12:51 2026 +0930

    btrfs: raid56: fix an incorrect csum skip during scrub
    
    [ Upstream commit 330dcc553f282e8dc0b88c9495b4c296465364e1 ]
    
    Commit 7425a2894019 ("btrfs: introduce btrfs_bio_for_each_block_all()
    helper") uses the new helper to replace the nested loop inside
    verify_bio_data_sectors(), which simplifies the code.
    
    However that also changed the behavior of "continue" when a block has no
    data checksum.
    
    Previously the "continue" would skip the old for() loop, which would also
    increase @total_sector_nr.
    
    Now the "continue" will skip the new btrfs_bio_for_each_block_all()
    loop, which doesn't update @total_sector_nr.
    
    This means if we hit a block that has no data checksum, we will skip all
    the remaining blocks no matter if they have data checksum.
    As @total_sector_nr will never be updated, and that test_bit() will
    always return false.
    
    Fix it by increasing @total_sector_nr before calling "continue".
    
    Fixes: 7425a2894019 ("btrfs: introduce btrfs_bio_for_each_block_all() helper")
    Reviewed-by: Daniel Vacek <[email protected]>
    Signed-off-by: Qu Wenruo <[email protected]>
    Reviewed-by: David Sterba <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

btrfs: zoned: fix deadlock between metadata writeback and transaction commit [+ + +]
Author: Johannes Thumshirn <[email protected]>
Date:   Fri Jul 3 07:54:40 2026 +0200

    btrfs: zoned: fix deadlock between metadata writeback and transaction commit
    
    [ Upstream commit 1ebe51c29fa9755d5b2fea28727c051117907cf8 ]
    
    When writing out metadata extent buffers in a zoned filesystem,
    btree_writepages() holds fs_info->zoned_meta_io_lock across the whole
    writeback loop, including the call to btrfs_check_meta_write_pointer() ->
    check_bg_is_active().
    
    For the tree-log block group, check_bg_is_active() may fail to activate
    the zone and fall back to btrfs_zone_finish_one_bg() to free an active
    zone. That path waits for the running transaction to commit while still
    holding zoned_meta_io_lock, but the committer needs that same lock to
    write out the tree extents, so the two tasks deadlock:
    
      Task A (kworker, metadata writeback)      Task B (fsstress, transaction commit)
      ------------------------------------      -------------------------------------
      wb_workfn()                               btrfs_commit_transaction(T)
       btree_writepages()                        btrfs_write_and_wait_transaction()
        btrfs_zoned_meta_io_lock()                btrfs_write_marked_extents()
        btrfs_check_meta_write_pointer()           btree_writepages()
         check_bg_is_active() [treelog_bg]          btrfs_zoned_meta_io_lock()
          btrfs_zone_finish_one_bg()               <blocks on zoned_meta_io_lock,
           btrfs_zone_finish()                      held by Task A>
            do_zone_finish()
             btrfs_inc_block_group_ro()
              btrfs_wait_for_commit()
               <blocks waiting for commit
                of transaction T, done by
                Task B>
    
    The sibling branch in check_bg_is_active() already drops zoned_meta_io_lock
    around do_zone_finish() for this exact reason. Do the same in the tree-log
    branch: release the lock around btrfs_zone_finish_one_bg() and re-acquire
    it afterwards. The lock only protects fs_info->active_{meta,system}_bg,
    which this branch does not touch, and ctx->zoned_bg keeps a reference to
    the block group across the unlock, so nothing is lost while the lock
    is dropped.
    
    This hang occasionally reproduces with fstests generic/475 on a zoned
    btrfs filesystem.
    
    Fixes: 13bb483d32ab ("btrfs: zoned: activate metadata block group on write time")
    Reviewed-by: Naohiro Aota <[email protected]>
    Signed-off-by: Johannes Thumshirn <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

btrfs: zoned: reset meta_write_pointer on zone reset [+ + +]
Author: Johannes Thumshirn <[email protected]>
Date:   Fri Jul 3 07:54:45 2026 +0200

    btrfs: zoned: reset meta_write_pointer on zone reset
    
    [ Upstream commit 5fabb1cf25d723274009d7b759545fd59f230c9d ]
    
    btrfs_reset_unused_block_groups() resets a block group's zone and sets
    alloc_offset back to 0 so the space can be reused, but it leaves
    meta_write_pointer pointing at the previous end of the zone.
    
    Once the block group is reactivated and reused for metadata, newly
    allocated tree blocks live before that stale write pointer.
    btrfs_check_meta_write_pointer() then sees them behind the write pointer,
    so they can never be written out in sequential order: the dirty extent
    buffers are stranded and pin their btree_inode folios until unmount.
    
    Reset meta_write_pointer back to the start of the block group for
    metadata and system block groups.
    
    Fixes: 453a73c3069a ("btrfs: zoned: reclaim unused zone by zone resetting")
    Reviewed-by: Naohiro Aota <[email protected]>
    Signed-off-by: Johannes Thumshirn <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
can: c_can: c_can_chip_config(): keep controller in init mode until bittiming is configured [+ + +]
Author: Lucas Martins Alves <[email protected]>
Date:   Tue Jul 14 16:48:57 2026 +0000

    can: c_can: c_can_chip_config(): keep controller in init mode until bittiming is configured
    
    commit 26504844613fb44c7cab1c5f6fcff77861709baa upstream.
    
    c_can_chip_config() was programming C_CAN_CTRL_REG without CONTROL_INIT,
    which may allow the controller to become active before
    c_can_set_bittiming() finishes.
    
    That creates a short timing window where the peripheral can interact with
    the bus using a different/default bitrate, potentially generating bus
    errors and corrupting traffic.
    
    Set CONTROL_INIT together with the control-mode writes in
    c_can_chip_config() (normal, loopback and listen-only paths), so the
    controller stays halted until bit timing is fully programmed.
    
    This prevents transient bus disturbance during startup when the configured
    bitrate differs from the active bus bitrate.
    
    Signed-off-by: Lucas Martins Alves <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Fixes: 881ff67ad450 ("can: c_can: Added support for Bosch C_CAN controller")
    Cc: [email protected]
    [mkl: remove space before close parenthesis]
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

can: ctucanfd: add missing MODULE_DEVICE_TABLE() [+ + +]
Author: Pengpeng Hou <[email protected]>
Date:   Sat Jul 4 23:19:57 2026 +0800

    can: ctucanfd: add missing MODULE_DEVICE_TABLE()
    
    commit d937bdb244a751fe5967052ea2d64a7b2c476cc0 upstream.
    
    The driver has a match table for the pci bus wired into its driver
    structure, but the table is not exported with MODULE_DEVICE_TABLE().
    
    Add the missing MODULE_DEVICE_TABLE() entry so module alias information
    is generated for automatic module loading.
    
    This is a source-level fix.  It does not claim dynamic hardware
    reproduction; the evidence is the driver-owned match table, its use by
    the driver registration structure, and the missing module alias
    publication.
    
    Signed-off-by: Pengpeng Hou <[email protected]>
    Acked-by: Pavel Pisa <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Fixes: 792a5b678e81 ("can: ctucanfd: CTU CAN FD open-source IP core - PCI bus support.")
    Cc: [email protected]
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

can: ctucanfd: handle bus error interrupts [+ + +]
Author: Avi Weiss <[email protected]>
Date:   Thu Jul 23 10:44:03 2026 +0300

    can: ctucanfd: handle bus error interrupts
    
    commit e74bae899529f49c0f375307983d12e8ecad7d4b upstream.
    
    Include REG_INT_STAT_BEI in the top-level error interrupt condition.
    
    BEI is enabled when CAN_CTRLMODE_BERR_REPORTING is requested and
    ctucan_err_interrupt() already handles it. Without checking and
    clearing BEI in the top-level handler, bus error interrupts are not
    handled or acknowledged.
    
    Fixes: 2dcb8e8782d8 ("can: ctucanfd: add support for CTU CAN FD open-source IP core - bus independent part.")
    Signed-off-by: Avi Weiss <[email protected]>
    Acked-by: Pavel Pisa <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Cc: [email protected]
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

can: ctucanfd: mark error-active controller status valid [+ + +]
Author: Avi Weiss <[email protected]>
Date:   Thu Jul 23 18:55:43 2026 +0300

    can: ctucanfd: mark error-active controller status valid
    
    commit 4e735cbe3affe88001428fdd9cae8e685ce92f21 upstream.
    
    In the CAN_STATE_ERROR_ACTIVE case, cf->data[1] is set to
    CAN_ERR_CRTL_ACTIVE, but cf->can_id is not set with CAN_ERR_CRTL in
    that path.
    
    Set CAN_ERR_CRTL so consumers know the controller-status information
    in cf->data[1] is valid.
    
    Fixes: 9bd24927e3ee ("can: ctucanfd: handle skb allocation failure")
    Signed-off-by: Avi Weiss <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Cc: [email protected]
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

can: ctucanfd: unmap BAR0 using base address [+ + +]
Author: Avi Weiss <[email protected]>
Date:   Thu Jul 23 12:59:34 2026 +0300

    can: ctucanfd: unmap BAR0 using base address
    
    commit a6873910f983096746d1a2e0af94f36b8003e839 upstream.
    
    BAR0 is mapped into bar0_base, while cra_addr points to an offset
    within that mapping and is used for other purposes.
    
    Pass bar0_base to pci_iounmap(), instead of cra_addr, on the probe error
    path so the address returned by pci_iomap() is used for unmapping.
    
    Fixes: 792a5b678e81 ("can: ctucanfd: CTU CAN FD open-source IP core - PCI bus support.")
    Signed-off-by: Avi Weiss <[email protected]>
    Acked-by: Pavel Pisa <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Cc: [email protected]
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

can: ctucanfd: use self-test mode for PRESUME_ACK [+ + +]
Author: Avi Weiss <[email protected]>
Date:   Wed Jul 22 22:27:26 2026 +0300

    can: ctucanfd: use self-test mode for PRESUME_ACK
    
    commit c31a435933f18be0f874302161333e9f16e200a0 upstream.
    
    Use self-test mode for CAN_CTRLMODE_PRESUME_ACK so transmitted
    frames can complete without receiving an ACK.
    
    ACK forbidden mode prevents the controller from acknowledging
    received frames and does not implement the presume-ack behavior.
    
    Fixes: 2dcb8e8782d8 ("can: ctucanfd: add support for CTU CAN FD open-source IP core - bus independent part.")
    Signed-off-by: Avi Weiss <[email protected]>
    Acked-by: Pavel Pisa <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Cc: [email protected]
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

can: ems_usb: validate CPC message lengths [+ + +]
Author: Pengpeng Hou <[email protected]>
Date:   Mon Jul 6 17:27:52 2026 +0800

    can: ems_usb: validate CPC message lengths
    
    commit 02925f51377f2a42a6724f00549167499c9302e5 upstream.
    
    ems_usb_read_bulk_callback() walks CPC messages packed in one USB
    receive buffer.
    
    Check that each declared message fits in the URB payload. Also require the
    type-specific payload to cover the fields used by the CAN, state, error and
    overrun handlers.
    
    Signed-off-by: Pengpeng Hou <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Fixes: 702171adeed3 ("ems_usb: Added support for EMS CPC-USB/ARM7 CAN/USB interface")
    Cc: [email protected]
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

can: etas_es58x: es58x_read_bulk_callback(): fix RX buffer leak on URB resubmit failure [+ + +]
Author: Guangshuo Li <[email protected]>
Date:   Mon Jul 6 09:46:01 2026 +0800

    can: etas_es58x: es58x_read_bulk_callback(): fix RX buffer leak on URB resubmit failure
    
    commit 7a0cf2b2497c757c3cb1286eddf2986abb0d387b upstream.
    
    es58x_read_bulk_callback() resubmits the RX URB after processing a received
    packet. If the resubmit succeeds, the URB remains anchored and will be
    handled by the normal RX path or by teardown.
    
    However, if usb_submit_urb() fails, the callback unanchors the URB and then
    returns directly. This skips the existing free_urb path, so the coherent
    transfer buffer allocated with usb_alloc_coherent() is not released.
    
    Reuse the existing free_urb path after a resubmit failure so that the RX
    coherent buffer is freed before leaving the callback.
    
    Fixes: 5eaad4f76826 ("can: usb: etas_es58x: correctly anchor the urb in the read bulk callback")
    Signed-off-by: Guangshuo Li <[email protected]>
    Reviewed-by: Vincent Mailhol <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Cc: [email protected]
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

can: gs_usb: gs_usb_receive_bulk_callback(): resubmit URB on skb allocation failure [+ + +]
Author: Marc Kleine-Budde <[email protected]>
Date:   Thu Jul 9 09:54:26 2026 +0200

    can: gs_usb: gs_usb_receive_bulk_callback(): resubmit URB on skb allocation failure
    
    commit 68c5724ecd159992f76edb7b57dc508a44c8b7da upstream.
    
    If the allocation of the SKB in gs_usb_receive_bulk_callback() fails, the
    driver returns from the callback without resubmitting the URB in order to
    receive further USB in URBs.
    
    This results in a silent performance degradation which, if it occurs
    repeatedly, results in starvation of USB in traffic.
    
    Instead of returning immediately, try to resend the URB. If this also
    fails, this is logged as an info message.
    
    Fixes: d08e973a77d1 ("can: gs_usb: Added support for the GS_USB CAN devices")
    Fixes: 26949ac935e3 ("can: gs_usb: add CAN-FD support")
    Link: https://patch.msgid.link/[email protected]
    Cc: [email protected]
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

can: isotp: check register_netdevice_notifier() error in module init [+ + +]
Author: Minhong He <[email protected]>
Date:   Wed Jul 29 16:56:56 2026 +0800

    can: isotp: check register_netdevice_notifier() error in module init
    
    [ Upstream commit ef09a13c5afac41a3c4b5f22b8572820d9e7518c ]
    
    Register the netdevice notifier before can_proto_register() and check the
    return value. If protocol registration fails, unregister the notifier
    before returning the error.
    
    Align isotp_module_init() with the reordering already done for raw.c
    (commit c28b3bffe49e ("can: raw: process optimization in raw_init()")) and
    bcm.c (commit edd1a7e42f1d ("can: bcm: registration process optimization
    in bcm_module_init()")).
    
    Fixes: 8d0caedb7596 ("can: bcm/raw/isotp: use per module netdevice notifier")
    Signed-off-by: Minhong He <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

can: isotp: fix timer drain order, wakeup handling and tx_gen ordering [+ + +]
Author: Oliver Hartkopp <[email protected]>
Date:   Fri Aug 7 09:52:11 2026 +0200

    can: isotp: fix timer drain order, wakeup handling and tx_gen ordering
    
    commit 050f010f920da17c1044a4f174766ad553e770b6 upstream.
    
    This patch is a follow-up to commit cf070fe33bfb ("can: isotp: serialize
    TX state transitions under so->rx_lock") which addresses following
    sashiko-bot findings:
    
    - isotp_sendmsg(): drain so->txfrtimer first so a stale callback can't
      re-arm echotimer after the claim
    
    - isotp_release(): wake so->wait after forcing ISOTP_SHUTDOWN so a
      sleeping sendmsg() claim isn't stranded
    
    - isotp_sendmsg(): have both wait_event_interruptible() calls in
      isotp_sendmsg() also wake on ISOTP_SHUTDOWN and do not return claim to
      IDLE to avoid corrupting a concurrent isotp_release() process.
    
    - isotp_sendmsg(): handle potential claim of a new transfer when
      the wait_event_interruptible() call returns in CAN_ISOTP_WAIT_TX_DONE
      mode. Don't touch timers and states of the new transfer if a new thread
      incremented so->tx_gen before getting the lock at err_event_drop.
    
    - isotp_sendmsg(): handle a stuck can_send() and omit timer and state
      changes if a new transfer was claimed. wait_tx_done() returns the error
      recorded in so->tx_result[], tagged with the caller's own generation.
    
    - isotp_tx_timeout(): on a claimed timeout, record the ECOMM error for
      the timed-out transfer's own generation in so->tx_result[]; sk->sk_err
      is raised unconditionally, same as every other error path here.
    
    - isotp_tx_gen_done()/isotp_tx_timeout(): always read tx.state (acquire)
      before tx_gen - the reverse order let a weakly ordered CPU pair a fresh
      tx.state with a stale tx_gen/tx_result slot.
    
    - isotp_sendmsg(): wait_tx_done: drain sk_err via sock_error() once we
      have read the result from so->tx_result[], so an already-reported error
      doesn't stay latched for a later poll()/SO_ERROR.
    
    Also align the remaining lock-free so->tx.state/rx.state/cfecho accesses
    and use skb->hash as unique loopback echo frame indicator.
    
    Fixes: cf070fe33bfb ("can: isotp: serialize TX state transitions under so->rx_lock")
    Signed-off-by: Oliver Hartkopp <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Cc: [email protected]
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Oliver Hartkopp <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

can: j1939: transport: j1939_session_fresh_new(): initialize receive buffer [+ + +]
Author: Oleksij Rempel <[email protected]>
Date:   Tue Jul 28 07:58:35 2026 +0200

    can: j1939: transport: j1939_session_fresh_new(): initialize receive buffer
    
    commit eb96c58907922546e415e545fe9a14ea63b02719 upstream.
    
    Zero the allocated buffer in j1939_session_fresh_new() to ensure it
    contains no residual data.
    
    While there is a potential performance impact if users allocate maximum
    sized ETP buffers, most real-world use cases are not noticeably affected
    since the maximum known buffer size is typically around 65K.
    
    Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol")
    Reported-by: Ji'an Zhou <[email protected]>
    Message-ID: <CAPAUci5dykCLjoijqkUtFqJFesgncrD7+S6y_V=gjbFkY2Tifg@mail.gmail.com>
    Signed-off-by: Oleksij Rempel <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Cc: [email protected]
    [mkl: add Message-ID]
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

can: j1939: use netdevice_tracker for j1939_{priv,session,ecu} tracking [+ + +]
Author: Tetsuo Handa <[email protected]>
Date:   Tue Jul 28 07:58:34 2026 +0200

    can: j1939: use netdevice_tracker for j1939_{priv,session,ecu} tracking
    
    commit d2fb981384b3a45f690616d550b29046e8ad16a4 upstream.
    
    syzbot is still reporting
    
      unregister_netdevice: waiting for vcan0 to become free. Usage count = 2
    
    problem. A debug printk() patch in linux-next-20260508 identified that
    there is dev_hold()/dev_put() imbalance in j1939_priv management.
    
      Call trace for vcan0[26] +4 at
         __dev_hold include/linux/netdevice.h:4470 [inline]
         netdev_hold include/linux/netdevice.h:4513 [inline]
         dev_hold include/linux/netdevice.h:4536 [inline]
         j1939_priv_create net/can/j1939/main.c:140 [inline]
         j1939_netdev_start+0x36b/0xc10 net/can/j1939/main.c:268
         j1939_sk_bind+0x853/0xb30 net/can/j1939/socket.c:506
         __sys_bind_socket net/socket.c:1948 [inline]
         __sys_bind+0x2e9/0x410 net/socket.c:1979
    
      Call trace for vcan0[28] -3 at
         __dev_put include/linux/netdevice.h:4456 [inline]
         netdev_put include/linux/netdevice.h:4523 [inline]
         dev_put include/linux/netdevice.h:4548 [inline]
         __j1939_priv_release net/can/j1939/main.c:166 [inline]
         kref_put include/linux/kref.h:65 [inline]
         j1939_priv_put+0x128/0x270 net/can/j1939/main.c:172
         j1939_sk_sock_destruct+0x52/0x90 net/can/j1939/socket.c:388
         __sk_destruct+0x8d/0x9d0 net/core/sock.c:2352
         rcu_do_batch kernel/rcu/tree.c:2617 [inline]
         rcu_core kernel/rcu/tree.c:2869 [inline]
         rcu_cpu_kthread+0x99e/0x1470 kernel/rcu/tree.c:2957
         smpboot_thread_fn+0x541/0xa50 kernel/smpboot.c:160
         kthread+0x388/0x470 kernel/kthread.c:436
         ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
         ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
    
    This refcount leak in j1939_priv might be caused by a refcount leak in
    j1939_{session,ecu} because j1939_{session,ecu} holds a ref on j1939_priv.
    For further investigation using upstream kernels, enable netdevice_tracker
    in j1939_{priv,session,ecu} management.
    
    Signed-off-by: Tetsuo Handa <[email protected]>
    Acked-by: Oleksij Rempel <[email protected]>
    Signed-off-by: Oleksij Rempel <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Cc: [email protected]
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

can: kvaser_usb: kvaser_usb_hydra_get_busparams(): fix memory leak in kvaser_usb_hydra_get_busparams() [+ + +]
Author: Abdun Nihaal <[email protected]>
Date:   Wed Jul 22 16:09:03 2026 +0530

    can: kvaser_usb: kvaser_usb_hydra_get_busparams(): fix memory leak in kvaser_usb_hydra_get_busparams()
    
    commit 941eaf9a6d3b33dea49f2c0a1da7546a03b6ff71 upstream.
    
    The memory allocated for cmd is not freed after the call to
    kvaser_usb_send_cmd() in both the normal and error paths.
    Fix that by adding a kfree() immediately after the call.
    
    Fixes: 39d3df6b0ea8 ("can: kvaser_usb: Compare requested bittiming parameters with actual parameters in do_set_{,data}_bittiming")
    Cc: [email protected]
    Signed-off-by: Abdun Nihaal <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

can: kvaser_usb_leaf: kvaser_usb_leaf_wait_cmd(): validate received command extents [+ + +]
Author: Pengpeng Hou <[email protected]>
Date:   Wed Jul 22 12:22:21 2026 +0800

    can: kvaser_usb_leaf: kvaser_usb_leaf_wait_cmd(): validate received command extents
    
    commit 0293dd153f9dbc1ddf5dacdccc76b363bce4a8ee upstream.
    
    The wait and bulk receive paths walk variable-length commands from a
    USB buffer. A nonzero command shorter than CMD_HEADER_LEN can still be
    dispatched, and the wait path copies a matching command into a fixed
    caller-owned struct kvaser_cmd using the device-provided length.
    
    Reject nonzero commands that do not contain the fixed header or that
    extend beyond the current USB buffer item. In the wait path, also reject
    a matching command that exceeds the destination before copying it.
    
    Fixes: 080f40a6fa28 ("can: kvaser_usb: Add support for Kvaser CAN/USB devices")
    Signed-off-by: Pengpeng Hou <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Cc: [email protected]
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

can: peak_usb: add bounds check for USB channel index [+ + +]
Author: James Gao <[email protected]>
Date:   Wed May 20 13:40:03 2026 +0800

    can: peak_usb: add bounds check for USB channel index
    
    commit 39132f166ca8ce00ae60d8a9068e06a60943cc4b upstream.
    
    The channel control index ctrl_idx is derived from rx->len which comes
    directly from a device USB payload. The mask 0x0f allows values 0-15, but
    the array size of usb_if->dev[] is only 2. Values 2-15 cause heap
    out-of-bounds read, eventually causing kernel panic in the IRQ context.
    
    Add bounds checking for ctrl_idx before the array access in both
    pcan_usb_pro_handle_canmsg() and pcan_usb_pro_handle_error().
    
    Fixes: d8a199355f8f ("can: usb: PEAK-System Technik PCAN-USB Pro specific part")
    Signed-off-by: James Gao <[email protected]>
    Reviewed-by: Vincent Mailhol <[email protected]>
    Link: https://patch.msgid.link/TYWPR01MB8559DBAAAA6A7F410400329CF0012@TYWPR01MB8559.jpnprd01.prod.outlook.com
    Cc: [email protected]
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

can: peak_usb: peak_usb_start(): fix double free of transfer buffer on URB submit error [+ + +]
Author: Maoyi Xie <[email protected]>
Date:   Wed Jun 17 02:15:31 2026 +0800

    can: peak_usb: peak_usb_start(): fix double free of transfer buffer on URB submit error
    
    commit 9b3d5a6d952c38bbcf07f903cbeadefdb56b9bc9 upstream.
    
    In peak_usb_start(), each RX URB transfer buffer is allocated with kmalloc()
    and the URB is flagged URB_FREE_BUFFER so that the final usb_free_urb() also
    frees the transfer buffer.
    
    If usb_submit_urb() fails, the error path frees the buffer explicitly with
    kfree(buf) and then calls usb_free_urb(urb). Because URB_FREE_BUFFER is set,
    usb_free_urb() -> urb_destroy() frees the same buffer a second time, a double
    free of the transfer buffer.
    
      BUG: KASAN: double-free in usb_free_urb.part.0+0x91/0xb0
      Free of addr ffff8881069ccb80 by task trigger.sh/285
    
      Call Trace:
       kfree+0x113/0x3c0
       usb_free_urb.part.0+0x91/0xb0
    
    Drop the redundant kfree(buf); usb_free_urb() already releases the transfer
    buffer. This mirrors commit 03819abbeb11 ("net: usb: lan78xx: Fix double free
    issue with interrupt buffer allocation").
    
    Fixes: bb4785551f64 ("can: usb: PEAK-System Technik USB adapters driver core")
    Closes: https://lore.kernel.org/linux-can/[email protected]/T/#u
    Cc: [email protected]
    Signed-off-by: Maoyi Xie <[email protected]>
    Reviewed-by: Vincent Mailhol <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

can: peak_usb: validate uCAN receive record lengths [+ + +]
Author: Pengpeng Hou <[email protected]>
Date:   Mon Jul 6 17:28:36 2026 +0800

    can: peak_usb: validate uCAN receive record lengths
    
    commit 93fcab2c6968446316bbb49548848df604d6346f upstream.
    
    pcan_usb_fd_decode_buf() walks uCAN records packed in one USB
    receive buffer.
    
    Require each record to contain the fixed header for its type, and verify
    CAN payload bytes before copying them into the skb.
    
    Signed-off-by: Pengpeng Hou <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Fixes: 0a25e1f4f185 ("can: peak_usb: add support for PEAK new CANFD USB adapters")
    Cc: [email protected]
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

can: softing: fw_parse(): validate firmware record spans [+ + +]
Author: Pengpeng Hou <[email protected]>
Date:   Wed Jul 22 12:43:47 2026 +0800

    can: softing: fw_parse(): validate firmware record spans
    
    commit 856d6cb04e5407523566b075841dcd6423757d1c upstream.
    
    fw_parse() reads a fixed record header, a firmware-provided payload,
    and a trailing checksum without knowing the end of the firmware blob. A
    truncated record can therefore make those reads exceed the blob.
    
    The same record also supplies addresses and lengths for writes into
    DPRAM. The generic loader uses wrap-prone mixed signed arithmetic for its
    bounds check, while the application loader does not bound the staging
    copy at all.
    
    Pass the firmware end to the parser and validate the full source record.
    Use a signed wide offset for generic DPRAM records and validate the
    application staging span against the mapped DPRAM before copying.
    
    Fixes: 03fd3cf5a179 ("can: add driver for Softing card")
    Signed-off-by: Pengpeng Hou <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Cc: [email protected]
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

can: use skb hash instead of private variable in headroom [+ + +]
Author: Oliver Hartkopp <[email protected]>
Date:   Fri Aug 7 09:52:10 2026 +0200

    can: use skb hash instead of private variable in headroom
    
    commit d4fb6514ff8ed6912a71294e6b66a5d59ee88007 upstream.
    
    The can_skb_priv::skbcnt variable is used to identify CAN skbs in the RX
    path analogue to the skb->hash.
    
    As the skb hash is not filled in CAN skbs move the private skbcnt value to
    skb->hash and set skb->sw_hash accordingly. The skb->hash is a value used
    for RPS to identify skbs. Use it as intended.
    
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Oliver Hartkopp <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Oliver Hartkopp <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
cifs: add fscache_resize_cookie() to cifs_setsize() [+ + +]
Author: Frank Sorenson <[email protected]>
Date:   Sat Jul 25 21:04:44 2026 +0000

    cifs: add fscache_resize_cookie() to cifs_setsize()
    
    commit fa724e235cfdb0fb0bb427d0f9dfe864ae27403e upstream.
    
    Several code paths update the VFS inode size by calling
    netfs_resize_file() and cifs_setsize(), but omit the corresponding
    fscache_resize_cookie() call, leaving the fscache cookie out of sync
    with the actual file size:
    
      - cifs_file_set_size() in inode.c: server-side truncation via setattr
      - cifs_do_truncate() in file.c: truncates to zero on O_TRUNC open
      - smb2_duplicate_extents() in smb2ops.c: file clone extending EOF
      - smb3_simple_falloc() in smb2ops.c: two branches that extend EOF
        via write-range and SMB2_set_eof respectively
    
    Since every caller of cifs_setsize() must resize the fscache cookie,
    add the call to cifs_setsize() itself, consistent with how
    truncate_pagecache() is already consolidated there.
    
    Fixes: 70431bfd825d ("cifs: Support fscache indexing rewrite")
    Fixes: 93a43155127f ("cifs: Fix missing set of remote_i_size")
    Fixes: 110fee6b9bb5 ("smb: client: fix missing timestamp updates with O_TRUNC")
    Fixes: 7a06d3b816d7 ("smb/client: emulate small EOF-extending mode 0 fallocate ranges")
    Cc: [email protected]
    Cc: David Howells <[email protected]>
    Cc: Paulo Alcantara <[email protected]>
    Cc: Huiwen He <[email protected]>
    Signed-off-by: Frank Sorenson <[email protected]>
    Reviewed-by: Paulo Alcantara <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
cpufreq: powernow-k8: Fix possible memory leak in powernowk8_cpu_init() [+ + +]
Author: Abdun Nihaal <[email protected]>
Date:   Mon Jul 27 15:05:51 2026 +0530

    cpufreq: powernow-k8: Fix possible memory leak in powernowk8_cpu_init()
    
    commit d5f8e5f6040d052d44fcbf4f31dd35145c0c8d7d upstream.
    
    The memory allocated for data->powernow_table inside
    powernow_k8_cpu_init_acpi() or find_psb_table() is not freed in one of
    the error paths in powernowk8_cpu_init(). Fix that by adding a kfree().
    
    Fixes: 1ff6e97f1d99 ("[CPUFREQ] cpumask: avoid playing with cpus_allowed in powernow-k8.c")
    Cc: [email protected]
    Signed-off-by: Abdun Nihaal <[email protected]>
    Acked-by: Viresh Kumar <[email protected]>
    Reviewed-by: Zhongqiu Han <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

cpufreq: schedutil: Publish util hooks only after all sg_cpu are initialized [+ + +]
Author: Zhongqiu Han <[email protected]>
Date:   Thu Jul 16 19:51:58 2026 +0800

    cpufreq: schedutil: Publish util hooks only after all sg_cpu are initialized
    
    commit f0a3f042293a8c5a2152346b3637ea60866c503a upstream.
    
    Commit 16a03c71bba0 ("cpufreq: schedutil: Merge initialization code of
    sg_cpu in single loop") merged the per-CPU initialization and the
    utilization-hook registration into a single loop in sugov_start().
    
    For a shared cpufreq policy this re-introduces the race originally fixed
    by commit ab2f7cf141aa ("cpufreq: schedutil: Fix sugov_start() versus
    sugov_update_shared() race").
    
    The scheduler's util path reaches the hook under RCU-sched and never takes
    policy->rwsem, so the rwsem held across sugov_start() cannot serialize the
    two. Once the first CPU's hook is published, sugov_update_shared() may run
    and, via sugov_next_freq_shared(), read/write each sibling sugov_cpu
    (iowait_boost, util, bw_min, ...) concurrently with the memset() still
    initializing them, with no lock common to both sides: the update side holds
    sg_policy->update_lock while the init side holds only policy->rwsem, which
    the scheduler's util path never takes.
    
    The walk only accesses scalar members, never a pointer like ->sg_policy,
    so it does not crash today; it merely uses stale (or zero on first start)
    values that skew the frequency selection and tracepoints. It is still a
    genuine data race, and a latent crash once any pointer member is
    dereferenced there.
    
    Restore the two-phase approach: initialize all per-CPU structures first,
    and only then publish the per-CPU utilization update hooks.
    
    Fixes: 16a03c71bba0 ("cpufreq: schedutil: Merge initialization code of sg_cpu in single loop")
    Cc: [email protected]
    Signed-off-by: Zhongqiu Han <[email protected]>
    Reviewed-by: Christian Loehle <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
dibs: fix use-after-free of dmb_node in loopback attach/detach/unregister [+ + +]
Author: Hidayath Khan <[email protected]>
Date:   Mon Jul 27 11:35:30 2026 +0200

    dibs: fix use-after-free of dmb_node in loopback attach/detach/unregister
    
    commit a10ea943356b9d70c5616a0a06f6fa97cfdaccb1 upstream.
    
    dibs_lo_attach_dmb(), dibs_lo_detach_dmb() and dibs_lo_unregister_dmb()
    look up the dmb_node under dmb_ht_lock, drop the lock and only then
    operate on the node's refcount. Nothing keeps the node alive across
    that window: __dibs_lo_unregister_dmb() removes the node from the hash
    table under the write lock and immediately frees it.
    
    A concurrent final put can therefore free the node between the lookup
    and the refcount operation:
    
    CPU0 (attach)                     CPU1 (owner unregisters)
    
    read_lock_bh(&dmb_ht_lock)
    find dmb_node (refcnt == 1)
    read_unlock_bh(&dmb_ht_lock)
                                      refcount_dec_and_test() 1 -> 0
                                      write_lock_bh(&dmb_ht_lock)
                                      hash_del(&dmb_node->list)
                                      write_unlock_bh(&dmb_ht_lock)
                                      kfree(dmb_node)
    refcount_inc_not_zero(&dmb_node->refcnt)  <-- use-after-free
    
    The same window exists for the refcount_dec_and_test() calls in the
    detach and unregister paths.
    
    Close the race structurally by making hash table membership and the
    refcount transitions atomic with respect to each other:
    
    - Perform the final refcount_dec_and_test() and hash_del() in a single
      dmb_ht_lock write-side critical section, in both the unregister and
      the detach path. Freeing the node still happens after the lock is
      dropped, which is safe because a node whose refcount reached zero has
      left the hash table and can no longer be found.
    
    - This establishes the invariant that any node found in the hash table
      holds at least one reference, and that the final reference can only
      be dropped under the write lock. dibs_lo_attach_dmb() can thus take
      its reference with a plain refcount_inc() while still holding the
      read lock; refcount_inc_not_zero() is no longer needed.
    
    __dibs_lo_unregister_dmb() no longer touches the hash table and is
    renamed to dibs_lo_free_dmb() accordingly.
    
    Note: commit cc21191b584c ("dibs: Move data path to dibs layer") moved
    the code to its current location; the race was introduced earlier by
    commit c3a910f2380f ("net/smc: implement DMB-merged operations of
    loopback-ism").
    
    Tested SMC-D via ISM and dibs loopback.
    
    Cc: [email protected]
    Fixes: c3a910f2380f ("net/smc: implement DMB-merged operations of loopback-ism")
    Reported-by: Rahul Chandelkar <[email protected]>
    Signed-off-by: Hidayath Khan <[email protected]>
    Reviewed-by: Alexandra Winter <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
dmaengine: idxd: fix fdev setup failure cleanup in idxd_cdev_open() [+ + +]
Author: Yuho Choi <[email protected]>
Date:   Mon May 25 10:15:50 2026 -0400

    dmaengine: idxd: fix fdev setup failure cleanup in idxd_cdev_open()
    
    [ Upstream commit ee1d7274102285d78a53161fc705a8d8cd40b066 ]
    
    The failed_dev_add and failed_dev_name paths drop the file-device
    reference while wq->wq_lock is still held. If put_device(fdev) drops the
    last reference, idxd_file_dev_release() runs synchronously and tries to
    take wq->wq_lock again, deadlocking.
    
    Those paths also fall through into the later ctx cleanup labels even
    though idxd_file_dev_release() owns that cleanup and frees ctx. This can
    make idxd_xa_pasid_remove(ctx) and kfree(ctx) operate on a freed context.
    
    Move idxd_wq_get() before file-device setup can fail, since the release
    callback always calls idxd_wq_put(). Then unlock wq->wq_lock before
    put_device(fdev) and return directly from the file-device setup failure
    path, leaving ctx cleanup to the release callback.
    
    Fixes: e6fd6d7e5f0fe ("dmaengine: idxd: add a device to represent the file opened")
    Signed-off-by: Yuho Choi <[email protected]>
    Reviewed-by: Dave Jiang <[email protected]>
    Acked-by: Vinicius Costa Gomes <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Vinod Koul <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

dmaengine: qcom: bam_dma: Fix command element mask field for BAM v1.6.0+ [+ + +]
Author: Md Sadre Alam <[email protected]>
Date:   Mon Jun 15 11:39:08 2026 +0530

    dmaengine: qcom: bam_dma: Fix command element mask field for BAM v1.6.0+
    
    commit 867621ba203027338b525af6729719c544135336 upstream.
    
    BAM version 1.6.0 and later changed the behavior of the mask field in
    command elements for read operations.
    
    In older BAM versions, or prior implementation assumptions, the mask
    field was effectively ignored for read commands. However, starting from
    BAM v1.6.0, the mask field for read commands is repurposed to carry the
    upper 4 bits of the destination address, enabling support for 36-bit
    addressing. For write commands, the mask field continues to function as
    a traditional write mask.
    
    The current driver sets mask = 0xffffffff for all command elements.
    While this works for write operations, it breaks read operations on
    BAM v1.6.0+ hardware. In such cases, the hardware interprets the upper
    address bits as 0xf, resulting in an invalid destination address
    (0xf_xxxxxxxx instead of 0x0_xxxxxxxx).
    
    This leads to failures such as NAND enumeration issues observed on
    platforms like IPQ5424.
    
    Fix this by assigning the mask field based on command type:
      - For read commands: set mask = 0 (upper address bits = 0)
      - For write commands: retain mask = 0xffffffff
    
    Also update the bam_cmd_element structure documentation to reflect the
    dual purpose of the mask field across BAM versions.
    
    This ensures correct behavior on BAM v1.6.0+ while maintaining backward
    compatibility with older hardware.
    
    Fixes: dfebb055f73a2 ("dmaengine: qcom: bam_dma: wrapper functions for command descriptor")
    Tested-by: Lakshmi Sowjanya D <[email protected]>
    Signed-off-by: Md Sadre Alam <[email protected]>
    Reviewed-by: Frank Li <[email protected]>
    Reviewed-by: Dmitry Baryshkov <[email protected]>
    Cc: [email protected]
    Signed-off-by: Varadarajan Narayanan <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Vinod Koul <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

dmaengine: sun6i-dma: Fix reclaim descriptors while terminating DMA [+ + +]
Author: Hongling Zeng <[email protected]>
Date:   Wed Jul 1 12:57:33 2026 +0800

    dmaengine: sun6i-dma: Fix reclaim descriptors while terminating DMA
    
    [ Upstream commit ab1150115e68a46b687eb38c1ab92782018c9f2c ]
    
    When terminating DMA transfers, active descriptors are not properly
    reclaimed. Only cyclic descriptors were handled, leaving non-cyclic
    descriptors and their LLI chains to be permanently leaked.
    
    Fix by using vchan_terminate_vdesc() which handles both cyclic and
    non-cyclic descriptors by adding them to desc_terminated queue for
    proper cleanup.
    
    Add pchan->desc != pchan->done check to prevent double-adding completed
    descriptors, which would corrupt the list.
    
    Fixes: 555859308723 ("dmaengine: sun6i: Add driver for the Allwinner A31 DMA controller")
    Signed-off-by: Hongling Zeng <[email protected]>
    Acked-by: Jernej Skrabec <[email protected]>
    Suggested-by: Frank Li <[email protected]>
    Reviewed-by: Frank Li <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Vinod Koul <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
Drivers: hv: Allocate the paravisor SynIC pages when required [+ + +]
Author: Roman Kisel <[email protected]>
Date:   Wed Oct 8 16:34:09 2025 -0700

    Drivers: hv: Allocate the paravisor SynIC pages when required
    
    [ Upstream commit 226494e5ee4eb0bae4fc7b525505828271d5047e ]
    
    Confidential VMBus requires interacting with two SynICs -- one
    provided by the host hypervisor, and one provided by the paravisor.
    Each SynIC requires its own message and event pages.
    
    Refactor and extend the existing code to add allocating and freeing
    the message and event pages for the paravisor SynIC when it is
    present.
    
    Signed-off-by: Roman Kisel <[email protected]>
    Reviewed-by: Tianyu Lan <[email protected]>
    Reviewed-by: Michael Kelley <[email protected]>
    Signed-off-by: Wei Liu <[email protected]>
    Stable-dep-of: 8c7ab779c885 ("Drivers: hv: vmbus: Replace lockdep_hardirq_threaded() with lockdep annotation")
    Signed-off-by: Sasha Levin <[email protected]>

Drivers: hv: Rename fields for SynIC message and event pages [+ + +]
Author: Roman Kisel <[email protected]>
Date:   Wed Oct 8 16:34:08 2025 -0700

    Drivers: hv: Rename fields for SynIC message and event pages
    
    [ Upstream commit 163224c189e8b679ce919aa64ccabb7a992ca2d1 ]
    
    Confidential VMBus requires interacting with two SynICs -- one
    provided by the host hypervisor, and one provided by the paravisor.
    Each SynIC requires its own message and event pages.
    
    Rename the existing host-accessible SynIC message and event pages
    with the "hyp_" prefix to clearly distinguish them from the paravisor
    ones. The field name is also changed in mshv_root.* for consistency.
    
    No functional changes.
    
    Signed-off-by: Roman Kisel <[email protected]>
    Reviewed-by: Tianyu Lan <[email protected]>
    Reviewed-by: Michael Kelley <[email protected]>
    Signed-off-by: Wei Liu <[email protected]>
    Stable-dep-of: 8c7ab779c885 ("Drivers: hv: vmbus: Replace lockdep_hardirq_threaded() with lockdep annotation")
    Signed-off-by: Sasha Levin <[email protected]>

Drivers: hv: vmbus: Replace lockdep_hardirq_threaded() with lockdep annotation [+ + +]
Author: Sebastian Andrzej Siewior <[email protected]>
Date:   Tue Jul 21 17:32:15 2026 +0200

    Drivers: hv: vmbus: Replace lockdep_hardirq_threaded() with lockdep annotation
    
    [ Upstream commit 8c7ab779c8850f4dab8473463cca9a7d52fdaecc ]
    
    lockdep_hardirq_threaded() is supposed to be used within IRQ core code
    and not within drivers. It is not obvious from within the driver, that
    this is the only interrupt service routing and that it is not shared
    handler.
    
    Replace lockdep_hardirq_threaded() with a lockdep annotation limiting
    threaded context on PREEMPT_RT to __vmbus_isr().
    
    Fixes: f8e6343b7a89c ("Drivers: hv: vmbus: Use kthread for vmbus interrupts on PREEMPT_RT")
    Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
    Reviewed-by: Michael Kelley <[email protected]>
    Signed-off-by: Wei Liu <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/amd/display: check GRPH_FLIP status before sending event [+ + +]
Author: Leo Li <[email protected]>
Date:   Wed Jul 29 13:57:48 2026 -0400

    drm/amd/display: check GRPH_FLIP status before sending event
    
    [ Upstream commit 48ab86360af117123eb1b15e38f068acf3826400 ]
    
    [Why]
    
    After unifying DCN interrupt sources under VUPDATE_NO_LOCK, we have two
    remaining issues to clean up:
    
    1. On DCN, flip completion is now delivered from VUPDATE_NO_LOCK
       (dm_crtc_high_irq_handler) instead of GRPH_PFLIP. But VUPDATE_NO_LOCK
       fires every frame, regardless of whether a flip has latched.
    
    2. There is a window during commit where a flip is armed (pflip_status =
       SUBMITTED) but not yet programmed into HW. If the VUPDATE_NO_LOCK
       fires in that window, its handler would deliver a flip event to
       userspace before HW has latched to it. If userspace then renders to
       what it believes is now the back buffer (but HW is still latched to
       it!), it will cause display corruption. This issue seemed to have
       been introduced by:
       commit 1159898a88db ("drm/amd/display: Handle commit plane with no FB.")
       Enabling replay or psr extended the duration of this window, and
       hence made corruption more likely to be observed.
    
    [How]
    
    * Move acrtc->event/pflip_status arming to after
      update_planes_and_stream_adapter() has programmed the flip into HW.
      This closes the window where pflip_status is SUBMITTED but the flip is
      not yet programmed.
    
    * Add dc_get_flip_pending_on_otg(), which reads the HUBP flip-pending
      status straight from HW for the pipe(s) bound to an OTG instance. It
      is keyed only by otg_inst and does not take or mutate a
      dc_plane_state, so it is safe to call from the OTG interrupt handler
      without racing a concurrent commit that may be modifying plane state.
    
    * Optimistically query for flip-pending after programming, in the event
      that HW latched to the new fb between programming start and arming
      event. If it latched, send the vblank event immediately, rather than
      wait for the next vblank IRQ.
    
    * In the VUPDATE_NO_LOCK handler, only deliver flip completion once
      dc_get_flip_pending_on_otg() reports the flip is no longer pending.
      Otherwise leave the flip armed and retry on the next vupdate.
    
    * For DCE, maintain the existing behavior of arming flips before
      programming, and relying on GRPH_FLIP to fire at HW latch.
    
    v2:
    * Drop flip_programmed completion object, instead move
      event/pflip_status arming after programming.
    * For DCN, optimistically query for flip pending immediately after
      programming, and if it latched, send event right away.
    
    v3:
    * Fix event timestamps on optimistic flip latch detection, where it's
      possible for it to run *before* the vupdate IRQ updates the timestamp.
    * Add more docstrings for DCN vblank handling.
    * Clean up if conditions in dm_arm_vblank_event().
    * Code style cleanup on braces surrounding multi-line statements.
    
    Fixes: 9b47278cec98 ("drm/amd/display: temp w/a for dGPU to enter idle optimizations")
    Link: https://gitlab.freedesktop.org/drm/amd/-/work_items/3787
    Link: https://gitlab.freedesktop.org/drm/amd/-/work_items/4141
    Assisted-by: Copilot:claude-opus-4.8
    Tested-by: Mario Limonciello (AMD) <[email protected]>
    Reviewed-by: Mario Limonciello (AMD) <[email protected]>
    Signed-off-by: Leo Li <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    (cherry picked from commit f64a9be5653689ff43e148cd8a6483077488c8e5)
    Cc: [email protected] # 8382cd234981: drm/amd/display: consolidate DCN vblank/flip handling onto vupdate_no_lock
    Cc: [email protected]
    Signed-off-by: Sasha Levin <[email protected]>

drm/amd/display: Exit idle optimizations before programming [+ + +]
Author: Leo Li <[email protected]>
Date:   Wed Aug 5 12:33:14 2026 -0400

    drm/amd/display: Exit idle optimizations before programming
    
    [ Upstream commit 8419331e64d92a8de5fc4feef0e305f201fb8b33 ]
    
    [Why]
    
    We need to exit PSR/IPS before programming. Before calling DC for
    programming in amdgpu_dm_commit_planes(), there's a
    vblank_control_workqueue flush. This waits for IPS and PSR exit. (See
    drm_vblank_on/off() > amdgpu_dm_crtc_set_vblank() --queue_work()->
    amdgpu_dm_crtc_vblank_control_worker())
    
    Prior to the tagged "Fixes:" change, drm_vblank_get() was called before
    the workqueue flush. This ordering ensures that PSR exit occurred before
    programming. After the "Fixes:" change, drm_vblank_get() is called after
    the workqueue flush, leading to programming while idle optimizations are
    still active. This can lead to incorrect flip_pending detection used by
    vblank event delivery.
    
    [How]
    
    Split the vblank_get() component of `dm_arm_vblank_event()` into
    `dm_arm_vblank_event_pre_programming()`, which is called before
    programming. Call it before the vblank_control_workqueue flush.
    
    Includes a drive-by cleanup of prepare_flip_isr(): the only caller is
    dm_arm_vblank_event() and it's simple enough to roll-in.
    
    v2: Fix checkpatch formatting warning on
        drm_arm_vblank_event_pre_programming() arg alignment.
    
    Fixes: 48ab86360af1 ("drm/amd/display: check GRPH_FLIP status before sending event")
    Cc: [email protected]
    Link: https://gitlab.freedesktop.org/drm/amd/-/work_items/4141#note_3583205
    Link: https://gitlab.freedesktop.org/drm/amd/-/work_items/5527
    Assisted-by: Codex:gpt-5.6-sol
    Assisted-by: Claude:opus-5
    Suggested-by: David Weber <[email protected]>
    Signed-off-by: Leo Li <[email protected]>
    Reviewed-by: Mario Limonciello (AMD) <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    (cherry picked from commit 05984e29520a28c27f5a2388742c957a6a87ee7a)
    (cherry picked from commit 8419331e64d92a8de5fc4feef0e305f201fb8b33)
    Signed-off-by: Sasha Levin <[email protected]>

drm/amd/display: Increase HDMI AV mute wait from 2 to 3 frames [+ + +]
Author: Ray Wu <[email protected]>
Date:   Fri Jul 3 09:14:49 2026 +0800

    drm/amd/display: Increase HDMI AV mute wait from 2 to 3 frames
    
    commit c216b39fbbc4b007fd6984cffd85039d49a55154 upstream.
    
    Some HDMI sinks need additional GCP packets to properly process the
    mute state before the timing generator is disabled, especially after
    link re-establishment with HDMI 2.0 scrambling enabled. Waiting for
    only 2 frames is insufficient for certain monitor firmware, resulting
    in garbled display output on resume from suspend.
    
    Increase the AV mute wait in dcn30_set_avmute() from 2 to 3 frames
    to ensure the sink receives enough GCP packets.
    
    Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/5167
    Assisted-by: Cursor:Claude-Opus-4.6
    Reviewed-by: Wayne Lin <[email protected]>
    Signed-off-by: Ray Wu <[email protected]>
    Tested-by: Dan Wheeler <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    (cherry picked from commit 0c0d5174b09640d8b560764aa5a177630e076e93)
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/amd/display: use proper context for logging [+ + +]
Author: Jiri Slaby (SUSE) <[email protected]>
Date:   Thu Jul 23 06:25:48 2026 +0200

    drm/amd/display: use proper context for logging
    
    commit 114b42507b6a23d9d24e24e4ef165233332c64d4 upstream.
    
    The same as the rest of the code, get_ss_info_from_atombios() uses
    calc_pll_cs->ctx->logger for logging. But calc_pll_cs->ctx is
    initialized only later in calc_pll_max_vco_construct(). Therefore, any
    output using DC_LOG_SYNC() leads to a NULL pointer deference in
    get_ss_info_from_atombios().
    
    According to Sashiko, the very same problem exists in
    dce112_get_pix_clk_dividers() and dcn3_get_pix_clk_dividers() too.
    
    To avoid accessing the NULL context, use clk_src->base.ctx->logger
    everywhere. That context in base is initialized earlier in
    dce110_clk_src_construct() and dce112_clk_src_construct(). Before
    get_ss_info_from_atombios() or Sashiko's get_pix_clk_dividers functions
    above are actually called. This is done by redefining DC_LOGGER to
    CTX->logger.
    
    Before:
    dce110_clk_src_construct() did:
     -> sets clk_src->base.ctx = ctx;
     -> ss_info_from_atombios_create()
       -> get_ss_info_from_atombios()   <- uses calc_pll_cs->ctx  # BOOM
     -> calc_pll_max_vco_construct()    <- sets calc_pll_cs->ctx
    
    After:
    dce110_clk_src_construct() does:
     -> sets clk_src->base.ctx = ctx;
     -> ss_info_from_atombios_create()
       -> get_ss_info_from_atombios()   <- uses clk_src->base.ctx
    
    Closes: https://bugzilla.suse.com/show_bug.cgi?id=1271175
    Closes: https://lore.kernel.org/all/[email protected]/
    Fixes: 1296423bf23c ("drm/amd/display: define DC_LOGGER for logger")
    Reviewed-by: Bhawanpreet Lakha <[email protected]>
    Signed-off-by: Jiri Slaby (SUSE) <[email protected]>
    Cc: Lakha, Bhawanpreet <[email protected]>
    Cc: Harry Wentland <[email protected]>
    Cc: Leo Li <[email protected]>
    Cc: Rodrigo Siqueira <[email protected]>
    Cc: Alex Deucher <[email protected]>
    Cc: "Christian König" <[email protected]>
    Cc: David Airlie <[email protected]>
    Cc: Simona Vetter <[email protected]>
    Cc: [email protected]
    Signed-off-by: Alex Deucher <[email protected]>
    (cherry picked from commit 6f16fcbb0c46a87e3d9685407e906573d60104b0)
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/amd/pm: fix torn gpu metrics reads [+ + +]
Author: Yang Wang <[email protected]>
Date:   Thu Jul 23 23:18:33 2026 +0800

    drm/amd/pm: fix torn gpu metrics reads
    
    commit 048f4541b71fb19645fb79d6e62e6e4da23a4035 upstream.
    
    amdgpu_dpm_get_gpu_metrics() returns a pointer to the shared metrics cache
    after dropping adev->pm.mutex. The sysfs path then copies from that pointer.
    Another reader can refresh the cache in place during the copy and return a
    snapshot containing data from two generations.
    
    Pass caller-provided storage through the DPM interface and copy the metrics
    while the mutex is held. This keeps the cache pointer private and makes each
    sysfs read observe one complete sample.
    
    Fixes: 25c933b1c4fc ("drm/amd/powerplay: add new sysfs interface for retrieving gpu metrics(V2)")
    Signed-off-by: Yang Wang <[email protected]>
    Reviewed-by: Kenneth Feng <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    (cherry picked from commit 862333bb48693ecafcae25af0c9d9ec31015ac77)
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/amdgpu: cap GTT size to physical RAM on APUs [+ + +]
Author: Harkirat Gill <[email protected]>
Date:   Mon Jul 27 14:37:56 2026 -0400

    drm/amdgpu: cap GTT size to physical RAM on APUs
    
    commit 5e70f6804b4d6256058c360b10e044ee04ea4a4e upstream.
    
    On APUs, the GTT pool is backed by system RAM, but its size is not bound
    to the non-carveout memory that actually backs it. A user can end up
    with GTT + VRAM exceeding total physical memory through the following
    sequence:
    
     - Have a large non-carveout memory space (~128GB) and accordingly set a
       large GTT (~100GB) via the ttm module parameter.
     - Lower the non-carveout memory space in BIOS by increasing the UMA
       Frame Buffer Size (VRAM) to 64GB.
     - The previously set GTT value (~100GB) persists, even though the new
       non-carveout space (64GB) can no longer back it.
    
    This leads to a case where kernel reports GTT (100GB) + VRAM (64GB)
    despite the sum being greater than total physical memory (128GB).
    
    Cap the GTT size to totalram_pages() on APUs. totalram_pages() already
    excludes the VRAM carveout, so the resulting GTT can never exceed the
    system RAM that actually backs it.
    
    Signed-off-by: Harkirat Gill <[email protected]>
    Reviewed-by: David Francis <[email protected]>
    Assisted-by: Claude:claude-opus-4
    Signed-off-by: Alex Deucher <[email protected]>
    (cherry picked from commit 5dafdd649280c7dc6c22c8f877da3f54fcc441e1)
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/amdgpu: Fix context pstate override handling [+ + +]
Author: Tvrtko Ursulin <[email protected]>
Date:   Fri Jul 31 12:00:49 2026 -0400

    drm/amdgpu: Fix context pstate override handling
    
    [ Upstream commit c1dc4ccb82c9e56325d8e7514ca4c90bd1efb351 ]
    
    There are several problems in the context pstate handling code.
    
    The most serious ones are potential use-after-free and NULL pointer
    dereferences at context initialization time. Both are due
    amdgpu_ctx_init() not holding the adev->pm.stable_pstate_ctx_lock, which
    is otherwise used from both sysfs and the context code itself for
    modifying and clearing the stored context pointer.
    
    Second issue is that context fini can trample over the pstate
    configuration set via sysfs. This is due the restore state
    (ctx->stable_pstate) being saved at context init time, and not if, or when
    the context actually changes the pstate. As the context exits it will
    therefore incorrectly restore to what was set before the sysfs override
    was requested.
    
    The simplest fix is to drastically simplify how the state is tracked, by
    clearly defining the points at which pstate ownership is taken and
    released, and to handle all transitions under the correct lock.
    
    Instead of at context init time, the previous state is saved only at the
    point the context overrides the current state, and is restored on context
    exit only if the context is still the owner of the current override state.
    
    Signed-off-by: Tvrtko Ursulin <[email protected]>
    Fixes: 79610d304133 ("drm/amdgpu: fix pstate setting issue")
    Cc: Chengming Gui <[email protected]>
    Cc: Alex Deucher <[email protected]>
    Cc: "Christian König" <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    (cherry picked from commit 1b5e413713c0a93bc1818394d0ce49aaad21bd27)
    Cc: <[email protected]> # v6.1+
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/amdgpu: move debug_vm handling to amdgpu_cs_parser_fini [+ + +]
Author: Pierre-Eric Pelloux-Prayer <[email protected]>
Date:   Mon Jun 22 10:11:22 2026 +0200

    drm/amdgpu: move debug_vm handling to amdgpu_cs_parser_fini
    
    commit d8726ef11512754a68c0ab53c57634a569b8feff upstream.
    
    The commit referenced below restarts the CS if the validation is
    still in progress. When debug_vm is enabled, all BOs from the CS
    are invalidated so we will hit an infinite loop.
    
    To avoid that, defer BO invalidation to amdgpu_cs_parser_fini.
    
    Fixes: 59720bfd8c6d ("drm/amdgpu: restart the CS if some parts of the VM are still invalidated")
    Signed-off-by: Pierre-Eric Pelloux-Prayer <[email protected]>
    Reviewed-by: Christian König <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    (cherry picked from commit 8c990ee9daa295462df24982ce6878db997a380a)
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/amdgpu: Respect placement requirements in amdgpu_gtt_mgr functions [+ + +]
Author: Timur Kristóf <[email protected]>
Date:   Fri Jul 31 12:25:27 2026 -0400

    drm/amdgpu: Respect placement requirements in amdgpu_gtt_mgr functions
    
    [ Upstream commit 8882f8897e554053af9e72f4c2da8b1e2cce56c7 ]
    
    When testing intersection and compatibility, respect
    the actual placement requirements. This is a pre-requisite
    for ensuring that UVD CS BOs do not cross 256M segments.
    
    Fixes: ded910f368a5 ("drm/amdgpu: Implement intersect/compatible functions")
    Suggested-by: Christian König <[email protected]>
    Signed-off-by: Timur Kristóf <[email protected]>
    Reviewed-by: Christian König <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    (cherry picked from commit bc06579ca29dee9c245a41b12e39c7bb6938af5d)
    Cc: [email protected]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/amdgpu: restore UMD profile pstate after runtime resume [+ + +]
Author: Candice Li <[email protected]>
Date:   Tue Jul 21 21:38:58 2026 +0800

    drm/amdgpu: restore UMD profile pstate after runtime resume
    
    commit f931c54b241ce2f36bfc34955aec43a188276b8d upstream.
    
    Runtime suspend runs GFX hw_fini and clears perfmon clock gating while
    the UMD profile DPM level remains set in software.  Re-apply stable
    pstate after a successful runtime resume when a profile mode is active.
    
    Signed-off-by: Candice Li <[email protected]>
    Reviewed-by: Hawking Zhang <[email protected]>
    Reviewed-by: Yang Wang <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    (cherry picked from commit 138531c8850cc247aa12b104bb29ea387bcdcbb1)
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/amdkfd: Fix missing authorization check in KFD_IOC_DBG_TRAP_DISABLE [+ + +]
Author: Gang Ba <[email protected]>
Date:   Tue Jul 14 15:08:57 2026 -0400

    drm/amdkfd: Fix missing authorization check in KFD_IOC_DBG_TRAP_DISABLE
    
    commit 99b2fe4f19e3be0a8d0a0b5ea98d855970889653 upstream.
    
    Prevent unauthorized termination of active GPU debug sessions.
    Previously, users with /dev/kfd access could terminate another process's
    debug session without proper ownership or ptrace authorization.
    
    Signed-off-by: Gang Ba <[email protected]>
    Reviewed-by: Kent Russell <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    (cherry picked from commit 4db4c5ffd5585b72622ecf6ffedf2da258ee23f5)
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/amdkfd: fix QID bit leak in pqm_create_queue() [+ + +]
Author: Vladimir Marioukhine <[email protected]>
Date:   Mon Jul 20 11:53:30 2026 -0400

    drm/amdkfd: fix QID bit leak in pqm_create_queue()
    
    commit 38b73293f38658a4685ffcea666462024f858ad9 upstream.
    
    When MES is enabled and amdgpu_amdkfd_alloc_kernel_mem() fails during
    the first queue creation for a process, pqm_create_queue() returns
    early via 'return retval' without going through the err_create_queue
    cleanup label.
    
    This means clear_bit(*qid, pqm->queue_slot_bitmap) is never called,
    leaving the reserved QID bit permanently set in queue_slot_bitmap.
    Over time this leaks QID slots, potentially exhausting all available
    queue slots.
    
    Fix this by replacing 'return retval' with 'goto err_allocate_pqn'
    so that clear_bit() is always called on the error path without
    touching the uninitialized pqn pointer.
    
    AILIKFD-813
    
    Reported-by: Deucher, Alexander <[email protected]>
    Signed-off-by: Vladimir Marioukhine <[email protected]>
    Reviewed-by: Kent Russell <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    (cherry picked from commit a107f74c38edbb80d6ab64dcaeeb292c14e9779f)
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/amdkfd: fix uint32_t overflow in EOP ring buffer size alignment [+ + +]
Author: William Palacek <[email protected]>
Date:   Mon Jul 20 12:51:34 2026 -0400

    drm/amdkfd: fix uint32_t overflow in EOP ring buffer size alignment
    
    commit 83463a96ea3c7d8ae636a4d6a0ba63c9ce410724 upstream.
    
    eop_ring_buffer_size in struct queue_properties is a u32. In
    kfd_queue_acquire_buffers() the expected EOP buffer size is computed as
    ALIGN(eop_ring_buffer_size, PAGE_SIZE); ALIGN uses typeof(x), so the
    addition is done in 32-bit. A user-supplied size of 0xFFFFF001 wraps to
    0, causing kfd_queue_buffer_get() to skip its exact-size check (gated on
    size != 0) and accept any BO mapped at the address. On GFX8/GFX9 the MQD
    cp_hqd_eop_control is then programmed for an 8KB EOP ring backed by a 4KB
    BO, so CP EOP writes can land past the buffer and fault the GPU.
    
    Cast the operand to u64 so the alignment is computed in 64-bit; the size
    check in kfd_queue_buffer_get() then rejects the oversized request.
    
    Fixes: 42ea9cf2f16b ("drm/amdkfd: Relax size checking during queue buffer get")
    Signed-off-by: William Palacek <[email protected]>
    Reviewed-by: Alysa Liu <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    (cherry picked from commit ae443117b742c357bfef3a7bddabf76fcf86e9ef)
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/amdkfd: Handle invalid event type in CRIU event restore [+ + +]
Author: David Francis <[email protected]>
Date:   Tue Jul 21 09:30:07 2026 -0400

    drm/amdkfd: Handle invalid event type in CRIU event restore
    
    commit a9cdc85839e4fe2c760aa4ca6cc341c31ad1918a upstream.
    
    In kfd_criu_restore_event, there was no handling for
    the event priv data having an invalid event type. The priv
    data here is untrusted and can be invalid.
    
    In that case, fail with EINVAL.
    
    Signed-off-by: David Francis <[email protected]>
    Reviewed-by: Kent Russell <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    (cherry picked from commit 2e8e9963cd5c41aa14fd5316bf9ec92e7a0e3097)
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/amdkfd: hold event_mutex while checkpointing CRIU events [+ + +]
Author: William Palacek <[email protected]>
Date:   Wed Jul 22 11:20:56 2026 -0400

    drm/amdkfd: hold event_mutex while checkpointing CRIU events
    
    commit ff8bc5a68a9a70bdc38d61a72c7a49c56063f9d2 upstream.
    
    kfd_criu_checkpoint_events() counts the entries in p->event_idr via
    kfd_get_num_events(), allocates an array sized to that count, and then
    walks the same IDR to fill it. Neither the count nor the walk holds
    p->event_mutex.
    
    The CRIU checkpoint caller holds only p->mutex. Event create and destroy
    (kfd_event_create()/kfd_event_destroy()) take p->event_mutex and do not
    take p->mutex, so a second thread in the same process can insert or remove
    events between the count and the walk. If an event is inserted, the walk
    iterates more entries than were counted and writes past the end of the
    ev_privs allocation; if an event is removed, the walk dereferences an
    entry that is being freed.
    
    Hold p->event_mutex across the count and the walk so both observe a
    consistent view of p->event_idr. The lock is released before
    copy_to_user(), which only touches the local buffer. The caller already
    holds p->mutex and the create/destroy paths never take p->mutex, so the
    p->mutex -> p->event_mutex order is not inverted and no deadlock is
    introduced.
    
    Fixes: 40e8a766a761 ("drm/amdkfd: CRIU checkpoint and restore events")
    Signed-off-by: William Palacek <[email protected]>
    Reviewed-by: Alysa Liu <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    (cherry picked from commit ff57e223ab105795b05d3ef3f3c35a5a441bcbaa)
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/bridge: display-connector: Fix I2C adapter resource leak [+ + +]
Author: Laurent Pinchart <[email protected]>
Date:   Fri Jul 17 21:48:36 2026 +0300

    drm/bridge: display-connector: Fix I2C adapter resource leak
    
    commit 6a39ca1286dd97ad02bb8e03bbb65ee05368d778 upstream.
    
    If the probe function returns an error after getting the I2C adapter for
    DDC, the reference to the adapter is never released. Fix it by releasing
    it in the bridge .destroy() handler.
    
    There is no need to test the ddc pointer with !IS_ERR(), as
    of_get_i2c_adapter_by_node() returns NULL on error.
    
    Fixes: 2e2bf3a5584d ("drm/bridge: display-connector: add DP support")
    Cc: [email protected]
    Signed-off-by: Laurent Pinchart <[email protected]>
    Reviewed-by: Johan Hovold <[email protected]>
    Reviewed-by: Luca Ceresoli <[email protected]>
    Link: https://patch.msgid.link/20260717184836.2017386-1-laurent.pinchart+renesas@ideasonboard.com
    Signed-off-by: Luca Ceresoli <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/dp: Read the PCON max FRL bandwidth only for HDMI DFPs [+ + +]
Author: Alexander Kaplan <[email protected]>
Date:   Wed Jun 10 21:38:25 2026 +0200

    drm/dp: Read the PCON max FRL bandwidth only for HDMI DFPs
    
    commit e40e20ac089e32f1d910636155dc82e61e61dcf3 upstream.
    
    The PCON max FRL bandwidth field lives in byte 2 of the DFP Detailed
    Capability Info (DPCD 0x82 for the first DFP).
    The DP standard defines the meaning of descriptor bytes 1-3 strictly
    per DFP type, and for a DisplayPort type DFP all of them are
    reserved, with "read all 0s" semantics (DP v2.0, section 2.12.3,
    Table 2-183).
    The FRL bandwidth field is an HDMI DFP extension added by the VESA
    DP-to-HDMI PCON specification.
    drm_dp_get_pcon_max_frl_bw() however parses the byte without checking
    the DFP type, the branch presence or DETAILED_CAP_INFO_AVAILABLE.
    Without the latter the port descriptors are one byte wide and
    port_cap[2] is not even the right register.
    
    All neighbouring helpers parsing the same descriptor are scoped by
    the DFP type already, see for instance drm_dp_downstream_max_bpc()
    reading the same byte and returning 0 for a DP type DFP.
    amdgpu's DC parses the field only for HDMI(/DP++) detailed types as
    well.
    
    This is not theoretical.
    A Synaptics VMM7100 based USB-C to HDMI adapter with a macOS targeted
    firmware advertises a DisplayPort type DFP with the type byte
    replicated across the whole descriptor (08 08 08 08).
    i915 decodes that as "PCON limited to 18 Gbps FRL" and prunes every
    mode above ~750 MHz dotclock, including all the 4k@100/120 modes the
    sink EDID offers, while macOS drives 4k@120 through the same adapter
    just fine via DP DSC (and amdgpu's type-scoped parser would ignore
    the bogus field as well).
    
    Only parse the field for an HDMI DFP behind a DPCD 1.1+ branch
    device that reports detailed cap info, matching the type-scoped
    field layout of the spec and the rest of the helpers.
    
    Fixes: ce32a6239de6 ("drm/dp_helper: Add Helpers for FRL Link Training support for DP-HDMI2.1 PCON")
    Cc: Ankit Nautiyal <[email protected]>
    Cc: Uma Shankar <[email protected]> (v2)
    Cc: Jani Nikula <[email protected]>
    Cc: Maarten Lankhorst <[email protected]>
    Cc: [email protected]
    Cc: <[email protected]> # v5.12+
    Signed-off-by: Alexander Kaplan <[email protected]>
    Reviewed-by: Ankit Nautiyal <[email protected]>
    Signed-off-by: Ankit Nautiyal <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/exec: Remove the index parameter from drm_exec_for_each_locked_obj[_reverse] [+ + +]
Author: Thomas Hellström <[email protected]>
Date:   Sat Aug 1 12:59:12 2026 -0400

    drm/exec: Remove the index parameter from drm_exec_for_each_locked_obj[_reverse]
    
    [ Upstream commit ce44b78512e9102aea54ff6b6e521d6c8de9f31c ]
    
    Nobody makes any use of it. Possible internal future users can
    instead use the _index variable. External users shouldn't use
    it since the array it's pointing into is internal drm_exec state.
    
    v2:
    - Use a unique id for the loop variable (Christian)
    
    Assisted-by: GitHub Copilot:claude-sonnet-4.6
    Signed-off-by: Thomas Hellström <[email protected]>
    Reviewed-by: Christian König <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Stable-dep-of: af80e2bfde93 ("drm/xe: Wait on external BO kernel fences in exec IOCTL")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/fb-helper: Allocate and release fb_info in single place [+ + +]
Author: Thomas Zimmermann <[email protected]>
Date:   Thu Jul 30 22:41:00 2026 -0400

    drm/fb-helper: Allocate and release fb_info in single place
    
    [ Upstream commit 63c971af40365ee706c7e24f6a7900d693518f09 ]
    
    Move the calls to drm_fb_helper_alloc_info() from drivers into a
    single place in fbdev helpers. Allocates struct fb_info for a new
    framebuffer device. Then call drm_fb_helper_single_fb_probe() to
    create an fbdev screen buffer. Also release the instance on errors
    by calling drm_fb_helper_release_info().
    
    Simplifies the code and fixes the error cleanup for some of the
    drivers.
    
    Regular release of the struct fb_info instance still happens in
    drm_fb_helper_fini() as before.
    
    v2:
    - remove error rollback in driver implementations (kernel test robot)
    - initialize info in TTM implementation (kernel test robot)
    
    Signed-off-by: Thomas Zimmermann <[email protected]>
    Acked-by: Christian König <[email protected]> # radeon
    Acked-by: Dmitry Baryshkov <[email protected]> # msm
    Acked-by: Javier Martinez Canillas <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Stable-dep-of: a18b6e30ecd6 ("drm/tegra: fbdev: Remove offset into framebuffer memory")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/fb-helper: Fix a locking bug in an error path [+ + +]
Author: Bart Van Assche <[email protected]>
Date:   Fri Apr 3 13:53:54 2026 -0700

    drm/fb-helper: Fix a locking bug in an error path
    
    commit bd64240dc88caaf7b96dd869f36f165f51b52039 upstream.
    
    The name of the function __drm_fb_helper_initial_config_and_unlock() and
    also the comment above that function make it clear that all code paths
    in this function should unlock fb_helper->lock before returning. Add a
    mutex_unlock() call in the only code path where it is missing. This has
    been detected by the Clang thread-safety analyzer.
    
    Cc: Thomas Zimmermann <[email protected]>
    Cc: Christian König <[email protected]> # radeon
    Cc: Dmitry Baryshkov <[email protected]> # msm
    Cc: Javier Martinez Canillas <[email protected]>
    Fixes: 63c971af4036 ("drm/fb-helper: Allocate and release fb_info in single place")
    Signed-off-by: Bart Van Assche <[email protected]>
    Signed-off-by: Thomas Zimmermann <[email protected]>
    Reviewed-by: Thomas Zimmermann <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/gpusvm: publish dpagemap early to avoid device mapping leak on error [+ + +]
Author: Honglei Huang <[email protected]>
Date:   Fri Jul 31 19:17:28 2026 +0800

    drm/gpusvm: publish dpagemap early to avoid device mapping leak on error
    
    commit 7f708f51e3955bda0d77a0b67ab9bea6c97fea99 upstream.
    
    drm_gpusvm_get_pages() only stored the local dpagemap into
    svm_pages->dpagemap on the success path. If a later page failed (e.g.
    -EOPNOTSUPP when ctx->allow_mixed is false) and jumped to err_unmap,
    svm_pages->dpagemap was still NULL, so __drm_gpusvm_unmap_pages() skipped
    device_unmap() and leaked the device mappings already created.
    
    Assign svm_pages->dpagemap when the first device page is mapped so the
    err_unmap path can device_unmap() those mappings.
    
    This issue was found by Sashiko AI review.
    
    Fixes: f70da6f99d4f ("drm/gpusvm: pull out drm_gpusvm_pages substructure")
    Cc: [email protected]
    Reviewed-by: Matthew Brost <[email protected]>
    Signed-off-by: Honglei Huang <[email protected]>
    Signed-off-by: Matthew Brost <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    [ Adjusted for 6.18.y: drop drm_pagemap_get()/drm_pagemap_put() around the
      svm_pages->dpagemap assignment; that reference counting is not present in
      6.18 where the field is not refcounted (unmap path only clears it). ]
    Signed-off-by: Honglei Huang <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/i915/dp: Ignore the sink's DSC max FRL rate without a PCON DSC encoder [+ + +]
Author: Alexander Kaplan <[email protected]>
Date:   Sat Jul 18 12:52:07 2026 +0200

    drm/i915/dp: Ignore the sink's DSC max FRL rate without a PCON DSC encoder
    
    [ Upstream commit 8891e39e89042e285fd82fdde325d1311ec750a1 ]
    
    intel_dp_hdmi_sink_max_frl() limits the sink's max FRL rate by its
    DSC max FRL rate whenever the sink supports DSC 1.2.
    However, the DSC max FRL rate (HF-VSDB DSC_Max_FRL_Rate) only applies
    to compressed video transport, which requires a DSC 1.2 encoder in
    the PCON (configured via intel_dp_pcon_dsc_configure()).
    Without such an encoder the HDMI link always carries uncompressed
    video, for which the regular Max_FRL_Rate is the correct limit.
    
    Applying the DSC limit unconditionally trains the FRL link at a lower
    rate than both the PCON and the sink support.
    E.g. an LG OLED G4 (Max_FRL_Rate 48 Gbps, DSC_Max_FRL_Rate 24 Gbps)
    behind a Synaptics VMM7100 PCON (PCON max FRL bw 48 Gbps, no DSC
    encoder):
    
      Sink max rate from EDID = 24 Gbps
      FRL trained with : 24 Gbps
    
    while Windows/macOS train the same hardware at 40/48 Gbps.
    The too low FRL rate needlessly constrains the formats available to
    the sink.
    
    Only apply the sink's DSC max FRL rate if the PCON has a DSC 1.2
    encoder, matching the gate in intel_dp_pcon_dsc_configure().
    PCONs with a DSC encoder keep the current conservative behavior,
    since the link is trained once and compressed transport may be used
    for any subsequent mode.
    With this the setup above trains at 48 Gbps.
    
    Tested on PTL (xe) with the above PCON/sink combo.
    
    Fixes: 10fec80b48c5 ("drm/i915/display: Configure PCON for DSC1.1 to DSC1.2 encoding")
    Cc: Ankit Nautiyal <[email protected]>
    Cc: Ville Syrjälä <[email protected]>
    Reviewed-by: Ankit Nautiyal <[email protected]>
    Signed-off-by: Alexander Kaplan <[email protected]>
    Signed-off-by: Ankit Nautiyal <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    (cherry picked from commit 71b57dd92f94569dca4bdf883fbd8ca5d4ed4bae)
    Signed-off-by: Rodrigo Vivi <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/i915/hdmi: Poll for 200 msec for TMDS_Scrambler_Status [+ + +]
Author: Jerome Tollet <[email protected]>
Date:   Wed May 20 07:55:44 2026 +0530

    drm/i915/hdmi: Poll for 200 msec for TMDS_Scrambler_Status
    
    [ Upstream commit 1afb8eaeec44fd011f2b93ccd9fd426d753d963b ]
    
    HDMI 2.0 section 6.1.3.1 specifies that after enabling
    Scrambling_Enable and starting scrambled video transmission, the source
    should poll Scrambling_Status until it reads 1 or until a timeout of
    200 ms expires.
    
    Add a polling step after enabling the HDMI port to check the scrambling
    status when HDMI scrambling is enabled.
    
    On some HDMI 2.0 sinks, omitting this check can result in 4K@60Hz
    (594 MHz) failing to come up correctly because the sink has not yet
    finished its scrambling setup. In practice, waiting for the scrambling
    status here fixes such sinks.
    
    While this synchronous polling is not itself explicitly required for
    correct modeset sequencing, HDMI 2.0 section 6.1.3.1 does recommend it
    as the way for the source to verify that the TMDS link is functioning
    correctly with scrambling enabled.
    
    v3:
     - Add explicit HDMI 2.0 section reference in code comment
     - Clarify commit message around the observed sink fix
    
    v2:
     - Poll TMDS_Scrambler_Status for up to 200 ms instead of using a fixed
       delay
    
    Reported-by: Jerome Tollet <[email protected]>
    Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/6868
    Link: https://lore.kernel.org/dri-devel/[email protected]/
    Signed-off-by: Jerome Tollet <[email protected]>
    Signed-off-by: Ankit Nautiyal <[email protected]>
    Reviewed-by: Arun R Murthy <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    (cherry picked from commit b7d51d65e4f12a48392d260613108ec262bc7774)
    Fixes: 15953637886d ("drm/i915: enable scrambling")
    Signed-off-by: Rodrigo Vivi <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/i915/vrr: Check HAS_VRR() first in intel_vrr_is_capable() [+ + +]
Author: Ville Syrjälä <[email protected]>
Date:   Sat Aug 1 20:07:03 2026 -0400

    drm/i915/vrr: Check HAS_VRR() first in intel_vrr_is_capable()
    
    [ Upstream commit 4b274b0b61ab2a529e5c22e9aa033f3028e639fc ]
    
    There's no point in doing all the other checks in
    intel_vrr_is_capable() if the platform doesn't support VRR at all
    Check HAS_VRR() before wasting time on the other checks.
    
    Signed-off-by: Ville Syrjälä <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Reviewed-by: Ankit Nautiyal <[email protected]>
    Stable-dep-of: f8a9262c7a6f ("drm/i915/vrr: require valid min/max vfreq for VRR")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/i915/vrr: require valid min/max vfreq for VRR [+ + +]
Author: Jani Nikula <[email protected]>
Date:   Sat Aug 1 20:07:04 2026 -0400

    drm/i915/vrr: require valid min/max vfreq for VRR
    
    [ Upstream commit f8a9262c7a6fc2de9802e14b0228114f0333869e ]
    
    Ensure the EDID provided min/max vfreq are valid. Most scenarios are
    already covered (by coincidence) through the checks in
    intel_vrr_is_capable() and intel_vrr_is_in_range(), but be more explicit
    about it. At worst, a zero min_vfreq could lead to a division by zero in
    intel_vrr_compute_vmax().
    
    Discovered using AI-assisted static analysis confirmed by Intel Product
    Security.
    
    Reported-by: Martin Hodo <[email protected]>
    Fixes: 117cd09ba528 ("drm/i915/display/dp: Compute VRR state in atomic_check")
    Cc: [email protected] # v5.12+
    Cc: Ankit Nautiyal <[email protected]>
    Reviewed-by: Ankit Nautiyal <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jani Nikula <[email protected]>
    (cherry picked from commit 1765cf59f517b02f3b0591fe5120930d08bddeb6)
    Signed-off-by: Joonas Lahtinen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/mediatek: Check CRTC state before freeing [+ + +]
Author: Ruoyu Wang <[email protected]>
Date:   Tue Jul 7 23:05:28 2026 +0800

    drm/mediatek: Check CRTC state before freeing
    
    [ Upstream commit 233a4d3a39fc1585f5e271b2adab43c6af025ae0 ]
    
    mtk_crtc_reset() destroys the current CRTC state only when crtc->state
    is non-NULL, but it always converts crtc->state to struct mtk_crtc_state
    and passes the result to kfree().
    
    When reset is called without an existing state, container_of(NULL, ...)
    does not produce NULL. Keep the mtk state free in the same crtc->state
    guard as the helper state destruction.
    
    This issue was found by a static analysis checker and confirmed by
    manual source review.
    
    Fixes: 2d267b81898e ("drm/mtk: Use __drm_atomic_helper_crtc_reset")
    Signed-off-by: Ruoyu Wang <[email protected]>
    Reviewed-by: CK Hu <[email protected]>
    Link: https://patchwork.kernel.org/project/linux-mediatek/patch/[email protected]/
    Signed-off-by: Chun-Kuang Hu <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

drm/mediatek: ovl_adaptor: balance component registrations [+ + +]
Author: Myeonghun Pak <[email protected]>
Date:   Wed Jul 22 00:22:42 2026 +0900

    drm/mediatek: ovl_adaptor: balance component registrations
    
    commit 533e3469a57996905cdb95f178e7efe38c21aeb2 upstream.
    
    The OVL adaptor registers both an aggregate driver for its child devices
    and a component for the main DRM aggregate. Probe currently ignores an
    error from registering the child aggregate and leaves that aggregate
    registered if registering the DRM component fails. The remove callback
    also leaves the DRM component registered.
    
    These imbalances can leave component framework entries referring to a
    device whose probe failed or whose driver has been detached. The aggregate
    unbind callback also fails to undo component_bind_all(), leaving its child
    components marked as bound when the aggregate is removed.
    
    Check the aggregate registration result, unwind it when the component
    registration fails, and unregister the component before the aggregate on
    remove. Keep runtime PM enabled until both framework registrations have
    been removed, and unbind all child components from the aggregate unbind
    callback.
    
    Fixes: 453c3364632a ("drm/mediatek: Add ovl_adaptor support for MT8195")
    Cc: [email protected] # 6.4+
    Co-developed-by: Ijae Kim <[email protected]>
    Signed-off-by: Ijae Kim <[email protected]>
    Signed-off-by: Myeonghun Pak <[email protected]>
    Reviewed-by: CK Hu <[email protected]>
    Link: https://patchwork.kernel.org/project/linux-mediatek/patch/[email protected]/
    Signed-off-by: Chun-Kuang Hu <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/panthor: reject firmware sections with oversized data [+ + +]
Author: Osama Abdelkader <[email protected]>
Date:   Thu Jul 16 16:39:38 2026 +0200

    drm/panthor: reject firmware sections with oversized data
    
    commit a3caaa06809248b996254be5b47e10804a3494e2 upstream.
    
    In panthor_fw_load_section_entry(), the data size to copy is calculated
    without validating it against the allocated section_size:
    
        section->data.size = hdr.data.end - hdr.data.start;
    
    If a crafted firmware sets data.size larger than the allocated memory,
    this could cause a heap buffer overflow in panthor_fw_init_section_mem()
    
        memcpy(section->mem->kmap, section->data.buf, section->data.size);
    
    Additionally, if the section->data.size exceeds the BO size, could this
    memset underflow the size calculation, leading to a massive out-of-bounds
    zeroing of kernel memory?
    
        memset(section->mem->kmap + section->data.size, 0,
               panthor_kernel_bo_size(section->mem) - section->data.size);
    
    Reject section entries whose initial data is larger than the section size.
    
    Fixes: 2718d91816ee ("drm/panthor: Add the FW logical block")
    Cc: [email protected]
    Signed-off-by: Osama Abdelkader <[email protected]>
    Reviewed-by: Steven Price <[email protected]>
    Reviewed-by: Boris Brezillon <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Steven Price <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/panthor: validate firmware interface structure sizes [+ + +]
Author: Osama Abdelkader <[email protected]>
Date:   Mon Jul 20 13:49:17 2026 +0200

    drm/panthor: validate firmware interface structure sizes
    
    commit b921b8613790a3f9e78ab64017fa7149ef0b750c upstream.
    
    iface_fw_to_cpu_addr() only checks that the firmware-provided MCU virtual
    address points inside the shared section. The returned pointer is later
    used as a full firmware interface structure, so accepting an address near
    the end of the shared section can still lead to out-of-bounds accesses.
    
    Pass the expected object size to iface_fw_to_cpu_addr() and reject ranges
    that do not fit entirely in the shared section.
    
    Fixes: 2718d91816ee ("drm/panthor: Add the FW logical block")
    Cc: [email protected]
    Signed-off-by: Osama Abdelkader <[email protected]>
    Reviewed-by: Steven Price <[email protected]>
    Signed-off-by: Steven Price <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/tegra: fbdev: Do not assign to struct drm_fb_helper.info [+ + +]
Author: Thomas Zimmermann <[email protected]>
Date:   Tue Apr 21 09:29:05 2026 +0200

    drm/tegra: fbdev: Do not assign to struct drm_fb_helper.info
    
    commit d23bd83f3e47a928e783c0d6a004737519dc77dc upstream.
    
    That field already contains the value being assigned. No need to do
    this twice.
    
    Signed-off-by: Thomas Zimmermann <[email protected]>
    Fixes: 63c971af4036 ("drm/fb-helper: Allocate and release fb_info in single place")
    Cc: [email protected]
    Signed-off-by: Thierry Reding <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/tegra: fbdev: Remove offset into framebuffer memory [+ + +]
Author: Thomas Zimmermann <[email protected]>
Date:   Thu Jul 30 22:41:01 2026 -0400

    drm/tegra: fbdev: Remove offset into framebuffer memory
    
    [ Upstream commit a18b6e30ecd69096beda4a0c96d2570900c3879a ]
    
    The screen_buffer field in struct fb_info contains the kernel address
    of the first byte of framebuffer memory. Do not add the display offset.
    This offset only describes scrolling during scanout.
    
    Signed-off-by: Thomas Zimmermann <[email protected]>
    Fixes: de2ba664c30f ("gpu: host1x: drm: Add memory manager and fb")
    Cc: [email protected]
    Cc: [email protected]
    Cc: <[email protected]> # v3.10+
    Signed-off-by: Thierry Reding <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/vc4: Supply the overflow slot size in BPOS, not the whole bin BO size [+ + +]
Author: Jose Maria Casanova Crespo <[email protected]>
Date:   Mon Jul 27 11:32:28 2026 -0300

    drm/vc4: Supply the overflow slot size in BPOS, not the whole bin BO size
    
    commit 6395789e4739aa5177bbec0fa0f07ccc38d249b0 upstream.
    
    vc4_overflow_mem_work() points BPOA at a 512KB slot inside the 16MB
    binner BO, but writes the size of the whole BO to BPOS. On every binner
    out-of-memory event the PTB is therefore authorized to write tile lists
    across all the other slots (which may hold the tile state, tile alloc and
    overflow memory of in-flight jobs) and, for any slot but the first, past
    the end of the binner BO into unrelated CMA memory.
    
    Since CMA pages are recycled into page cache and user allocations, this
    is arbitrary memory corruption by GPU DMA. In practice it shows up as GPU
    hangs with corrupted control list pointers, userspace heap corruption, a
    GPU that stays permanently wedged after the first hang, and occasional
    full system crashes, whenever a job overflows the initial binner slot.
    
    The bug dates back to the conversion from a dedicated overflow BO (where
    writing the full BO size was correct) to the slotted binner BO.
    
    Fixes: 553c942f8b2c ("drm/vc4: Allow using more than 256MB of CMA memory.")
    Cc: [email protected]
    Assisted-by: Claude:claude-opus-4.8
    Signed-off-by: Jose Maria Casanova Crespo <[email protected]>
    Reviewed-by: Maíra Canal <[email protected]>
    Reviewed-by: Iago Toral Quiroga <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Maíra Canal <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/vc4: Zero the tile state data array before each BIN job [+ + +]
Author: Maíra Canal <[email protected]>
Date:   Mon Jul 27 11:32:29 2026 -0300

    drm/vc4: Zero the tile state data array before each BIN job
    
    commit 48a570c964d8e37d353381e4195106277e17f5cb upstream.
    
    The binner BO is a single 16MB buffer split into 512KB slots that are
    handed out to jobs at submission time and recycled as jobs complete,
    without ever being cleared. Each slot holds the job's Tile State Data
    Array (TSDA) at its start, followed by the tile allocation pool.
    
    While the tile allocation pool is only walked by the render thread
    through branches the binner generated during the current job, the
    TSDA is the PTB's own per-tile bookkeeping and is consumed by the
    hardware itself. Although the kernel sets the "Auto-initialise Tile
    State Data Array" flag in the tile binning mode configuration, the
    PTB demonstrably still acts on stale tile state left by the slot's
    previous user: the binner ends up creating invalid command streams
    with invalid primitive streams and branches, which can cause GPU hangs
    as observed in [1][2].
    
    Zero the TSDA when the job's binning slot is configured. This clears
    48 bytes per tile (~24KB for a 1080p frame) in the submission path, and
    guarantees the PTB never sees another job's tile state.
    
    The tile count is only checked for being non-zero today, so the 8-bit
    fields it comes from can describe a tile state array almost six times
    larger than the slot it has to live in. Bound it before the slot is
    handed out, since such size decides how much of the slot is left for
    the tile alloc pool.
    
    Link: https://github.com/raspberrypi/linux/issues/3221 [1]
    Link: https://github.com/raspberrypi/linux/issues/5780 [2]
    Fixes: 553c942f8b2c ("drm/vc4: Allow using more than 256MB of CMA memory.")
    Cc: [email protected]
    Reviewed-by: Iago Toral Quiroga <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Maíra Canal <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/vmwgfx: avoid destroy_workqueue(NULL) on vkms init failure [+ + +]
Author: Zack Rusin <[email protected]>
Date:   Tue May 5 18:22:29 2026 -0400

    drm/vmwgfx: avoid destroy_workqueue(NULL) on vkms init failure
    
    commit 05eaa887e7b4f40fba425f8a1d7a5a8a043092a6 upstream.
    
    Two paths through vmw_vkms_init() can leave vmw->crc_workq NULL while
    still leaving the rest of the driver in a state that calls
    vmw_vkms_cleanup() at module unload:
    
      1. vmw_host_get_guestinfo(GUESTINFO_VBLANK, ...) failing or
         returning an oversized buffer -- the common case on hosts
         without a VBLANK guestinfo entry -- early-returned before the
         workqueue allocation.
      2. alloc_ordered_workqueue() returning NULL on memory pressure.
    
    vmw_vkms_cleanup() then calls destroy_workqueue(NULL), which
    dereferences wq->name and panics.
    
    Fix the first case by removing the early return: vmw->vkms_enabled
    is already false on the rpci-failure path so no work will ever be
    queued, and allocating the workqueue unconditionally keeps the
    control flow simple.  Fix the second case by guarding the cleanup
    with a NULL check, since alloc_ordered_workqueue() can still fail
    under low memory.
    
    Fixes: 7b0062036c3b ("drm/vmwgfx: Implement virtual crc generation")
    Cc: [email protected]
    Assisted-by: Claude:claude-opus-4.7
    Signed-off-by: Zack Rusin <[email protected]>
    Reviewed-by: Ian Forbes <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/vmwgfx: bound DMA command body size against suffix pointer [+ + +]
Author: Zack Rusin <[email protected]>
Date:   Tue May 5 18:22:28 2026 -0400

    drm/vmwgfx: bound DMA command body size against suffix pointer
    
    commit f4f1db96bfd68b81053693ba53405b6f510ac16c upstream.
    
    vmw_cmd_dma() locates the DMA suffix at
    
            (unsigned long) &cmd->body + header->size - sizeof(*suffix)
    
    without checking that header->size is large enough to contain both
    cmd->body and the suffix.  An undersized header makes the suffix
    pointer underflow back into the previous command in the bounce
    buffer.  The verifier later writes suffix->maximumOffset, clobbering
    verified fields of an already-relocated earlier command -- a TOCTOU
    on the device-visible command stream that lets one command rewrite
    another's GMR id, surface id, or other authenticated fields.
    
    Reject the command if the body is too small for the suffix to fit.
    
    Fixes: 4e4ddd477743 ("drm/vmwgfx: Fix queries if no dma buffer thrashing is occuring.")
    Cc: [email protected]
    Assisted-by: Claude:claude-opus-4.7
    Signed-off-by: Zack Rusin <[email protected]>
    Reviewed-by: Ian Forbes <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/vmwgfx: clamp dirty-page range with min, not max [+ + +]
Author: Zack Rusin <[email protected]>
Date:   Tue May 5 18:22:24 2026 -0400

    drm/vmwgfx: clamp dirty-page range with min, not max
    
    commit f47d542d5912f236273399d7139b522f6950e2e4 upstream.
    
    vmw_bo_dirty_transfer_to_res() and vmw_bo_dirty_clear() compute the
    intersection of a resource's page range with the BO's tracked dirty
    range, but clamp res_end against dirty->end with max() instead of
    min().  When dirty->end exceeds the resource end, the loop walks past
    the resource's pages, calls vmw_resource_dirty_update() for ranges
    owned by other resources sharing the same backing MOB and clears
    their pending dirty bits via bitmap_clear().  The result is silent
    loss of writeback for unrelated resources whenever two resources
    share a MOB.
    
    Use min() in both functions so the loop is bounded to the
    intersection of the resource and dirty ranges.
    
    Fixes: b7468b15d271 ("drm/vmwgfx: Implement an infrastructure for write-coherent resources")
    Fixes: 965544150d1c ("drm/vmwgfx: Refactor cursor handling")
    Cc: [email protected]
    Assisted-by: Claude:claude-opus-4.7
    Signed-off-by: Zack Rusin <[email protected]>
    Reviewed-by: Ian Forbes <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/vmwgfx: drop dma_buf reference on foreign-fd prime import [+ + +]
Author: Zack Rusin <[email protected]>
Date:   Tue May 5 18:22:26 2026 -0400

    drm/vmwgfx: drop dma_buf reference on foreign-fd prime import
    
    commit f739416dc555fa205a785e5135d73fa39b26f35d upstream.
    
    ttm_prime_fd_to_handle() returns -ENOSYS when the imported fd's
    dma_buf->ops do not match the ttm_object_device's ops, but does so
    without releasing the reference acquired by dma_buf_get().  Any
    unprivileged renderD client passing a non-vmwgfx prime fd through the
    DRM_VMW_GB_SURFACE_REF{,_EXT} path leaks one dma_buf reference per
    call and indefinitely pins the foreign exporter's GEM resources.
    
    Funnel the error path through the existing dma_buf_put() so the
    reference is always dropped.
    
    Fixes: 65981f7681ab ("drm/ttm: Add a minimal prime implementation for ttm base objects")
    Cc: [email protected]
    Assisted-by: Claude:claude-opus-4.7
    Signed-off-by: Zack Rusin <[email protected]>
    Reviewed-by: Ian Forbes <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/vmwgfx: enforce cursor size limits for MOB cursors [+ + +]
Author: Zack Rusin <[email protected]>
Date:   Tue May 5 18:22:30 2026 -0400

    drm/vmwgfx: enforce cursor size limits for MOB cursors
    
    commit d5ed8749168ad13c0dbaa8300f68d854b6076966 upstream.
    
    vmw_cursor_plane_atomic_check() bounds cursor width and height only
    on the legacy update path; the SVGA_CAP2_CURSOR_MOB path -- the
    default on modern hosts -- accepts any size.  When the requested size
    exceeds SVGA_REG_CURSOR_MAX_DIMENSION or SVGA_REG_MOB_MAX_SIZE,
    vmw_cursor_mob_get() returns -EINVAL and leaves vps->cursor.mob NULL.
    Its return value is then discarded in vmw_cursor_plane_prepare_fb(),
    so the subsequent vmw_cursor_update_mob() calls
    vmw_bo_map_and_cache(NULL) and oopses inside
    vmw_bo_map_and_cache_size() on the tbo.base.size load.
    
    Reachable from any DRM master via DRM_IOCTL_MODE_CURSOR2 with a
    sufficiently large width or height (e.g. cursor_max_dim + 1).
    
    Reject oversized cursors in atomic_check for both MOB-backed cursor
    update types.  The MOB byte-size limit only applies to the
    SVGA_CAP2_CURSOR_MOB path (vmw_cursor_mob_size() returns 0 for
    GB_ONLY); compute the required MOB size in 64-bit to avoid overflow
    when very large dimensions are requested.
    
    In prepare_fb only call vmw_cursor_mob_get()/_map() for
    VMW_CURSOR_UPDATE_MOB -- the GB_ONLY path uses bo->map.virtual
    directly and would otherwise be silently downgraded to NONE on hosts
    without SVGA_CAP2_CURSOR_MOB (where vmw_cursor_mob_get() always
    returns -EINVAL).  Degrade the update to NONE if vmw_cursor_mob_get()
    or vmw_cursor_mob_map() fails so the update path does not run with a
    NULL backing MOB.
    
    Fixes: 965544150d1c ("drm/vmwgfx: Refactor cursor handling")
    Cc: [email protected]
    Assisted-by: Claude:claude-opus-4.7
    Signed-off-by: Zack Rusin <[email protected]>
    Reviewed-by: Ian Forbes <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/vmwgfx: fix guest_memory_dirty bitfield clobbered as size [+ + +]
Author: Zack Rusin <[email protected]>
Date:   Tue May 5 18:22:22 2026 -0400

    drm/vmwgfx: fix guest_memory_dirty bitfield clobbered as size
    
    commit 83195b778f2d109a3a4f3ffaba4dce7e4cdb58aa upstream.
    
    Two sites in vmwgfx_resource.c assign boolean literals to
    res->guest_memory_size, which is an unsigned long allocation-size
    field; the intended target is the adjacent res->guest_memory_dirty
    bitfield.  After the assignments the field holds 0 or 1 instead of
    the resource's MOB allocation size:
    
      - vmw_resource_release()       writes 0 (false), and
      - vmw_resource_unbind_list()   writes 1 (true).
    
    Subsequent revalidation paths read guest_memory_size when computing
    the dirty page range (vmw_bo_dirty_transfer_to_res()) and the buffer
    allocation size (vmw_resource_buf_alloc()), producing zero-length
    walks or wrap-around ranges that read or write past the MOB bitmap.
    The dirty-tracking intent of the original code (mark the resource as
    dirtied since the last sync) is also lost, since guest_memory_dirty
    is never updated.
    
    Rename both assignments to guest_memory_dirty.
    
    Fixes: 668b206601c5 ("drm/vmwgfx: Stop using raw ttm_buffer_object's")
    Cc: [email protected]
    Assisted-by: Claude:claude-opus-4.7
    Signed-off-by: Zack Rusin <[email protected]>
    Reviewed-by: Ian Forbes <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/vmwgfx: reject DX_BIND_QUERY without a DX context [+ + +]
Author: Zack Rusin <[email protected]>
Date:   Tue May 5 18:22:23 2026 -0400

    drm/vmwgfx: reject DX_BIND_QUERY without a DX context
    
    commit 55ec09c9ce10b1272802c7ab6c1be2ea0dbc68db upstream.
    
    vmw_cmd_dx_bind_query() unconditionally dereferences
    sw_context->dx_ctx_node->ctx.  Userspace can trigger a NULL pointer
    dereference from any render-node fd by submitting an execbuf with
    dx_context_handle == SVGA3D_INVALID_ID and a SVGA_3D_CMD_DX_BIND_QUERY
    opcode in the command stream: dx_ctx_node is left NULL and the kernel
    oopses on the assignment.  The same NULL is then re-read in
    vmw_resources_reserve() via vmw_context_get_dx_query_mob().
    
    All sibling DX handlers fail-close on a missing dx_ctx_node using
    VMW_GET_CTX_NODE().  Use the same pattern here, returning -EINVAL up
    front before any relocation state is published.
    
    Fixes: 9c079b8ce8bf ("drm/vmwgfx: Adapt execbuf to the new validation api")
    Cc: [email protected]
    Assisted-by: Claude:claude-opus-4.7
    Signed-off-by: Zack Rusin <[email protected]>
    Reviewed-by: Ian Forbes <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/vmwgfx: take fman->lock around fence list mutation in fifo_down [+ + +]
Author: Zack Rusin <[email protected]>
Date:   Tue May 5 18:22:25 2026 -0400

    drm/vmwgfx: take fman->lock around fence list mutation in fifo_down
    
    commit 250af2e8c3e90dc978e062a936b633870a22e660 upstream.
    
    vmw_fence_fifo_down() drops fman->lock to wait on a fence and, on
    timeout, mutates fman->fence_list via list_del_init() and signals
    the fence without re-acquiring the lock.  __vmw_fences_update() walks
    and removes entries from the same list under fman->lock from any
    other waiter, the fence-IRQ thread, or vmw_fences_update(), so the
    unlocked list_del_init() can corrupt the list head.
    
    Re-take fman->lock before manipulating fence->head and use
    dma_fence_signal_locked().  Wrap the locked signalling in
    dma_fence_begin_signalling() / dma_fence_end_signalling() so the
    lockdep annotation that dma_fence_signal() previously provided is
    preserved (the same pattern as __vmw_fences_update()).
    
    dma_fence_put() is moved outside the lock to avoid a recursive
    acquire from vmw_fence_obj_destroy(), which also takes fman->lock.
    
    Fixes: ae2a104058e2 ("vmwgfx: Implement fence objects")
    Cc: [email protected]
    Assisted-by: Claude:claude-opus-4.7
    Signed-off-by: Zack Rusin <[email protected]>
    Reviewed-by: Ian Forbes <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/vmwgfx: use check_add_overflow for shader size+offset bound [+ + +]
Author: Zack Rusin <[email protected]>
Date:   Tue May 5 18:22:32 2026 -0400

    drm/vmwgfx: use check_add_overflow for shader size+offset bound
    
    commit 54d56d5b42d2e4c72ba6e365e9774da90698aa22 upstream.
    
    vmw_shader_define() validates the user-supplied shader window against
    its backing buffer with
    
            (u64)buffer->tbo.base.size < (u64)size + (u64)offset
    
    drm_vmw_shader_create_arg::offset is __u64 in the uapi; when it is
    near U64_MAX the unsigned addition wraps and the resulting tiny value
    passes the check.  The unbounded offset is then stored in
    res->guest_memory_offset and forwarded to host SVGA shader-create
    commands.
    
    Use check_add_overflow() to detect the wrap and compare the resulting
    endpoint against the buffer size.
    
    Fixes: 668b206601c5 ("drm/vmwgfx: Stop using raw ttm_buffer_object's")
    Cc: [email protected]
    Assisted-by: Claude:claude-opus-4.7
    Signed-off-by: Zack Rusin <[email protected]>
    Reviewed-by: Ian Forbes <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/vmwgfx: validate DRAW_PRIMITIVES header size before division [+ + +]
Author: Zack Rusin <[email protected]>
Date:   Tue May 5 18:22:27 2026 -0400

    drm/vmwgfx: validate DRAW_PRIMITIVES header size before division
    
    commit 85891d174707d8bddcec7a888fb4e1d17def34f3 upstream.
    
    vmw_cmd_draw() computes
    
            maxnum = (header->size - sizeof(cmd->body)) / sizeof(*decl);
    
    where header->size is u32 and is taken straight from the user-supplied
    command stream.  When header->size is less than sizeof(cmd->body) the
    unsigned subtraction wraps to nearly 4 GiB, producing a huge maxnum.
    Any user-controlled cmd->body.numVertexDecls then passes the bound and
    the loop dereferences decl[i] far past the end of the kernel command
    bounce buffer, producing an out-of-bounds read of kernel memory.
    
    Reject undersized headers up front.
    
    Fixes: 7a73ba7469cb ("drm/vmwgfx: Use TTM handles instead of SIDs as user-space surface handles.")
    Cc: [email protected]
    Assisted-by: Claude:claude-opus-4.7
    Signed-off-by: Zack Rusin <[email protected]>
    Reviewed-by: Ian Forbes <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/vmwgfx: validate external BO copy bounds for both stride paths [+ + +]
Author: Zack Rusin <[email protected]>
Date:   Tue May 5 18:22:33 2026 -0400

    drm/vmwgfx: validate external BO copy bounds for both stride paths
    
    commit 706c93c5813caabbb0d0a576c017d15aeec2c113 upstream.
    
    vmw_external_bo_copy() trusts caller-supplied offsets, strides, and
    heights and operates on imported dma-buf vmaps:
    
      - The equal-stride memcpy() bound was clamped after subtracting the
        offsets from dst_size and src_size; an offset larger than the BO
        size wraps the unsigned subtraction to a huge value and the
        resulting memcpy() runs off the end of the vmap.  dst_stride *
        height is also a u32 multiplication that can overflow.
      - The non-equal-stride row-by-row path had no bound at all.  The
        loop touches bytes through offset + (height - 1) * stride +
        width_in_bytes, with only a WARN_ON(dst_stride < width_in_bytes),
        and could likewise step past the end of either mapping.
    
    The offsets and strides are derived from STDU/SOU plane state, so a
    configured CRTC submitting a crafted atomic commit on an imported
    framebuffer can reach this path.
    
    Validate the exact row-copy endpoint against each BO's size up front
    using check_mul_overflow() and check_add_overflow().  Use the bulk
    memcpy() path only when width_in_bytes covers the whole stride;
    otherwise copy one row at a time so partial-row updates near the bottom
    of a framebuffer remain valid.  Also reject zero strides and stride <
    width_in_bytes, both of which the row-by-row path cannot represent
    safely.
    
    Fixes: 50f119925091 ("drm/vmwgfx: Fix prime with external buffers")
    Cc: [email protected]
    Assisted-by: Claude:claude-opus-4.7
    Signed-off-by: Zack Rusin <[email protected]>
    Reviewed-by: Ian Forbes <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/xe/bo: Add purgeable bo state tracking and field madv to xe_bo [+ + +]
Author: Arvind Yadav <[email protected]>
Date:   Sat Aug 1 10:03:57 2026 -0400

    drm/xe/bo: Add purgeable bo state tracking and field madv to xe_bo
    
    [ Upstream commit b67427f939ccf038a658badb02dd948c7b516248 ]
    
    Add infrastructure for tracking purgeable state of buffer objects.
    This includes:
    
    Introduce enum xe_madv_purgeable_state with three states:
       - XE_MADV_PURGEABLE_WILLNEED (0): BO is needed and should not be
         purged. This is the default state for all BOs.
    
       - XE_MADV_PURGEABLE_DONTNEED (1): BO is not currently needed and
         can be purged by the kernel under memory pressure to reclaim
         resources. Only non-shared BOs can be marked as DONTNEED.
    
       - XE_MADV_PURGEABLE_PURGED (2): BO has been purged by the kernel.
         Accessing a purged BO results in error. Follows i915 semantics
         where once purged, the BO remains permanently invalid ("once
         purged, always purged").
    
    Add madv_purgeable field to struct xe_bo for state tracking
      of purgeable state across concurrent access paths
    
    Cc: Thomas Hellström <[email protected]>
    Cc: Himal Prasad Ghimiray <[email protected]>
    Reviewed-by: Matthew Brost <[email protected]>
    Signed-off-by: Arvind Yadav <[email protected]>
    Signed-off-by: Matthew Brost <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Stable-dep-of: 7bc597ce74ba ("drm/xe/vm: Fix BO prefetch with CONSULT_MEM_ADVISE_PREF_LOC")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/xe/guc: Fix buffer overflow in steered register list allocation [+ + +]
Author: Tejas Upadhyay <[email protected]>
Date:   Fri Jul 31 20:45:07 2026 -0400

    drm/xe/guc: Fix buffer overflow in steered register list allocation
    
    [ Upstream commit 632ecc90e1ca5d3b6822bb4d08f84a175b6c42c0 ]
    
    The size calculation for the steered register extarray uses only the
    geometry DSS mask (g_dss_mask) to determine the number of entries to
    allocate:
    
      total = bitmap_weight(gt->fuse_topo.g_dss_mask, ...) * steer_reg_num;
    
    However, the filling loop uses for_each_dss_steering(), which iterates
    over for_each_dss(), defined as the union of g_dss_mask and c_dss_mask
    (geometry + compute DSS). On platforms with compute-only DSS bits, the
    loop writes past the allocated buffer, corrupting adjacent slab objects.
    
    This manifests as list_del corruption and SLUB redzone overwrites during
    drm_managed_release on device unbind, since the overflow corrupts the
    drmres list_head of neighboring allocations.
    
    Fix by computing the allocation size using the union of both DSS masks,
    matching the iteration pattern of for_each_dss_steering().
    
    --
    v2:
    - use bitmap_weighted_or() (Zhanjun)
    
    Fixes: b170d696c1e2 ("drm/xe/guc: Add XE_LP steered register lists")
    Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/8049
    Cc: Zhanjun Dong <[email protected]>
    Cc: [email protected]
    Assisted-by: GitHub-Copilot:claude-opus-4.6
    Reviewed-by: Zhanjun Dong <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Tejas Upadhyay <[email protected]>
    (cherry picked from commit 0a78a44f4901aa6c9263e66be7fce02282f1109f)
    Signed-off-by: Matthew Brost <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/xe/oa: (De-)whitelist OA registers on OA stream open/release [+ + +]
Author: Ashutosh Dixit <[email protected]>
Date:   Tue Aug 4 19:46:13 2026 -0700

    drm/xe/oa: (De-)whitelist OA registers on OA stream open/release
    
    [ Upstream commit 63ddb3ad08ff4e89c108499dfec5e9be5ddc25c9 ]
    
    Whitelist OA registers on stream open and de-whitelist on stream
    close/release. Whitelisting is only done when 'stream->sample' is
    true. 'stream->sample' is only true when (a) xe_observation_paranoid is set
    to false by system admin, or (b) the process is perfmon_capable(). This
    therefore enforces the OA register whitelisting security requirements.
    
    Fixes: 828a8eaf37c3 ("drm/xe/oa: Add MMIO trigger support")
    Cc: [email protected] # v6.12+
    Signed-off-by: Ashutosh Dixit <[email protected]>
    Reviewed-by: Umesh Nerlige Ramappa <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/xe/pat: Add helper to query compression enable status [+ + +]
Author: Xin Wang <[email protected]>
Date:   Sat Aug 1 10:03:55 2026 -0400

    drm/xe/pat: Add helper to query compression enable status
    
    [ Upstream commit b2bce0e551e89af37cfcb1b1158d80f369eeea3f ]
    
    Add xe_pat_index_get_comp_en() helper function to check whether
    compression is enabled for a given PAT index by extracting the
    XE2_COMP_EN bit from the PAT table entry.
    
    There are no current users, however there are multiple in-flight series
    which will all use this helper.
    
    CC: Nitin Gote <[email protected]>
    CC: Sanjay Yadav <[email protected]>
    CC: Matt Roper <[email protected]>
    Suggested-by: Matthew Auld <[email protected]>
    Signed-off-by: Xin Wang <[email protected]>
    Reviewed-by: Matt Roper <[email protected]>
    Reviewed-by: Nitin Gote <[email protected]>
    Reviewed-by: Matthew Auld <[email protected]>
    Reviewed-by: Sanjay Yadav <[email protected]>
    Signed-off-by: Matthew Auld <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Stable-dep-of: 7bc597ce74ba ("drm/xe/vm: Fix BO prefetch with CONSULT_MEM_ADVISE_PREF_LOC")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/xe/pt: Reset current_op in xe_pt_update_ops_init() [+ + +]
Author: Zongyao Bai <[email protected]>
Date:   Sat Aug 1 21:49:15 2026 -0400

    drm/xe/pt: Reset current_op in xe_pt_update_ops_init()
    
    [ Upstream commit 6384271ac1ac0099198d15df79212a19ebdb929d ]
    
    xe_pt_update_ops_init() fails to reset current_op to 0. On the
    vm_bind path, ops_execute() calls xe_pt_update_ops_prepare() inside
    the xe_validation_guard() / drm_exec_until_all_locked() loop. When
    that loop retries due to lock contention or OOM eviction
    (drm_exec_retry_on_contention() / xe_validation_retry_on_oom()),
    xe_pt_update_ops_prepare() runs again on the same vops, and each
    call to bind_op_prepare() increments current_op without resetting it.
    
    After N retries current_op exceeds the array size allocated by
    xe_vma_ops_alloc(), causing an out-of-bounds write into
    SLUB-poisoned memory and a subsequent UAF crash in
    xe_migrate_update_pgtables_cpu() when reading the corrupted pt_op->bind.
    
    Also reset needs_svm_lock and needs_invalidation which are derived in
    the same prepare pass and would otherwise cause wrong migrate ops
    selection and redundant TLB invalidation on retry.
    
    Fix this by resetting current_op, needs_svm_lock and needs_invalidation
    in xe_pt_update_ops_init().
    
    v2 (Matt):
       - Add details in commit message.
       - Add Fixes tag and Cc to [email protected]
    
    Fixes: e8babb280b5e ("drm/xe: Convert multiple bind ops into single job")
    Suggested-by: Matthew Auld <[email protected]>
    Cc: [email protected]
    Assisted-by: GitHub-Copilot:claude-sonnet-4.6
    Signed-off-by: Zongyao Bai <[email protected]>
    Reviewed-by: Matthew Brost <[email protected]>
    Signed-off-by: Matthew Brost <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    (cherry picked from commit 046045543e530605c441063535e7dca0075369a6)
    Signed-off-by: Thomas Hellström <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/xe/rtp: (De-)whitelist OA registers for all hwe's for a gt [+ + +]
Author: Ashutosh Dixit <[email protected]>
Date:   Tue Aug 4 19:46:12 2026 -0700

    drm/xe/rtp: (De-)whitelist OA registers for all hwe's for a gt
    
    [ Upstream commit ebba7ce65252a4ab0e3794ff14854df2afca5c08 ]
    
    Whitelist or de-whitelist OA registers for all hwe's on the gt on which the
    OA stream is opened. This simplifies the case where an oa unit has 0
    attached hwe's (but which monitors OA events on the associated GT).
    
    Fixes: 828a8eaf37c3 ("drm/xe/oa: Add MMIO trigger support")
    Cc: [email protected] # v6.12+
    Signed-off-by: Ashutosh Dixit <[email protected]>
    Reviewed-by: Umesh Nerlige Ramappa <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

drm/xe/rtp: Add RING_FORCE_TO_NONPRIV_DENY to OA whitelists [+ + +]
Author: Ashutosh Dixit <[email protected]>
Date:   Tue Aug 4 19:46:06 2026 -0700

    drm/xe/rtp: Add RING_FORCE_TO_NONPRIV_DENY to OA whitelists
    
    [ Upstream commit e70086a3a06d276b4a5d9a2c51c9330c6cf72780 ]
    
    Unconditionally whitelisting OA registers is a security violation. Set
    RING_FORCE_TO_NONPRIV_DENY bit in OA nonpriv slots, so that OA registers
    don't get whitelisted by default after probe, gt reset, resume and engine
    reset.
    
    Fixes: 828a8eaf37c3 ("drm/xe/oa: Add MMIO trigger support")
    Cc: [email protected] # v6.12+
    Suggested-by: Umesh Nerlige Ramappa <[email protected]>
    Signed-off-by: Ashutosh Dixit <[email protected]>
    Reviewed-by: Umesh Nerlige Ramappa <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

drm/xe/rtp: Ensure locking/ref counting for OA whitelists [+ + +]
Author: Ashutosh Dixit <[email protected]>
Date:   Tue Aug 4 19:46:14 2026 -0700

    drm/xe/rtp: Ensure locking/ref counting for OA whitelists
    
    [ Upstream commit ef78e2a22f72c892fd6663f0760abd208d49a3e2 ]
    
    Since multiple OA streams might be open in parallel on a gt, ensure that
    proper locking is in place. Also ensure that OA registers are whitelisted
    when the first OA stream is open and de-whitelisted after the last OA
    stream is closed.
    
    Fixes: 828a8eaf37c3 ("drm/xe/oa: Add MMIO trigger support")
    Cc: [email protected] # v6.12+
    Signed-off-by: Ashutosh Dixit <[email protected]>
    Reviewed-by: Umesh Nerlige Ramappa <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

drm/xe/rtp: Generalize whitelist_apply_to_hwe [+ + +]
Author: Ashutosh Dixit <[email protected]>
Date:   Tue Aug 4 19:46:09 2026 -0700

    drm/xe/rtp: Generalize whitelist_apply_to_hwe
    
    [ Upstream commit 4fe2844b0f0c7cdc45ca4c4c62ca56b7f26c514c ]
    
    Generalize whitelist_apply_to_hwe to construct both non-OA and OA
    whitelist nonpriv registers.
    
    Fixes: 828a8eaf37c3 ("drm/xe/oa: Add MMIO trigger support")
    Cc: [email protected] # v6.12+
    Signed-off-by: Ashutosh Dixit <[email protected]>
    Reviewed-by: Umesh Nerlige Ramappa <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

drm/xe/rtp: Keep track of non-OA nonpriv slots [+ + +]
Author: Ashutosh Dixit <[email protected]>
Date:   Tue Aug 4 19:46:08 2026 -0700

    drm/xe/rtp: Keep track of non-OA nonpriv slots
    
    [ Upstream commit 60d49ea28bb190a640bd8dc3f4c946e0811a948c ]
    
    In order to dynamically whitelist/dewhitelist OA registers on OA stream
    open/close, we need to keep track of nonpriv slots occupied by non-OA
    register whitelists.
    
    Fixes: 828a8eaf37c3 ("drm/xe/oa: Add MMIO trigger support")
    Cc: [email protected] # v6.12+
    Signed-off-by: Ashutosh Dixit <[email protected]>
    Reviewed-by: Umesh Nerlige Ramappa <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

drm/xe/rtp: Maintain OA whitelists separately [+ + +]
Author: Ashutosh Dixit <[email protected]>
Date:   Tue Aug 4 19:46:07 2026 -0700

    drm/xe/rtp: Maintain OA whitelists separately
    
    [ Upstream commit 31e2437561621b4867c08efc890bf629d017df03 ]
    
    Contains minor modification of the above commit because of changed API.
    
    OA registers are dynamically whitelisted (and again dewhitelisted) on OA
    stream open/close. Maintaining OA whitelists separately from non-OA
    register whitlists simplifies this management of OA register
    whitelisting/dewhitelisting.
    
    Fixes: 828a8eaf37c3 ("drm/xe/oa: Add MMIO trigger support")
    Cc: [email protected] # v6.12+
    Signed-off-by: Ashutosh Dixit <[email protected]>
    Reviewed-by: Umesh Nerlige Ramappa <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

drm/xe/rtp: Refactor OAG MMIO trigger register whitelisting [+ + +]
Author: Ashutosh Dixit <[email protected]>
Date:   Tue Aug 4 19:46:05 2026 -0700

    drm/xe/rtp: Refactor OAG MMIO trigger register whitelisting
    
    [ Upstream commit ed455775c5a68b75e5f6ad6c8e0e3e9c98fd3f64 ]
    
    Minor refactor of OAG MMIO trigger register whitelisting for code reuse
    with OAM MMIO trigger register whitelisting.
    
    Signed-off-by: Ashutosh Dixit <[email protected]>
    Reviewed-by: Umesh Nerlige Ramappa <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

drm/xe/rtp: Save OA nonpriv registers to register save/restore lists [+ + +]
Author: Ashutosh Dixit <[email protected]>
Date:   Tue Aug 4 19:46:10 2026 -0700

    drm/xe/rtp: Save OA nonpriv registers to register save/restore lists
    
    [ Upstream commit a19a83721a28ccaddace846da70da5c53d7dd052 ]
    
    Now we can save OA whitelisting nonpriv registers to register save/restore
    lists. OA nonpriv registers are saved to both hwe->oa_sr as well as
    hwe->reg_sr.
    
    During probe, resume and gt-reset flows KMD will apply hwe->reg_sr,
    ensuring OA registers are de-whitelisted after these events. For
    engine-reset, hwe->reg_sr is registered with GuC and GuC will apply these
    registers, ensuring OA registers are de-whitelisted after engine resets.
    
    hwe->oa_sr is used for whitelisting or de-whitelisting OA registers during
    OA operation, by toggling the 'deny' bit on oa stream open/close.
    
    Fixes: 828a8eaf37c3 ("drm/xe/oa: Add MMIO trigger support")
    Cc: [email protected] # v6.12+
    Signed-off-by: Ashutosh Dixit <[email protected]>
    Reviewed-by: Umesh Nerlige Ramappa <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

drm/xe/rtp: Toggle 'deny' bit to (de-)whitelist OA regs [+ + +]
Author: Ashutosh Dixit <[email protected]>
Date:   Tue Aug 4 19:46:11 2026 -0700

    drm/xe/rtp: Toggle 'deny' bit to (de-)whitelist OA regs
    
    [ Upstream commit b422babd77fac2c96b92db484050e460899bddaf ]
    
    Whitelist or de-whitelist OA registers by setting or resetting the 'deny'
    bit in OA nonpriv registers and writing new register values to HW.
    
    Fixes: 828a8eaf37c3 ("drm/xe/oa: Add MMIO trigger support")
    Cc: [email protected] # v6.12+
    Signed-off-by: Ashutosh Dixit <[email protected]>
    Reviewed-by: Umesh Nerlige Ramappa <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/xe/vm: Fix BO prefetch with CONSULT_MEM_ADVISE_PREF_LOC [+ + +]
Author: Himal Prasad Ghimiray <[email protected]>
Date:   Sat Aug 1 10:03:59 2026 -0400

    drm/xe/vm: Fix BO prefetch with CONSULT_MEM_ADVISE_PREF_LOC
    
    [ Upstream commit 7bc597ce74bab4153b2009c92eccf889e9d74044 ]
    
    When prefetch region is DRM_XE_CONSULT_MEM_ADVISE_PREF_LOC for a BO VMA,
    the code used it as an index into region_to_mem_type[], causing an
    out-of-bounds access since the value is -1.
    
    Resolve the preferred location for BO VMAs directly: local VRAM on dGFX
    (using the BO's tile placement) or system memory on iGPU.
    
    Discovered using AI-assisted static analysis confirmed by Intel Product
    Security.
    
    v2:
    -Fix null dereference
    
    Reported-by: Martin Hodo <[email protected]>
    Fixes: c1bb69a2e8e2 ("drm/xe/svm: Consult madvise preferred location in prefetch")
    Cc: Matthew Brost <[email protected]>
    Cc: [email protected]
    Reviewed-by: Matthew Brost <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Himal Prasad Ghimiray <[email protected]>
    (cherry picked from commit d9a4906ac03be9f6ed3f3b45c56c866b867fd75b)
    Signed-off-by: Thomas Hellström <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/xe/vm: Prevent binding of purged buffer objects [+ + +]
Author: Arvind Yadav <[email protected]>
Date:   Sat Aug 1 10:03:58 2026 -0400

    drm/xe/vm: Prevent binding of purged buffer objects
    
    [ Upstream commit 4f44961eab8474a47de419113e1d46095f9b44e0 ]
    
    Add purge checking to vma_lock_and_validate() to block new mapping
    operations on purged BOs while allowing cleanup operations to proceed.
    
    Purged BOs have their backing pages freed by the kernel. New
    mapping operations (MAP, PREFETCH, REMAP) must be rejected with
    -EINVAL to prevent GPU access to invalid memory. Cleanup
    operations (UNMAP) must be allowed so applications can release
    resources after detecting purge via the retained field.
    
    REMAP operations require mixed handling - reject new prev/next
    VMAs if the BO is purged, but allow the unmap portion to proceed
    for cleanup.
    
    The check_purged flag in struct xe_vma_lock_and_validate_flags
    distinguishes between these cases: true for new mappings (must reject),
    false for cleanup (allow).
    
    Cc: Himal Prasad Ghimiray <[email protected]>
    Cc: Matthew Brost <[email protected]>
    Reviewed-by: Thomas Hellström <[email protected]>
    Signed-off-by: Arvind Yadav <[email protected]>
    Signed-off-by: Matthew Brost <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Stable-dep-of: 7bc597ce74ba ("drm/xe/vm: Fix BO prefetch with CONSULT_MEM_ADVISE_PREF_LOC")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/xe: Add page reclamation info to device info [+ + +]
Author: Oak Zeng <[email protected]>
Date:   Sat Aug 1 21:49:14 2026 -0400

    drm/xe: Add page reclamation info to device info
    
    [ Upstream commit 9b1a0e0a15c97987fdf56a615f3d13995bafd042 ]
    
    Starting from Xe3p, HW adds a feature assisting range based page
    reclamation. Introduce a bit in device info to indicate whether
    device has such capability.
    
    Signed-off-by: Oak Zeng <[email protected]>
    Signed-off-by: Brian Nguyen <[email protected]>
    Reviewed-by: Shuicheng Lin <[email protected]>
    Reviewed-by: Matthew Brost <[email protected]>
    Signed-off-by: Matthew Brost <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Stable-dep-of: 6384271ac1ac ("drm/xe/pt: Reset current_op in xe_pt_update_ops_init()")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/xe: add xe_migrate_resolve wrapper and is_vram_resolve support [+ + +]
Author: Nitin Gote <[email protected]>
Date:   Sat Aug 1 10:03:56 2026 -0400

    drm/xe: add xe_migrate_resolve wrapper and is_vram_resolve support
    
    [ Upstream commit be97fd06458d66a53aefb6d9429db0df734c81c0 ]
    
    Introduce an internal __xe_migrate_copy(..., is_vram_resolve) path and
    expose a small wrapper xe_migrate_resolve() that calls it with
    is_vram_resolve=true.
    
    For resolve/decompression operations we must ensure the copy code uses
    the compression PAT index when appropriate; this change centralizes that
    behavior and allows callers to schedule a resolve (decompress) operation
    via the migrate API.
    
    v3: Fix kernel-doc warnings
    
    v2: (Matt)
      - Simplify xe_migrate_resolve(), use single BO/resource;
        remove copy_only_ccs argument as it's always false.
    
    Cc: Matthew Brost <[email protected]>
    Cc: Matthew Auld <[email protected]>
    Reviewed-by: Matthew Brost <[email protected]>
    Signed-off-by: Nitin Gote <[email protected]>
    Signed-off-by: Matthew Auld <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Stable-dep-of: 7bc597ce74ba ("drm/xe/vm: Fix BO prefetch with CONSULT_MEM_ADVISE_PREF_LOC")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/xe: Stub out new pagefault layer [+ + +]
Author: Matthew Brost <[email protected]>
Date:   Sat Aug 1 21:49:13 2026 -0400

    drm/xe: Stub out new pagefault layer
    
    [ Upstream commit 620a09fb0bddf387f418663478b48ca4ba62b6d6 ]
    
    Stub out the new page fault layer and add kernel documentation. This is
    intended as a replacement for the GT page fault layer, enabling multiple
    producers to hook into a shared page fault consumer interface.
    
    v2:
     - Fix kernel doc typo (checkpatch)
     - Remove comment around GT (Stuart)
     - Add explaination around reclaim (Francois)
     - Add comment around u8 vs enum (Francois)
     - Include engine instance (Stuart)
    v3:
     - Fix XE_PAGEFAULT_TYPE_ATOMIC_ACCESS_VIOLATION kernel doc (Stuart)
    
    Signed-off-by: Matthew Brost <[email protected]>
    Reviewed-by: Lucas De Marchi <[email protected]>
    Tested-by: Francois Dugast <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Stable-dep-of: 6384271ac1ac ("drm/xe/pt: Reset current_op in xe_pt_update_ops_init()")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/xe: Use SVM range helpers in PT layer [+ + +]
Author: Matthew Brost <[email protected]>
Date:   Sat Aug 1 21:49:12 2026 -0400

    drm/xe: Use SVM range helpers in PT layer
    
    [ Upstream commit 9ea9b45701ab50049a722450abc28346d1121e6e ]
    
    We have helpers SVM range start, end, and size. Use them in the PT
    layer rather than directly looking at the struct.
    
    Signed-off-by: Matthew Brost <[email protected]>
    Reviewed-by: Himal Prasad Ghimiray <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Stable-dep-of: 6384271ac1ac ("drm/xe/pt: Reset current_op in xe_pt_update_ops_init()")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/xe: Wait on external BO kernel fences in exec IOCTL [+ + +]
Author: Matthew Brost <[email protected]>
Date:   Sat Aug 1 12:59:13 2026 -0400

    drm/xe: Wait on external BO kernel fences in exec IOCTL
    
    [ Upstream commit af80e2bfde9312c76b60cf9274248dce0410b30d ]
    
    Before arming a user job, xe_exec_ioctl() only added the VM's
    dma-resv KERNEL slot as a dependency. That slot covers rebinds and
    the kernel operations of the VM's private BOs, but not external BOs
    (bo->vm == NULL), which carry their kernel operations (evictions,
    moves, ...) in their own dma-resv KERNEL slot.
    
    The DMA_RESV_USAGE_KERNEL slot is the cross-driver contract for
    memory management operations that must complete before the BO or its
    backing store may be used: any accessor is required to wait on the
    KERNEL fences before touching the resv. By skipping the external BOs'
    KERNEL slots, the exec path violated that contract and could schedule
    a user job while a kernel operation on an external BO mapped by the VM
    was still in flight, racing against it and potentially reading or
    writing memory that was being moved.
    
    Replace the VM-only dependency with an iteration over every object
    locked by the exec, adding each object's KERNEL slot as a job
    dependency. This covers the VM resv (rebinds and private BOs) as well
    as every external BO, mirroring the drm_gpuvm_resv_add_fence() call
    that later publishes the job fence to the same set of objects.
    Long-running mode continues to skip this, as before.
    
    Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
    Cc: [email protected]
    Assisted-by: GitHub_Copilot:claude-opus-4.8
    Signed-off-by: Matthew Brost <[email protected]>
    Reviewed-by: Matthew Auld <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    (cherry picked from commit a6b842acf3ddd1efc53a56de9260cfa718fb35e7)
    Signed-off-by: Thomas Hellström <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
e1000: fix memory leak in e1000_probe() [+ + +]
Author: Dawei Feng <[email protected]>
Date:   Sun Jun 7 22:57:06 2026 +0800

    e1000: fix memory leak in e1000_probe()
    
    commit 816419dfea5c88126f35eb7a1b429a1bf546665e upstream.
    
    In the e1000_probe() path, e1000_sw_init() allocates adapter->tx_ring and
    adapter->rx_ring. If the subsequent CE4100-specific MDIO BAR mapping
    fails, the error handling jumps past the ring cleanup code, leaking both
    allocations.
    
    Fix this leak by moving the err_mdio_ioremap label above the ring
    deallocation logic. This guarantees the proper release of these resources
    and prevents the memory leak.
    
    The bug was first flagged by an experimental analysis tool we are
    developing for kernel memory-management bugs while analyzing
    v6.13-rc1. The tool is still under development and is not yet publicly
    available. Manual inspection confirms that the bug is still
    present in v7.1-rc6.
    
    An x86_64 allyesconfig build showed no new warnings. As we do not have a
    CE4100 reference platform to test with, no runtime testing was able to
    be performed.
    
    Fixes: 5377a4160bb65 ("e1000: Add support for the CE4100 reference platform")
    Cc: [email protected]
    Signed-off-by: Zilin Guan <[email protected]>
    Signed-off-by: Dawei Feng <[email protected]>
    Reviewed-by: Dima Ruinskiy <[email protected]>
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
erofs: cap LZMA stream pool size [+ + +]
Author: Michael Bommarito <[email protected]>
Date:   Tue Jul 14 07:47:29 2026 -0400

    erofs: cap LZMA stream pool size
    
    commit c9b47e6b23114e939b17f818471c7a46e59006e7 upstream.
    
    fs/erofs/decompressor_lzma.c sizes the module-global MicroLZMA stream
    pool from num_possible_cpus() when the lzma_streams module parameter is
    unset, then z_erofs_load_lzma_config() preallocates one image-supplied
    dictionary per stream, accepting dictionaries up to 8 MiB.  On high-CPU
    systems, a small EROFS image can pin hundreds of MiB of vmalloc-backed
    decoder state until the erofs module is unloaded.
    
    Impact: An EROFS image mounted by the system can pin up to 8 MiB of
    vmalloc memory per LZMA stream, either as intended or unexpectedly.
    
    Bound the default stream count by a new
    CONFIG_EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS option, default 16, so the
    worst-case default preallocation is 128 MiB if the number of CPUs is no
    less than 16 while preserving the existing per-image dictionary limit.
    An explicit lzma_streams module parameter is still honoured as-is, so
    administrators who deliberately size the pool are not affected.
    
    Fixes: 622ceaddb764 ("erofs: lzma compression support")
    Cc: [email protected]
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: Michael Bommarito <[email protected]>
    Reviewed-by: Gao Xiang <[email protected]>
    Signed-off-by: Gao Xiang <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
file: add FD_{ADD,PREPARE}() [+ + +]
Author: Christian Brauner <[email protected]>
Date:   Thu Aug 6 01:39:52 2026 +0800

    file: add FD_{ADD,PREPARE}()
    
    [ Upstream commit 011703a9acd76edc7c85d80dbccb6e50dba53aad ]
    
    I've been playing with this to allow for moderately flexible usage of
    the get_unused_fd_flags() + create file + fd_install() pattern that's
    used quite extensively.
    
    How callers allocate files is really heterogenous so it's not really
    convenient to fold them into a single class. It's possibe to split them
    into subclasses like for anon inodes. I think that's not necessarily
    nice as well.
    
    My take is to add two primites:
    (1) FD_ADD() the simple cases a file is installed:
    
        fd = FD_ADD(O_CLOEXEC, open_file(some, args)));
        if (fd >= 0)
                kvm_get_kvm(vcpu->kvm);
        return fd;
    
    (2) FD_PREPARE() that captures all the cases where access to fd or file
        or additional work before publishing the fd is needed:
    
        FD_PREPARE(fdf, open_flag, file_open_handle(&path, open_flag));
        if (fdf.err)
                return fdf.err;
    
        if (copy_to_user(/* something something */))
                return -EFAULT;
    
        return fd_publish(fdf);
    
    I've converted all of the easy cases over to it and it gets rid of an
    aweful lot of convoluted cleanup logic.
    
    It's centered around struct fd_prepare. FD_PREPARE() encapsulates all of
    allocation and cleanup logic and must be followed by a call to
    fd_publish() which associates the fd with the file and installs it into
    the callers fdtable. If fd_publish() isn't called both are deallocated.
    
    It mandates a specific order namely that first we allocate the fd and
    then instantiate the file. But that shouldn't be a problem nearly
    everyone I've converted uses this exact pattern anyway.
    
    There's a bunch of additional cases where it would be easy to convert
    them to this pattern. For example, the whole sync file stuff in dma
    currently retains the containing structure of the file instead of the
    file itself even though it's only used to allocate files. Changing that
    would make it fall into the FD_PREPARE() pattern easily. I've not done
    that work yet.
    
    There's room for extending this in a way that wed'd have subclasses for
    some particularly often use patterns but as I said I'm not even sure
    that's worth it.
    
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Christian Brauner <[email protected]>
    (cherry picked from commit 011703a9acd76edc7c85d80dbccb6e50dba53aad)
    Signed-off-by: Wentao Guan <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

file: ensure cleanup [+ + +]
Author: Christian Brauner <[email protected]>
Date:   Thu Aug 6 01:39:54 2026 +0800

    file: ensure cleanup
    
    [ Upstream commit d2ea4d254d04a89e17504af0230c7268e3cac6bf ]
    
    Brown paper bag time. This is a silly oversight where I missed to drop
    the error condition checking to ensure we clean up on early error
    returns. I have an internal unit testset coming up for this which will
    catch all such issues going forward.
    
    Reported-by: Chris Mason <[email protected]>
    Reported-by: Jeff Layton <[email protected]>
    Fixes: 011703a9acd7 ("file: add FD_{ADD,PREPARE}()")
    Signed-off-by: Christian Brauner <[email protected]>
    Reviewed-by: Jeff Layton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    (cherry picked from commit d2ea4d254d04a89e17504af0230c7268e3cac6bf)
    Signed-off-by: Wentao Guan <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
forcedeth: fix UAF of txrx_stats in nv_remove [+ + +]
Author: Chenguang Zhao <[email protected]>
Date:   Thu Jul 23 17:26:37 2026 +0800

    forcedeth: fix UAF of txrx_stats in nv_remove
    
    [ Upstream commit 22666ba1420164753d7b0f5a841986b25ace5435 ]
    
    nv_remove() frees the per-CPU txrx_stats before unregister_netdev().
    Until unregister completes, ndo_get_stats64, the NAPI/xmit data path,
    and nv_close()/drain may still access txrx_stats, leading to a
    use-after-free.
    
    Free the stats only after unregister_netdev().
    
    Fixes: f4b633b911fd ("forcedeth: use per cpu to collect xmit/recv statistics")
    Signed-off-by: Chenguang Zhao <[email protected]>
    Reviewed-by: Vadim Fedorenko <[email protected]>
    Reviewed-by: Zhu Yanjun <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
fortify: Disable -Wstringop-overread in tests [+ + +]
Author: Nathan Chancellor <[email protected]>
Date:   Tue Jun 23 13:23:46 2026 -0700

    fortify: Disable -Wstringop-overread in tests
    
    commit c1f3e770eec26d6f96dd6d2ea30555ba7c09a244 upstream.
    
    clang recently added support for -Wstringop-overread [1], which is on by
    default like -Wfortify-source. This breaks the usage of -Werror in the
    fortify tests, resulting in the following false positive warnings in the
    kernel build:
    
      warning: unsafe memcmp() usage lacked '__read_overflow2' warning in lib/test_fortify/read_overflow2-memcmp.c
      warning: unsafe memcmp() usage lacked '__read_overflow' warning in lib/test_fortify/read_overflow-memcmp.c
      warning: unsafe memchr() usage lacked '__read_overflow' warning in lib/test_fortify/read_overflow-memchr.c
    
    Examining the fortify test logs shows a warning like the following in
    each of the failed logs:
    
      In file included from lib/test_fortify/read_overflow2-memcmp.c:5:
      lib/test_fortify/test_fortify.h:34:2: error: 'memcmp' reading 17 bytes from a region of size 16 [-Werror,-Wstringop-overread]
         34 |         TEST;
            |         ^
      lib/test_fortify/read_overflow2-memcmp.c:3:2: note: expanded from macro 'TEST'
          3 |         memcmp(large, small, sizeof(small) + 1)
            |         ^
      1 error generated.
    
    Disable -Wstringop-overread for the fortify tests, as it defeats the
    purpose of testing the Linux specific implementation of fortify, like
    -Wfortify-source.
    
    Cc: [email protected]
    Closes: https://github.com/ClangBuiltLinux/linux/issues/2168
    Link: https://github.com/llvm/llvm-project/commit/86f2e71cb8d165b59ad31a442b2391e23826133e [1]
    Signed-off-by: Nathan Chancellor <[email protected]>
    Link: https://patch.msgid.link/20260623-fix-test_fortify-for-clang-stringop-overread-v1-1-15ee8342a953@kernel.org
    Signed-off-by: Kees Cook <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
fprobe: Fix module reference count leak on error in register_fprobe() [+ + +]
Author: Masami Hiramatsu (Google) <[email protected]>
Date:   Wed Jul 29 08:27:33 2026 +0900

    fprobe: Fix module reference count leak on error in register_fprobe()
    
    [ Upstream commit 8cf2f40ceb85047ad8a84dffae3bebc9fed18216 ]
    
    In register_fprobe(), get_ips_from_filter() resolves target function
    addresses and increments module reference counts via try_module_get() for
    symbols in kernel modules. If get_ips_from_filter() fails on the second
    pass and returns an error, register_fprobe() returned directly without
    releasing module references acquired up to that point.
    
    Fix this by ensuring the cleanup loop executing module_put() runs even when
    get_ips_from_filter() returns a negative error.
    
    Link: https://lore.kernel.org/all/178528125360.101985.4144133640239273153.stgit@devnote2/
    
    Fixes: d24fa977eec5 ("tracing: fprobe: Fix to lock module while registering fprobe")
    Assisted-by: Antigravity:gemini-3.6-flash
    Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
fs/proc/task_mmu: fix PAGEMAP_SCAN written state for PMD holes [+ + +]
Author: Kiryl Shutsemau (Meta) <[email protected]>
Date:   Wed Jul 15 15:42:33 2026 +0100

    fs/proc/task_mmu: fix PAGEMAP_SCAN written state for PMD holes
    
    commit 40de8160ca7f67d14619ee0351ce5d68fc4a237a upstream.
    
    PAGEMAP_SCAN reports an unpopulated PTE in a uffd-wp VMA as written, but a
    range with no page table at all -- a PMD hole -- is skipped:
    pagemap_scan_pte_hole() tests p->cur_vma_category, which never carries
    PAGE_IS_WRITTEN, so the hole is neither reported nor (under
    PM_SCAN_WP_MATCHING) armed.
    
    In a uffd-wp VMA, WP_UNPOPULATED installs uffd-wp markers when protecting
    a range, allocating page tables as needed, so an unpopulated slot is
    treated as written -- see the pte_none() handling in
    pagemap_page_category().  A missing marker therefore means the range was
    zapped, e.g.  via MADV_DONTNEED.  This applies to anon and shmem VMAs.
    
    An anonymous THP is write-protected in place as a huge PMD, so a full-PMD
    MADV_DONTNEED clears it to pmd_none -- a hole with no page table -- and
    pagemap_scan_pte_hole() misses it.  For a MAP_PRIVATE|MAP_ANON mapping
    MADV_DONTNEED has fill-with-zeros semantics, so a write-tracking
    checkpoint/migration tool (e.g.  CRIU) treats the range as unchanged and
    keeps its previous contents; after restore or live migration the process
    reads stale data instead of zeroes -- data corruption.
    
    Report a hole in a non-hugetlb uffd-wp VMA as written, matching the
    pte_none handling in pagemap_page_category(); the existing
    PM_SCAN_WP_MATCHING path then arms it via uffd_wp_range().
    
    hugetlb is excluded: pagemap_hugetlb_category() reports an empty hugetlb
    entry (huge_pte_none) as not-written, unlike pagemap_page_category(),
    which reports pte_none as written.  pagemap_scan_pte_hole() fires for a
    hugetlb slot only when it has no page table; keeping that not-written
    matches how an allocated-but-empty hugetlb entry reads, so the hole and
    the empty-entry cases agree within the VMA.
    
    Link: https://lore.kernel.org/[email protected]
    Fixes: 2bad466cc9d9 ("mm/uffd: UFFD_FEATURE_WP_UNPOPULATED")
    Signed-off-by: Kiryl Shutsemau <[email protected]>
    Reported-by: Sashiko AI review <[email protected]>
    Closes: https://sashiko.dev/#/patchset/[email protected]
    Tested-by: Muhammad Usama Anjum <[email protected]>
    Acked-by: David Hildenbrand (Arm) <[email protected]>
    Cc: Peter Xu <[email protected]>
    Cc: Jann Horn <[email protected]>
    Cc: Liam R. Howlett <[email protected]>
    Cc: Lorenzo Stoakes <[email protected]>
    Cc: Michal Hocko <[email protected]>
    Cc: Mike Rapoport <[email protected]>
    Cc: Pedro Falcato <[email protected]>
    Cc: Shuah Khan <[email protected]>
    Cc: Suren Baghdasaryan <[email protected]>
    Cc: Vlastimil Babka <[email protected]>
    Cc: Zenghui Yu <[email protected]>
    Assisted-by: Claude:claude-fable-5
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

fs/proc/task_mmu: fix PAGEMAP_SCAN written state for unpopulated ptes [+ + +]
Author: Kiryl Shutsemau (Meta) <[email protected]>
Date:   Wed Aug 5 14:43:52 2026 +0100

    fs/proc/task_mmu: fix PAGEMAP_SCAN written state for unpopulated ptes
    
    [ Upstream commit 07b4377bdbe74a3ec0c8da5849d014f70e003384 ]
    
    PAGEMAP_SCAN reports an unpopulated pte differently depending on which
    path serves the request.  The PAGE_IS_WRITTEN fast path in
    pagemap_scan_pmd_entry() reports a pte_none as written (and, under
    PM_SCAN_WP_MATCHING, arms a marker); pagemap_page_category() returns 0 for
    the same pte_none.  A request that cannot take the fast path (an extra
    category bit, category_anyof_mask or category_inverted) therefore reports
    the pte as clean and skips arming it.
    
    A range that was populated and then MADV_DONTNEED'd reads as written via
    one mask and clean via another, and in the latter case is not re-armed for
    the next round -- an incremental-dump consumer (e.g.  CRIU) using a richer
    mask drops the zapped range and stops tracking writes to it.
    
    Report pte_none as written in pagemap_page_category() too.  A pte_none
    carries no uffd-wp marker, i.e.  it is not write-protected -- the same
    condition under which the present and swap cases already report
    PAGE_IS_WRITTEN.  The fast path applies no VMA test, so neither does this.
    
    The hugetlb and fully-unpopulated-PMD (no page table) scans have no
    PAGE_IS_WRITTEN fast path, so they do not exhibit the per-entry divergence
    and are left unchanged.
    
    Add a pagemap_ioctl selftest that populates a range, drops it with
    MADV_DONTNEED, and checks that the fast path and the generic
    (category_anyof_mask) path both report every page written.
    
    Link: https://lore.kernel.org/[email protected]
    Fixes: 12f6b01a0bcb ("fs/proc/task_mmu: add fast paths to get/clear PAGE_IS_WRITTEN flag")
    Signed-off-by: Kiryl Shutsemau <[email protected]>
    Cc: Muhammad Usama Anjum <[email protected]>
    Cc: David Hildenbrand <[email protected]>
    Cc: Jann Horn <[email protected]>
    Cc: Liam R. Howlett <[email protected]>
    Cc: Lorenzo Stoakes <[email protected]>
    Cc: Michal Hocko <[email protected]>
    Cc: Mike Rapoport <[email protected]>
    Cc: Pedro Falcato <[email protected]>
    Cc: Peter Xu <[email protected]>
    Cc: Shuah Khan <[email protected]>
    Cc: Suren Baghdasaryan <[email protected]>
    Cc: Vlastimil Babka <[email protected]>
    Assisted-by: Claude:claude-fable-5
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    (cherry picked from commit 07b4377bdbe74a3ec0c8da5849d014f70e003384)
    [ kas: fix only; selftest hunk dropped (pagemap_ioctl.c differs on this tree). Add the pte_none early-return before the pte_present branch ]
    
    Signed-off-by: Kiryl Shutsemau (Meta) <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
gpio: pca953x: fix cache_only and IRQ state on restore_context() failure [+ + +]
Author: bui duc phuc <[email protected]>
Date:   Mon Jul 27 15:02:05 2026 +0700

    gpio: pca953x: fix cache_only and IRQ state on restore_context() failure
    
    commit d233087c19f6607ef926ac3f47d776e2406ffd1f upstream.
    
    When pca953x_restore_context() fails, cache_only is left disabled and
    the IRQ left enabled, even though register synchronization may not have
    completed successfully. Restore cache_only and disable the IRQ again on
    failure, matching the state set by pca953x_save_context().
    
    Fixes: ec5bde62019b ("gpio: pca953x: Split pca953x_restore_context() and pca953x_save_context()")
    Fixes: 3e38f946062b ("gpio: pca953x: fix IRQ storm on system wake up")
    Cc: [email protected]
    Reviewed-by: Linus Walleij <[email protected]>
    Signed-off-by: bui duc phuc <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Bartosz Golaszewski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

gpio: pch: use raw_spinlock_t for the register lock [+ + +]
Author: Junjie Cao <[email protected]>
Date:   Thu Jul 23 09:41:29 2026 +0800

    gpio: pch: use raw_spinlock_t for the register lock
    
    commit a02b8950d619123da64f69b70fe1dadef217dfe4 upstream.
    
    pch_irq_type() is registered as the irq_chip .irq_set_type callback and
    takes chip->spinlock with spin_lock_irqsave().  This callback is reached
    from __setup_irq() -> __irq_set_trigger() -> chip->irq_set_type() while
    the caller holds desc->lock, a raw_spinlock_t, with hardirqs disabled.
    That context is not sleepable, but on PREEMPT_RT a regular spinlock_t is
    an rtmutex-backed sleeping lock, so acquiring it there is invalid.
    
    This was confirmed on a PREEMPT_RT kernel with lockdep
    (PROVE_RAW_LOCK_NESTING and DEBUG_ATOMIC_SLEEP).  A grounded PoC mirrored
    pch_irq_type()'s locking and drove it through the real genirq carrier
    irq_set_irq_type() -> __irq_set_trigger() -> chip->irq_set_type(), i.e.
    the same __irq_set_trigger() edge that __setup_irq() takes for a
    requested IRQ.  With the original spin_lock_irqsave() edge lockdep
    reported an invalid wait context, immediately followed by:
    
      BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48
      in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 95, name: insmod
      hardirqs last disabled at (3784): _raw_spin_lock_irqsave+0x4f/0x60
       rt_spin_lock+0x3a/0x1c0
       repro_irq_set_type+0x64/0xa0 [pch_repro]
       __irq_set_trigger+0x69/0x140
       irq_set_irq_type+0x78/0xd0
    
    Switching the mirrored lock to raw_spinlock_t made both splats go away.
    
    Convert the register lock to raw_spinlock_t.  The same lock also
    serializes the GPIO direction/value callbacks and the suspend/resume
    register save/restore, but all of those critical sections only perform
    MMIO register accesses (ioread32()/iowrite32()) and
    irq_set_handler_locked(); none of them contain sleepable operations.
    Keeping this register lock non-sleeping is therefore appropriate for the
    irqchip callbacks and does not change the GPIO-side locking contract.
    
    This is the same class of issue and fix as recently addressed for other
    GPIO controllers, e.g. commit 286533cb14a3 ("gpio: sch: use raw_spinlock_t
    in the irq startup path") and commit 90f0109019e6 ("gpio: eic-sprd: use
    raw_spinlock_t in the irq startup path").
    
    Fixes: 38eb18a6f92d ("gpio-pch: Support interrupt function")
    Cc: [email protected]
    Signed-off-by: Junjie Cao <[email protected]>
    Reviewed-by: Linus Walleij <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Bartosz Golaszewski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

gpio: sloppy-logic-analyzer: Fix memory leak in gpio_la_poll_probe() [+ + +]
Author: Abdun Nihaal <[email protected]>
Date:   Wed Jul 15 13:23:08 2026 +0530

    gpio: sloppy-logic-analyzer: Fix memory leak in gpio_la_poll_probe()
    
    [ Upstream commit 7a7baebd9f23ba4f24796775472b2fd00dcd95d9 ]
    
    The memory allocated for priv->blob.data is not freed in the error paths
    that follow the fops_buf_size_set() call in gpio_la_poll_probe(), as
    well as in the remove function. Fix that by using device managed action
    to free the memory on remove.
    
    Fixes: 7828b7bbbf20 ("gpio: add sloppy logic analyzer using polling")
    Signed-off-by: Abdun Nihaal <[email protected]>
    Reviewed-by: Wolfram Sang <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Bartosz Golaszewski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
HID: logitech-dj: Fix maxfield check in DJ short report validation [+ + +]
Author: HyeongJun An <[email protected]>
Date:   Thu Jun 18 15:37:37 2026 +0900

    HID: logitech-dj: Fix maxfield check in DJ short report validation
    
    commit 590cc4d782487632a52f37c2171bee1eeea29627 upstream.
    
    Commit b6a57912854e ("HID: logitech-dj: Prevent REPORT_ID_DJ_SHORT
    related user initiated OOB write") added validation for the DJ short
    output report, but the error path dereferences rep->field[0] even when
    rep->maxfield is zero.
    
    Commit 8b9a097eb2fc ("HID: logitech-dj: fix wrong detection of bad
    DJ_SHORT output report") made the check conditional on rep being present,
    but a crafted descriptor can still create report ID 0x20 with only padding
    output items. hid-core registers the report, ignores the padding field,
    and leaves rep->maxfield as zero.
    
    In that case the validation enters the rep->maxfield < 1 branch and then
    dereferences rep->field[0]->report_count while printing the error message,
    causing a NULL pointer dereference during probe. This is reproducible with
    uhid by emulating a Logitech receiver with a padding-only DJ short output
    report:
    
      BUG: KASAN: null-ptr-deref in logi_dj_probe+0xb1/0x754 [hid_logitech_dj]
      Read of size 4 at addr 0000000000000028 by task kworker/4:1/129
      ...
      Call Trace:
       logi_dj_probe+0xb1/0x754 [hid_logitech_dj]
       hid_device_probe+0x329/0x3f0 [hid]
       really_probe+0x162/0x570
       __device_attach+0x137/0x2c0
       bus_probe_device+0x38/0xc0
       device_add+0xa56/0xce0
       hid_add_device+0x19c/0x280 [hid]
       uhid_device_add_worker+0x2c/0xb0 [uhid]
    
    Reject the zero-field report before printing the field report_count.
    
    Fixes: b6a57912854e ("HID: logitech-dj: Prevent REPORT_ID_DJ_SHORT related user initiated OOB write")
    Cc: [email protected]
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: HyeongJun An <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

HID: logitech-dj: fix wrong detection of bad DJ_SHORT output report [+ + +]
Author: Benjamin Tissoires <[email protected]>
Date:   Fri Apr 10 16:03:07 2026 +0200

    HID: logitech-dj: fix wrong detection of bad DJ_SHORT output report
    
    [ Upstream commit 8b9a097eb2fc37b486afd81388c693bf3ab44466 ]
    
    commit b6a57912854e ("HID: logitech-dj: Prevent REPORT_ID_DJ_SHORT
    related user initiated OOB write") assumed that all HID devices attached
    to the logitech-dj driver was having an output report of DJ_SHORT.
    
    However, on the receiver itself, we have 2 other HID device we attach
    here: the mouse emulation and the keyboard emulation. For those devices
    the value of rep is NULL and we are triggered a segfault here.
    
    This is doubly required because logitech-dj also handles non DJ devices
    that might not have the DJ collection.
    
    Fixes: b6a57912854e ("HID: logitech-dj: Prevent REPORT_ID_DJ_SHORT related user initiated OOB write")
    Signed-off-by: Benjamin Tissoires <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

HID: logitech-dj: Prevent REPORT_ID_DJ_SHORT related user initiated OOB write [+ + +]
Author: Lee Jones <[email protected]>
Date:   Tue Mar 24 14:36:44 2026 +0000

    HID: logitech-dj: Prevent REPORT_ID_DJ_SHORT related user initiated OOB write
    
    [ Upstream commit b6a57912854e7ea36f3b270032661140cc4209cd ]
    
    logi_dj_recv_send_report() assumes that all incoming REPORT_ID_DJ_SHORT
    reports are 14 Bytes (DJREPORT_SHORT_LENGTH - 1) long.  It uses that
    assumption to load the associated field's 'value' array with 14 Bytes of
    data.  However, if a malicious user only sends say 1 Byte of data,
    'report_count' will be 1 and only 1 Byte of memory will be allocated to
    the 'value' Byte array.  When we come to populate 'value[1-13]' we will
    experience an OOB write.
    
    Signed-off-by: Lee Jones <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

HID: logitech-dj: Standardise hid_report_enum variable nomenclature [+ + +]
Author: Lee Jones <[email protected]>
Date:   Tue Mar 24 14:36:43 2026 +0000

    HID: logitech-dj: Standardise hid_report_enum variable nomenclature
    
    [ Upstream commit a940aee176437046598dfc786b719bd96db3c74c ]
    
    Since we will need to differentiate between the two report_enum types
    soon, let's unify the naming conventions now to save confusion and/or
    unnecessary/unrelated changes in upcoming commits.
    
    {input,output}_report_enum is used in other places to let's conform.
    
    Signed-off-by: Lee Jones <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
hwmon: (adt7470) Fix busy-loop and I2C flooding in update thread [+ + +]
Author: Luiz Angelo Daros de Luca <[email protected]>
Date:   Mon Jul 27 21:22:19 2026 -0300

    hwmon: (adt7470) Fix busy-loop and I2C flooding in update thread
    
    [ Upstream commit cb0b7f9c43b0abbd422a7e4c2c85e91db429207c ]
    
    When userspace configures 'auto_update_interval' to 0 via sysfs, the
    background kthread executes schedule_timeout_interruptible(0), which
    returns immediately.
    
    If 'num_temp_sensors' is concurrently or previously set to 0, the
    msleep_interruptible() delay inside adt7470_read_temperatures() also
    becomes 0. This combination forces the background thread into a tight,
    unbounded busy-loop, hogging the CPU and flooding the I2C bus with a
    continuous stream of transactions.
    
    Fix this vulnerability by raising the lower limit of the clamp_val in
    auto_update_interval_store() from 0 to 500 milliseconds. This guarantees
    a reasonable minimum sleep window between sensor updates, protecting the
    system from intentional or accidental I2C bus denial of service.
    
    Reported-by: [email protected]
    Closes: https://lore.kernel.org/r/[email protected]
    Fixes: 89fac11cb3e7 ("adt7470: make automatic fan control really work")
    Signed-off-by: Luiz Angelo Daros de Luca <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

hwmon: (adt7470) Fix cache updated before hardware write on I2C error [+ + +]
Author: Luiz Angelo Daros de Luca <[email protected]>
Date:   Mon Jul 27 21:22:18 2026 -0300

    hwmon: (adt7470) Fix cache updated before hardware write on I2C error
    
    [ Upstream commit 05270bd38d9bf88a2f4c212246a8fa29f4032078 ]
    
    adt7470_temp_write() and adt7470_pwm_write() update the driver's
    cached values (temp_min, temp_max, pwm_input, pwm_enable) before issuing
    the corresponding regmap_write(), and never check whether the write
    succeeded before committing that update. If the I2C transaction fails,
    the function correctly propagates the error to the caller, but the cache
    silently keeps the new value, which was never actually applied to the
    hardware. Subsequent reads then report a value that does not match the
    device state.
    
    Reorder both write paths to update the cache only after a successful
    regmap_write(), so the cache always reflects what was actually
    written to the hardware.
    
    Fixes: ef67959c4253 ("hwmon: (adt7470) Convert to use regmap")
    Signed-off-by: Luiz Angelo Daros de Luca <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

hwmon: (adt7470) Fix divide-by-zero TOCTOU crash in fan speed read [+ + +]
Author: Luiz Angelo Daros de Luca <[email protected]>
Date:   Mon Jul 27 21:22:23 2026 -0300

    hwmon: (adt7470) Fix divide-by-zero TOCTOU crash in fan speed read
    
    [ Upstream commit 1b46fe9dc8f8de59310f37e6c5e5c0e05ded46c3 ]
    
    If the fan data becomes 0 between the FAN_DATA_VALID() check and the
    FAN_PERIOD_TO_RPM() conversion, it will result in a divide-by-zero crash
    due to a race with a concurrent update of the cached fan value.
    
    Fix a TOCTOU issue by reading fan data once.
    
    Reported-by: [email protected]
    Closes: https://lore.kernel.org/r/[email protected]/
    Fixes: fc958a61ff6d ("hwmon: (adt7470) Convert to devm_hwmon_device_register_with_info API")
    Signed-off-by: Luiz Angelo Daros de Luca <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

hwmon: (adt7470) Fix fans stuck in manual mode on I2C errors [+ + +]
Author: Luiz Angelo Daros de Luca <[email protected]>
Date:   Mon Jul 27 21:22:17 2026 -0300

    hwmon: (adt7470) Fix fans stuck in manual mode on I2C errors
    
    [ Upstream commit 625a2c02a1c04571232a746fe188b4d9a8d63edd ]
    
    During adt7470_read_temperatures(), the driver temporarily switches
    the PWM channels to manual mode, performs the temperature collection,
    and then restores the original configuration registers.
    
    However, if an I2C transaction fails at any point after entering manual
    mode, the function aborts and returns immediately. This leaves the
    configuration registers un-restored, permanently trapping the fans in
    manual mode.
    
    Introduce a recovery path to ensure that the original PWM configuration
    registers are always restored, even when intermediate I2C operations
    fail.
    
    Reported-by: [email protected]
    Closes: https://lore.kernel.org/r/[email protected]
    Fixes: ef67959c4253 ("hwmon: (adt7470) Convert to use regmap")
    Signed-off-by: Luiz Angelo Daros de Luca <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

hwmon: (adt7470) Fix PWM auto temp state array and bounds check [+ + +]
Author: Luiz Angelo Daros de Luca <[email protected]>
Date:   Mon Jul 27 21:22:24 2026 -0300

    hwmon: (adt7470) Fix PWM auto temp state array and bounds check
    
    [ Upstream commit 92413f439d1ec5e55b73ede8d66a7b971cbd1ced ]
    
    In pwm_auto_temp_store(), the parsed user input was missing bounds
    checks, allowing values > 0xF to overflow into the adjacent channel's
    bits. Furthermore, the value was being incorrectly written to the
    pwm_automatic state array instead of pwm_auto_temp.
    
    Fix this by rejecting values > 0xF with -EINVAL, and assigning the
    value to the correct array only after a successful I2C write.
    
    Reported-by: [email protected]
    Closes: https://lore.kernel.org/all/[email protected]/#t
    Fixes: 6f9703d0be16 ("hwmon: add support for adt7470")
    Signed-off-by: Luiz Angelo Daros de Luca <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

hwmon: (adt7470) Fix swapped PWM3 and PWM4 auto mode masks [+ + +]
Author: Luiz Angelo Daros de Luca <[email protected]>
Date:   Mon Jul 27 21:22:20 2026 -0300

    hwmon: (adt7470) Fix swapped PWM3 and PWM4 auto mode masks
    
    [ Upstream commit a3850231521b06bbbb18c8ebea100320c14a08be ]
    
    The ADT7470_PWM3_AUTO_MASK and ADT7470_PWM4_AUTO_MASK macros are
    currently defined with swapped bit values.
    
    According to Table 22 of the ADT7470 datasheet, the Fan Control Mode
    Configuration for register 0x69 follows the exact same bit position
    layout as register 0x68:
    - 0x68 Bit[7] corresponds to BHVR1 (PWM1) -> 0x80
    - 0x68 Bit[6] corresponds to BHVR2 (PWM2) -> 0x40
    - 0x69 Bit[7] corresponds to BHVR3 (PWM3) -> 0x80
    - 0x69 Bit[6] corresponds to BHVR4 (PWM4) -> 0x40
    
    Consequently, PWM3 should use mask 0x80 and PWM4 should use 0x40.
    
    This typo did not cause any functional bugs because these specific
    macros are never referenced in the driver code. Instead, the driver
    correctly applies the configuration by relying on the modulo parity of
    the channel index (e.g., `channel % 2`) to selectively apply either
    ADT7470_PWM1_AUTO_MASK (0x80) or ADT7470_PWM2_AUTO_MASK (0x40).
    Since the bit layout is identical between the two configuration
    registers, the hardware is currently configured correctly.
    
    Fix the macro definitions to reflect the datasheet accurately and
    prevent future bugs or confusion during code review and refactoring.
    As this is a purely cosmetic fix with no functional impact, a backport
    to stable kernels is not necessary.
    
    Fixes: 6f9703d0be16 ("hwmon: add support for adt7470")
    Signed-off-by: Luiz Angelo Daros de Luca <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

hwmon: (adt7470) Fix temperature alarm logic in hwmon_temp_read() [+ + +]
Author: Luiz Angelo Daros de Luca <[email protected]>
Date:   Mon Jul 27 21:22:21 2026 -0300

    hwmon: (adt7470) Fix temperature alarm logic in hwmon_temp_read()
    
    [ Upstream commit 1a18c79c4bc44cc5349c60e16b0b744dc6ec5f77 ]
    
    During the conversion the alarm callback started interpreting the
    channel index as an alarm bitmask, resulting in incorrect alarm
    reporting. Compute the proper alarm bit instead.
    
    Reported-by: [email protected]
    Closes: https://lore.kernel.org/r/[email protected]
    Fixes: fc958a61ff6d ("hwmon: (adt7470) Convert to devm_hwmon_device_register_with_info API")
    Signed-off-by: Luiz Angelo Daros de Luca <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

hwmon: (adt7470) Use cached PWM frequency value [+ + +]
Author: Luiz Angelo Daros de Luca <[email protected]>
Date:   Mon Jul 27 21:22:22 2026 -0300

    hwmon: (adt7470) Use cached PWM frequency value
    
    [ Upstream commit 60677cd4c28f44d5b307d3029dccece38fcce90f ]
    
    adt7470_pwm_read() currently ignores failures returned by
    pwm1_freq_get(). If the register read fails, the negative error code is
    returned through *val while the function itself reports success,
    potentially exposing a negative PWM frequency through sysfs.
    
    Fix this by using the cached PWM frequency maintained by the driver,
    eliminating the register access from the read path.
    
    Apart from the corrected error propagation and using the cached value,
    no functional change is intended.
    
    Fixes: ef67959c4253 ("hwmon: (adt7470) Convert to use regmap")
    Signed-off-by: Luiz Angelo Daros de Luca <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

hwmon: (ina2xx) Add support for INA234 [+ + +]
Author: Ian Ray <[email protected]>
Date:   Fri Feb 20 13:20:22 2026 +0200

    hwmon: (ina2xx) Add support for INA234
    
    [ Upstream commit 88a928eebccdc5445d874ddcbf1683b76c9f1431 ]
    
    INA234 is register compatible to INA226 (excepting manufacturer and die
    or device id registers) but has different scaling.
    
    Signed-off-by: Ian Ray <[email protected]>
    Reviewed-by: Bence Csókás <[email protected]> # v2
    Tested-by: Jens Almer <[email protected]>
    Tested-by: Jonas Rebmann <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Guenter Roeck <[email protected]>
    Stable-dep-of: e6c80061ca23 ("hwmon: (ina2xx) Fix various overflow issues")
    Signed-off-by: Sasha Levin <[email protected]>

hwmon: (ina2xx) Fix various overflow issues [+ + +]
Author: Guenter Roeck <[email protected]>
Date:   Wed Jun 10 07:46:16 2026 -0700

    hwmon: (ina2xx) Fix various overflow issues
    
    [ Upstream commit e6c80061ca239f45c0eaf7e47a91d6d6df9bd636 ]
    
    Sashiko reports several integer overflow problems in the ina2xx driver
    caused by unbounded multiplications and inadequate types for intermediate
    calculations.
    
    Specifically:
    - In ina2xx_get_value(), the return type is changed from int to long.
      Intermediate calculations for current are now performed using 64-bit
      types to prevent 32-bit integer overflow before the division by 1000.
    - When calculating power in ina2xx_get_value() and
      sy24655_average_power_read(), interim values are cast to u64 and clamped
      to LONG_MAX. This prevents overflow when regval or accumulator_24 is
      multiplied by power_lsb_uW.
    - In ina226_alert_to_reg(), the clamping logic is rewritten using min_t().
      This safely avoids integer overflows when scaling user-provided values
      for shunt voltage, bus voltage, power, and current limits.
    
    Cc: Loic Poulain <[email protected]>
    Fixes: ab7fbee452be ("hwmon: (ina2xx) Fix various overflow issues")
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

hwmon: (ina2xx) Make it easier to add more devices [+ + +]
Author: Ian Ray <[email protected]>
Date:   Fri Feb 20 13:20:21 2026 +0200

    hwmon: (ina2xx) Make it easier to add more devices
    
    [ Upstream commit f6e14b5bcabf4ee97a2d535c3c2d7e72c8da4c15 ]
    
    * Make sysfs entries documentation easier to maintain.
    * Use multi-line enum.
    * Correct "has_power_average" comment.
    
    Create a new "has_update_interval" member for chips which support
    averaging.
    
    Signed-off-by: Ian Ray <[email protected]>
    Reviewed-by: Bence Csókás <[email protected]> # v2
    Tested-by: Jens Almer <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Guenter Roeck <[email protected]>
    Stable-dep-of: e6c80061ca23 ("hwmon: (ina2xx) Fix various overflow issues")
    Signed-off-by: Sasha Levin <[email protected]>

hwmon: (ina2xx) Shift INA234 shunt and current registers [+ + +]
Author: Jonas Rebmann <[email protected]>
Date:   Tue Mar 3 12:07:02 2026 +0100

    hwmon: (ina2xx) Shift INA234 shunt and current registers
    
    [ Upstream commit eeca1114d1e2cc0eacaebb80f3f2afbaebfc60be ]
    
    The INA219 has the lowest three bits of the bus voltage register
    zero-reserved, the bus_voltage_shift ina2xx_config field was introduced
    to accommodate for that.
    
    The INA234 has four bits of the bus voltage, of the shunt voltage, and
    of the current registers zero-reserved but the latter two were
    implemented by choosing a 16x higher shunt_div instead of a separate
    field specifying a bit shift.
    
    This is possible because shunt voltage and current are divided by
    shunt_div, hence a 16x higher shunt_div results in a 16x smaller LSB for
    both the shunt voltage and the current register, perfectly accounting
    for the missing bit shift.
    
    For consistency and correctness, account for the reserved bits via
    shunt_voltage_shift and current_shift configuration fields as already
    done for voltage registers and use the conversion constants given in the
    INA234 datasheet.
    
    Signed-off-by: Jonas Rebmann <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Guenter Roeck <[email protected]>
    Stable-dep-of: e6c80061ca23 ("hwmon: (ina2xx) Fix various overflow issues")
    Signed-off-by: Sasha Levin <[email protected]>

hwmon: (lm90) Only report alarms if driver is ready [+ + +]
Author: Guenter Roeck <[email protected]>
Date:   Sat Jul 25 15:27:28 2026 -0700

    hwmon: (lm90) Only report alarms if driver is ready
    
    [ Upstream commit aa9429edf9fc0e90d6f4da19ea4b5495a54ab117 ]
    
    Userspace can read sysfs attributes before driver registration is complete,
    immediately after devm_hwmon_device_register_with_info() has been called.
    At that time, data->hwmon_dev is not yet initialized. This can trigger
    a NULL pointer access since lm90_update_device() and with it
    lm90_update_alarms_locked() will be called. This call schedules
    report_work and lm90_report_alarms(), which passes the still-NULL
    data->hwmon_dev to hwmon_notify_event() and triggers a NULL pointer
    dereference.
    
    Fix the problem by only scheduling the report and alert workers
    data->hwmon_dev is set.
    
    Reported-by: Sashiko <[email protected]>
    Fixes: f6d0775119fb9 ("hwmon: (lm90) Rework alarm/status handling")
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

hwmon: (ltc4282) Fix reading the minimum alarm voltage [+ + +]
Author: Guenter Roeck <[email protected]>
Date:   Wed Feb 5 12:27:15 2025 -0800

    hwmon: (ltc4282) Fix reading the minimum alarm voltage
    
    [ Upstream commit 00feb1cce93dab948a299b69753d99c681d45a0b ]
    
    Coverity reports an out-of-bounds access when reading the minimum alarm
    voltage for the VGPIO channel. Add the missing return statement to fix
    the problem.
    
    Fixes: cbc29538dbf7 ("hwmon: Add driver for LTC4282")
    Cc: Nuno Sa <[email protected]>
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

hwmon: (nct6775-core) Fix number of temperature registers for NCT6116 [+ + +]
Author: Guenter Roeck <[email protected]>
Date:   Wed Jul 22 07:14:36 2026 -0700

    hwmon: (nct6775-core) Fix number of temperature registers for NCT6116
    
    [ Upstream commit b0e8adb2ccb43009796897ced09f91636685c9d3 ]
    
    Unlike NCT6106, NCT6116 only has three temperature registers, and with
    it only three temperature source and temperature source configuration
    registers. The register addresses match those of NCT6106 and can be
    re-used.
    
    The code used a separate array to list the temperature source registers
    for NCT6116, but used the size of the NCT6106 register array to set
    the number of registers. The NCT6106 register array provides six addresses,
    while the temperature source register array for NCT6116 only provides three
    addresses. This causes a KASAN report.
    
    BUG: KASAN: global-out-of-bounds in nct6775_probe+0x936/0x46f0 [nct6775]
    Read of size 2 at addr ffffffffc19561a6 by task modprobe/954
    ...
    Call Trace:
     dump_stack+0x7d/0xa7
     print_address_description.constprop.0+0x1c/0x220
     ? __kasan_kmalloc.constprop.0+0xc9/0xd0
     ? __kmalloc_node_track_caller+0x194/0x5b0
     ? nct6775_probe+0x936/0x46f0 [nct6775]
     ? nct6775_probe+0x936/0x46f0 [nct6775]
    ...
    
    Fix the problem by hard-coding the number of temperature and temperature
    configuration registers to three for NCT6116. Drop the unnecessary
    NCT6116_REG_TEMP_SOURCE array and re-use NCT6106_REG_TEMP_SOURCE.
    
    Reported-by: Florian Bezdeka <[email protected]>
    Closes: https://lore.kernel.org/linux-hwmon/[email protected]/T/#t
    Fixes: 29c7cb485b32 ("hwmon: (nct6775) Integrate new model nct6116")
    Cc: Björn Gerhart <[email protected]>
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

hwmon: (nct6775-core) Prevent access to unsupported weight registers [+ + +]
Author: Guenter Roeck <[email protected]>
Date:   Mon Jul 27 13:35:37 2026 -0700

    hwmon: (nct6775-core) Prevent access to unsupported weight registers
    
    [ Upstream commit d0b704e569ac3b8416d8e02270cdc9bf830ed395 ]
    
    Sashiko reports:
    
    During initialization of the nct6116 chip, the driver sets data->pwm_num
    to 5. However, it assigns several NCT6106 register arrays (such as
    NCT6106_REG_WEIGHT_DUTY_STEP, NCT6106_REG_WEIGHT_TEMP_SEL, and
    NCT6106_REG_WEIGHT_TEMP_*) to data->REG_PWM and data->REG_WEIGHT_TEMP.
    These arrays only contain 3 elements.
    
    In nct6775_update_pwm(), the driver iterates up to data->pwm_num. If
    data->has_pwm has bits 3 or 4 set (which is structurally possible for
    nct6116), the loop attempts to read elements at index 3 and 4 from these
    3-element arrays. This results in a global out-of-bounds read, which can
    be caught by KASAN.
    
    Furthermore, the driver uses these garbage out-of-bounds values as
    hardware register addresses for subsequent read and write operations. This
    leads to invalid hardware register access, potentially causing hardware
    misconfiguration or system crashes.
    
    The underlying problem is that the chip does support up to five fan
    control channels, but only the first three support weight control.
    Fix the problem by extending the affected weight register arrays with
    zeroed fields. The driver uses zeroed register addresses to determine
    if a register is supported or not, and skips accesses for unsupported
    registers.
    
    Reported-by: Sashiko <[email protected]>
    Fixes: 29c7cb485b32 ("hwmon: (nct6775) Integrate new model nct6116")
    Cc: Björn Gerhart <[email protected]>
    Cc: Florian Bezdeka <[email protected]>
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

hwmon: (npcm750-pwm-fan): stop fan timer on device detach [+ + +]
Author: Hongyan Xu <[email protected]>
Date:   Wed Jul 29 18:01:16 2026 +0800

    hwmon: (npcm750-pwm-fan): stop fan timer on device detach
    
    commit f27f6976ea269219c1259a7c2f8c6dfe782540a3 upstream.
    
    When a fan tach channel is present, npcm7xx_pwm_fan_probe() starts
    fan_timer. The timer callback polls tach state and rearms the timer, but
    the driver has no remove callback or devm cleanup action to stop it. On
    device detach, the devm-managed driver data and I/O mappings can be
    released while the timer is still pending or running.
    
    Register a devm cleanup action before starting the timer and shut the
    timer down synchronously from that action.
    
    This issue was found by a static analysis tool.
    
    Fixes: f1fd4a4db777 ("hwmon: Add NPCM7xx PWM and Fan driver")
    Cc: [email protected]
    Signed-off-by: Hongyan Xu <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

hwmon: (nzxt-smart2) DMA-align output buffer [+ + +]
Author: Guenter Roeck <[email protected]>
Date:   Mon Jul 27 09:54:23 2026 -0700

    hwmon: (nzxt-smart2) DMA-align output buffer
    
    [ Upstream commit 080bbf42faf77e6489ab30d5114c5f8f6ccbb1b8 ]
    
    Sashiko reports:
    
    When send_output_report() calls hid_hw_output_report(), the underlying USB
    HID core calls usb_interrupt_msg() which maps this buffer directly for DMA.
    
    When the DMA mapping flushes or invalidates the cacheline, it will corrupt
    the adjacent variables (mutex, update_interval) that were modified
    concurrently by the CPU. This causes memory corruption due to cacheline
    sharing on non-coherent CPU architectures (such as ARM or MIPS). The DMA
    API debugging tool (CONFIG_DMA_API_DEBUG) will trigger runtime warnings
    for this violation.
    
    Any operation that triggers send_output_report() (like setting a fan speed
    or updating the interval) causes the USB DMA mapping. On systems with
    non-coherent caches, this structural bug causes immediate and deterministic
    memory corruption.
    
    Align the output buffer to ARCH_DMA_MINALIGN to fix the problem.
    
    Reported-by: Sashiko <[email protected]>
    Fixes: 53e68c20aeb1 ("hwmon: add driver for NZXT RGB&Fan Controller/Smart Device v2.")
    Cc: Aleksandr Mezin <[email protected]>
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

hwmon: (pmbus) Fix return value from pmbus_update_byte_data() [+ + +]
Author: Guenter Roeck <[email protected]>
Date:   Tue Jul 28 08:41:40 2026 -0700

    hwmon: (pmbus) Fix return value from pmbus_update_byte_data()
    
    [ Upstream commit a19038a200f18d9e74ac30081797917d0886e16b ]
    
    pmbus_update_byte_data() is supposed to return a negative error code or 0.
    However, if no change is made to the register, it actually returns the
    register value. This can result in problems if the calling code explicitly
    expects to see an error code or 0.
    
    Fix it to return 0 on success or the error code as expected.
    
    Fixes: 11c119986f270 ("hwmon: (pmbus) add helpers for byte write and read modify write")
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

hwmon: (pmbus/core) notify on the hwmon device, not the i2c client [+ + +]
Author: Vincent Jardin <[email protected]>
Date:   Thu Jul 23 17:44:56 2026 +0200

    hwmon: (pmbus/core) notify on the hwmon device, not the i2c client
    
    commit a64a7e8a0b012ba81b0eadbd7afc84ab0dbfd70c upstream.
    
    pmbus_notify() calls sysfs_notify() and kobject_uevent() on the i2c
    client's kobject, but the alarm attributes live on the hwmon class
    device registered by pmbus_do_probe(). Notifying the parent i2c device
    is a no-op for both poll(POLLPRI) waiters and udev listeners: the named
    attribute does not exist on that kobject.
    
    Notify the hwmon device instead, so poll() wakes up and "change"
    uevents fire on the inX_alarm/tempX_alarm attributes when SMBALERT#
    reports a fault.
    
    Fixes: f469bde9afd1 ("hwmon: (pmbus/core) Notify hwmon events")
    Cc: [email protected] # v6.4+
    Signed-off-by: Vincent Jardin <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

hwmon: (sht3x) Fix unaligned accesses [+ + +]
Author: Guenter Roeck <[email protected]>
Date:   Sat Jul 25 09:34:46 2026 -0700

    hwmon: (sht3x) Fix unaligned accesses
    
    [ Upstream commit f46d5ab43a572b84773015a76966f5da56fc1748 ]
    
    Sashiko reports:
    
    In sht3x_update_client(), the 16-bit temperature and humidity values are
    extracted from a stack-allocated byte array using be16_to_cpup(). The
    pointers passed to this function are calculated as buf and buf + 3. Since
    the difference between the two pointers is an odd number of bytes, at
    least one of them is guaranteed to be at an unaligned offset.
    
    This will trigger an alignment fault on strict-alignment architectures
    such as ARMv5 or SPARC, resulting in a kernel panic.
    
    Fix the problem by using get_unaligned_be16() instead of be16_to_cpup(),
    and put_unaligned_be16() instead of cpu_to_be16().
    
    Fixes: 7c84f7f80d6f ("hwmon: add support for Sensirion SHT3x sensors")
    Reported-by: Sashiko <[email protected]>
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
i2c: amd-mp2: Unregister callback on adapter add failure [+ + +]
Author: Myeonghun Pak <[email protected]>
Date:   Tue Jul 21 23:41:47 2026 +0900

    i2c: amd-mp2: Unregister callback on adapter add failure
    
    commit 82048795242f04275a3f49ffc66ad851b6120954 upstream.
    
    amd_mp2_register_cb() stores the platform I2C context in the MP2 PCI
    driver's callback table before the adapter is registered. If
    i2c_add_adapter() fails, probe returns and devres frees the context,
    but the PCI driver can still dereference the stale pointer from its IRQ
    and system-sleep callbacks.
    
    Unregister the callback before returning the adapter registration error.
    
    Fixes: 529766e0a011 ("i2c: Add drivers for the AMD PCIe MP2 I2C controller")
    Co-developed-by: Ijae Kim <[email protected]>
    Signed-off-by: Ijae Kim <[email protected]>
    Signed-off-by: Myeonghun Pak <[email protected]>
    Cc: <[email protected]> # v5.2+
    Signed-off-by: Andi Shyti <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

i2c: imx: Cancel hrtimer before clearing slave pointer [+ + +]
Author: Liem <[email protected]>
Date:   Mon Jun 29 10:38:29 2026 +0800

    i2c: imx: Cancel hrtimer before clearing slave pointer
    
    commit 6ac7702b6cc2b94aaed9ef2d95bfbefcdc90061f upstream.
    
    In i2c_imx_unreg_slave(), the slave pointer is set to NULL after
    disabling interrupts.  However, a pending interrupt might already
    have started the hrtimer (i2c_imx_slave_timeout) before the pointer
    was cleared.  If the hrtimer fires after i2c_imx->slave is set to
    NULL, the timer callback i2c_imx_slave_finish_op() will call
    i2c_imx_slave_event() with a NULL slave pointer, which results in a
    use-after-free / NULL pointer dereference.
    
    Fix by canceling the hrtimer and waiting for it to complete after
    disabling interrupts, before clearing the slave pointer.
    
    Fixes: f7414cd6923f ("i2c: imx: support slave mode for imx I2C driver")
    Signed-off-by: Liem <[email protected]>
    Cc: <[email protected]> # v5.11+
    Acked-by: Carlos Song <[email protected]>
    Reviewed-by: Frank Li <[email protected]>
    Signed-off-by: Andi Shyti <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

i2c: imx: Fix slave registration race and error handling [+ + +]
Author: Liem <[email protected]>
Date:   Mon Jun 29 10:38:28 2026 +0800

    i2c: imx: Fix slave registration race and error handling
    
    commit d64ec362c369bbc33833f7936d5f3a706b0d5c45 upstream.
    
    In i2c_imx_reg_slave(), the slave pointer was assigned before
    pm_runtime_resume_and_get().  If pm_runtime_resume_and_get() failed,
    the error path returned without clearing i2c_imx->slave, leaving it
    non-NULL and causing all subsequent registration attempts to fail
    with -EBUSY.
    
    Additionally, because this driver uses a shared IRQ, the interrupt
    handler i2c_imx_isr() can execute concurrently and, after acquiring
    slave_lock, dereference i2c_imx->slave.  The previous fix attempt
    added a lockless i2c_imx->slave = NULL on the error path, but that
    could race with the ISR under the lock and still cause a NULL pointer
    dereference.
    
    Fix both issues by deferring the assignment of i2c_imx->slave and
    i2c_imx->last_slave_event to after a successful resume, and by
    performing the assignment inside the slave_lock critical section.
    This guarantees that the slave pointer is never left stale on the
    error path and is always valid when observed by the interrupt handler.
    
    Fixes: f7414cd6923f ("i2c: imx: support slave mode for imx I2C driver")
    Signed-off-by: Liem <[email protected]>
    Cc: <[email protected]> # v5.11+
    Reviewed-by: Frank Li <[email protected]>
    Acked-by: Carlos Song <[email protected]>
    Signed-off-by: Andi Shyti <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

i2c: imx: mark I2C adapter when hardware is powered down [+ + +]
Author: Carlos Song <[email protected]>
Date:   Mon May 25 11:04:00 2026 +0800

    i2c: imx: mark I2C adapter when hardware is powered down
    
    commit 00d86dd5c2034e0e139e4806137b3b43e07ddd83 upstream.
    
    On some i.MX platforms, certain I2C client drivers keep a periodic
    workqueue which continues to trigger I2C transfers.
    
    During system suspend/resume, there exists a time window between:
      - suspend_noirq and the system entering suspend
      - the system starting to resume and resume_noirq
    
    In this window, the I2C controller resources such as clock and pinctrl
    may already be disabled or not yet restored.
    
    If a workqueue triggers an I2C transfer in this period, the driver
    attempts to access I2C registers while the hardware resources are
    unavailable, which may lead to system hang.
    
    Mark the I2C adapter as suspended during noirq suspend and block new
    transfers until resume, ensuring that I2C transfers are only issued
    when hardware resources are available.
    
    Fixes: 358025ac091e ("i2c: imx: make controller available until system suspend_noirq() and from resume_noirq()")
    Signed-off-by: Carlos Song <[email protected]>
    Cc: <[email protected]> # v6.14+
    Reviewed-by: Frank Li <[email protected]>
    Acked-by: Oleksij Rempel <[email protected]>
    Signed-off-by: Andi Shyti <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

i2c: iproc: reset bus after timeout if START_BUSY is stuck [+ + +]
Author: Jonas Gorski <[email protected]>
Date:   Fri Jul 17 10:55:07 2026 +0200

    i2c: iproc: reset bus after timeout if START_BUSY is stuck
    
    commit 98f2e9e6d6f91a6abb43f166b244b428ba85fa2b upstream.
    
    If a transaction times out, the START_BUSY signal can stay up, and
    subsequent transactaction attempts will fail as the bus is still
    considered busy.
    
    I can easily trigger this by attempting to read from an address with no
    device, e.g. when running i2cdetect. After the first read times out, all
    subsequent read attempts return busy.
    
    To get to a working state again, the controller needs to be reset to
    clear the START_BUSY signal. So check for START_BUSY still asserted on a
    timeout, and do reset in case it is,
    
    This is also done by the original non-upstream iproc-smbus driver
    implementation [1].
    
    Works around situations like:
    
        bcm-iproc-2c 1803b000.i2c: transaction timed out
        bcm-iproc-2c 1803b000.i2c: bus is busy
        bcm-iproc-2c 1803b000.i2c: bus is busy
        bcm-iproc-2c 1803b000.i2c: bus is busy
        bcm-iproc-2c 1803b000.i2c: bus is busy
        bcm-iproc-2c 1803b000.i2c: bus is busy
        ...
    
    where the bus never recovers after a timeout.
    
    [1] https://github.com/opencomputeproject/onie/blob/master/patches/kernel/3.2.69/driver-iproc-smbus.patch
    
    Fixes: e6e5dd3566e0 ("i2c: iproc: Add Broadcom iProc I2C Driver")
    Signed-off-by: Jonas Gorski <[email protected]>
    Cc: <[email protected]> # v4.0+
    Acked-by: Ray Jui <[email protected]>
    Signed-off-by: Andi Shyti <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

i2c: jz4780: Cache host clock rate at probe to prevent CCF prepare_lock deadlock [+ + +]
Author: H. Nikolaus Schaller <[email protected]>
Date:   Sun Jul 19 22:19:43 2026 +0200

    i2c: jz4780: Cache host clock rate at probe to prevent CCF prepare_lock deadlock
    
    commit d99607c888f26e8a4e9fe9772860cef4aff86bb4 upstream.
    
    Fix a severe AB/BA deadlock between the Common Clock Framework (CCF)
    and the I2C adapter lock, which triggers when an I2C-controlled clock
    generator client (like the Si5351) is registered or modified under the CCF.
    
    During an i2c client clock (generator) frequency change, the CCF acquires its global
    'prepare_lock' mutex and the driver calls i2c_transfer() to update the client's
    chip registers, stalling for the adapter's I2C bus lock.
    
    Concurrently, an independent, parallel transfer on the same bus (e.g., a GPIO
    expander handling LEDs) can hold the I2C adapter lock. Inside this parallel
    transfer path, jz4780_i2c_set_speed() calls clk_get_rate() on the host
    controller's input clock to calculate bus timings. This call attempts to acquire
    the blocked CCF 'prepare_lock', creating a circular dependency that freezes
    the system.
    
    The jz4780 host controller clock itself is static and never changes at runtime.
    
    However, calling clk_get_rate() inside the active transfer path introduces
    an unnecessary dependency on the CCF internal locks.
    
    Eliminate this synchronous clk_get_rate() call from the active transfer
    path by caching the static host peripheral clock rate once - inside the private
    jz4780_i2c structure during jz4780_i2c_probe(). Update jz4780_i2c_set_speed()
    to use this cached value, safely decoupling active I2C transactions from the
    CCF internal locks without any risk of stale timings.
    
    Assisted-by web based Google AI (pinpointing the bug and writing the message).
    
    Fixes: ba92222ed63a12 ("i2c: jz4780: Add i2c bus controller driver for Ingenic JZ4780")
    Signed-off-by: H. Nikolaus Schaller <[email protected]>
    Cc: <[email protected]> # v4.1+
    Signed-off-by: Andi Shyti <[email protected]>
    Link: https://lore.kernel.org/r/2db6fd233aceb7238474e4833f4d25ca681c3ffb.1784492382.git.hns@goldelico.com
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

i2c: qcom-cci: drop custom suspend/resume and rely on runtime PM helpers [+ + +]
Author: Wenmeng Liu <[email protected]>
Date:   Thu Jun 25 17:42:45 2026 +0800

    i2c: qcom-cci: drop custom suspend/resume and rely on runtime PM helpers
    
    commit b08c9857aa1f5f3a81d375d6d4bb1d8b92f22ebc upstream.
    
    cci_resume() unconditionally calls cci_resume_runtime() regardless of
    the runtime PM state.
    
    If the device is already runtime-suspended before system suspend,
    the clock is re-enabled while runtime_status remains RPM_SUSPENDED.
    As a result, pm_request_autosuspend() does not arm the timer,
    leaving the clock permanently enabled.
    
    Fixes: e517526195de ("i2c: Add Qualcomm CCI I2C driver")
    Signed-off-by: Wenmeng Liu <[email protected]>
    Cc: <[email protected]> # v5.8+
    Reviewed-by: Vladimir Zapolskiy <[email protected]>
    Reviewed-by: Konrad Dybcio <[email protected]>
    Reviewed-by: Loic Poulain <[email protected]>
    Signed-off-by: Andi Shyti <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

i2c: spacemit: request IRQ after controller initialization [+ + +]
Author: Linmao Li <[email protected]>
Date:   Thu Jul 23 10:11:40 2026 +0800

    i2c: spacemit: request IRQ after controller initialization
    
    commit cdac670237258c8ca063aa8a16998f680d81b80d upstream.
    
    spacemit_i2c_probe() requests the IRQ before it enables the clocks, resets
    the controller and runs init_completion(). If an interrupt is already
    pending, the handler runs too early: it reads registers while the clocks
    are still off and calls complete() on an uninitialized completion. Request
    the IRQ after the controller and completion are initialized, but still
    before the adapter is registered.
    
    Fixes: 5ea558473fa3 ("i2c: spacemit: add support for SpacemiT K1 SoC")
    Signed-off-by: Linmao Li <[email protected]>
    Cc: <[email protected]> # v6.15+
    Reviewed-by: Troy Mitchell <[email protected]>
    Reviewed-by: Alex Elder <[email protected]>
    Signed-off-by: Andi Shyti <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ice: fix memory leak in ice_lbtest_prepare_rings() [+ + +]
Author: Dawei Feng <[email protected]>
Date:   Tue Jun 16 23:57:42 2026 +0800

    ice: fix memory leak in ice_lbtest_prepare_rings()
    
    commit 3a9de5590da4ffd9e9c541c4c4d492aa2b54cf6e upstream.
    
    ice_lbtest_prepare_rings() frees Rx rings only when
    ice_vsi_start_all_rx_rings() fails. If ice_vsi_setup_rx_rings() fails
    after allocating some descriptors, or if ice_vsi_cfg_lan() fails after
    the Rx rings were prepared, the function reaches the Tx cleanup path
    without releasing the initialized Rx resources.
    
    Fix this by adding separate unwind paths for Rx setup failure and LAN
    configuration failure. The Rx setup failure path releases the partially
    prepared Rx rings before freeing Tx rings, while later failures first
    undo the LAN Tx configuration and then release the Rx rings in reverse
    setup order.
    
    The bug was first flagged by an experimental analysis tool we are
    developing for kernel memory-management bugs while analyzing
    v6.13-rc1. The tool is still under development and is not yet publicly
    available. Manual inspection confirms that the bug is still
    present in v7.1-rc7.
    
    An x86_64 allyesconfig build showed no new warnings. As we do not have an
    Intel E800 Series adapter available to run the ethtool offline loopback
    selftest, no runtime testing was able to be performed.
    
    Fixes: 0e674aeb0b77 ("ice: Add handler for ethtool selftest")
    Cc: [email protected]
    Signed-off-by: Dawei Feng <[email protected]>
    Reviewed-by: Jacob Keller <[email protected]>
    Tested-by: Rinitha S <[email protected]> (A Contingent worker at Intel)
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ice: fix VF interrupts cleanup [+ + +]
Author: Dawid Osuchowski <[email protected]>
Date:   Thu May 14 18:35:55 2026 +0200

    ice: fix VF interrupts cleanup
    
    commit fb096882095e5a8d6b5159e43793d4a38a0c5b1f upstream.
    
    When a virtual function sends an IRQ map command, the PF will set up
    interrupts according to that request. However, because these interrupts are
    never reset, the next time Virtual Function initializes, the interrupts are
    still enabled for a given VF, which leads to performance degradation in
    certain cases due to interrupts being unexpectedly enabled and thus causing
    interrupt floods.
    
    Cc: [email protected]
    Fixes: 1071a8358a28 ("ice: Implement virtchnl commands for AVF support")
    Suggested-by: Vladimir Medvedkin <[email protected]>
    Reviewed-by: Aleksandr Loktionov <[email protected]>
    Signed-off-by: Dawid Osuchowski <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Tested-by: Patryk Holda <[email protected]>
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ice: suppress DPLL errors during reset recovery [+ + +]
Author: Przemyslaw Korba <[email protected]>
Date:   Wed May 20 13:50:06 2026 +0200

    ice: suppress DPLL errors during reset recovery
    
    [ Upstream commit b00be7c6b4bd7da3d510753b27ff6cb7ec647d07 ]
    
    During reset recovery, the admin queue returns EBUSY which is expected
    behavior. However, the DPLL subsystem was logging these as errors and
    incrementing the error counter, potentially leading to unnecessary
    warnings and even disabling the DPLL periodic worker if the threshold
    was reached.
    
    Suppress error logging and error counter increments when the admin
    queue returns EBUSY, as this is expected during reset recovery and
    not a real failure condition.
    
    test case:
    - ethtool --reset eth3 irq-shared dma-shared filter-shared offload-shared
    mac-shared phy-shared ram-shared
    - observe if dmesg EBUSY errors are gone
    
    Fixes: d7999f5ea64b ("ice: implement dpll interface to control cgu")
    Signed-off-by: Przemyslaw Korba <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Tested-by: Rinitha S <[email protected]> (A Contingent worker at Intel)
    Reviewed-by: Aleksandr Loktionov <[email protected]>
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ice: wait for reset completion in ice_resume() [+ + +]
Author: Aaron Ma <[email protected]>
Date:   Wed Apr 29 11:48:49 2026 +0800

    ice: wait for reset completion in ice_resume()
    
    commit c2816d613f388814d27bc9fd6dbd931a88056e19 upstream.
    
    ice_resume() schedules an asynchronous PF reset and returns
    immediately. The reset runs later in ice_service_task(). If
    userspace tries to bring up the net device before the reset
    finishes, ice_open() fails with -EBUSY:
    
      ice_resume()
        ice_schedule_reset()          # sets ICE_PFR_REQ, returns
      ...
      ice_open()
        ice_is_reset_in_progress()    # ICE_PFR_REQ still set, -EBUSY
      ...
      ice_service_task()
        ice_do_reset()
          ice_rebuild()               # clears ICE_PFR_REQ, too late
    
    Reproduced on E800 series NICs during suspend/resume with irdma
    enabled, where the aux device probe widens the race window.
    
      ice 0000:81:00.0: can't open net device while reset is in progress
    
    Add a best-effort wait (10s timeout, matching ice_devlink_info_get())
    for the reset to complete before returning from ice_resume(). In
    practice the reset completes in ~300ms.
    
    Fixes: 769c500dcc1e ("ice: Add advanced power mgmt for WoL")
    Cc: [email protected]
    Reviewed-by: Kohei Enju <[email protected]>
    Reviewed-by: Aleksandr Loktionov <[email protected]>
    Reviewed-by: Przemek Kitszel <[email protected]>
    Signed-off-by: Aaron Ma <[email protected]>
    Tested-by: Alexander Nowlin <[email protected]>
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
idpf: adjust TxQ ring count minimum [+ + +]
Author: Joshua Hay <[email protected]>
Date:   Tue Jun 30 16:56:19 2026 -0700

    idpf: adjust TxQ ring count minimum
    
    [ Upstream commit bef152db47debcd14cbacefc5767f6f026c4bc89 ]
    
    Set the TxQ ring count minimum to 128 descriptors. Any lower than this,
    and the queue will stall and trigger Tx timeouts in flow based
    scheduling mode. This is because next_to_clean might never be updated.
    
    In flow based scheduling mode, next_to_clean is only updated after a
    descriptor completion is processed, i.e. after the RE bit is set in the
    last descriptor of a Tx packet. This will never happen with a ring size
    of 64 and an IDPF_TX_SPLITQ_RE_MIN_GAP of 64. No matter what the value
    of last_re is initialized/set to, the calculated gap will be at most 63
    and never trigger the RE bit.
    
    Even a ring size of 96 does not solve this. Because of how infrequent
    next_to_clean is updated and how small the ring is, IDPF_DESC_UNUSED
    will be much smaller on average. This increases the chance the queue
    will be stopped because a multi-descriptor packet, e.g. a large LSO
    packet, does not see enough resources on the ring. In this case, the
    queue will trigger the stop logic. The queue permanently stalls because
    there is no chance for a descriptor completion to update next_to_clean
    since it is dependent on a packet being sent.
    
    Fixes: 5f417d551324 ("idpf: replace flow scheduling buffer ring with buffer pool")
    Signed-off-by: Joshua Hay <[email protected]>
    Reviewed-by: Aleksandr Loktionov <[email protected]>
    Tested-by: Samuel Salin <[email protected]>
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

idpf: Fix mailbox IRQ name leak on request failure [+ + +]
Author: Yuho Choi <[email protected]>
Date:   Fri Jul 3 01:03:32 2026 -0400

    idpf: Fix mailbox IRQ name leak on request failure
    
    [ Upstream commit 9bff30482c10f70d9e56c0633a6616e07140e217 ]
    
    idpf_mb_intr_req_irq() allocates the mailbox IRQ name before calling
    request_irq(). On success, the name is released later through
    kfree(free_irq()), but request_irq() failure returns without freeing it.
    
    Free the allocated name on the request_irq() failure path.
    
    Fixes: 4930fbf419a7 ("idpf: add core init and interrupt request")
    Signed-off-by: Yuho Choi <[email protected]>
    Reviewed-by: Aleksandr Loktionov <[email protected]>
    Tested-by: Samuel Salin <[email protected]>
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
igbvf: Fix leak in TX DMA error cleanup [+ + +]
Author: Matt Vollrath <[email protected]>
Date:   Thu Apr 16 23:34:52 2026 -0400

    igbvf: Fix leak in TX DMA error cleanup
    
    commit 0565052b7e2f436b7f1541f4849da96dc0aa7a0e upstream.
    
    If an error is encountered while mapping TX buffers, the driver should
    unmap any buffers already mapped for that skb.
    
    Because count is incremented before each frag mapping, it will always
    match the correct number of unmappings needed when dma_error is reached.
    Decrementing count before the while loop in dma_error causes an
    off-by-one error. If any mapping was successful before an unsuccessful
    mapping, exactly one DMA mapping (the head) would leak.
    
    This bug was introduced by a 2010 fix for an endless loop in dma_error.
    All other affected drivers have already been fixed.
    
    Fixes: c1fa347f20f1 ("e1000/e1000e/igb/igbvf/ixgb/ixgbe: Fix tests of unsigned in *_tx_map()")
    Cc: [email protected]
    Assisted-by: Claude:claude-4-7-opus
    Signed-off-by: Matt Vollrath <[email protected]>
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
igc: remove napi_synchronize() in igc_down() [+ + +]
Author: David Carlier <[email protected]>
Date:   Sun Jul 12 14:22:42 2026 +0100

    igc: remove napi_synchronize() in igc_down()
    
    commit 5ffab5b9589c50e4cfc0cf36ffd76c89422d4019 upstream.
    
    When an AF_XDP zero-copy application is killed abruptly, the XSK pool is
    torn down but NAPI keeps polling. igc_clean_rx_irq_zc() then returns the
    full budget on every poll, so napi_complete_done() never clears
    NAPI_STATE_SCHED.
    
    igc_down() calls napi_synchronize() before napi_disable(), so it spins
    forever waiting for that bit and the interface never goes down. Drop the
    napi_synchronize() and let napi_disable() do the job -- it sets
    NAPI_STATE_DISABLE, which forces the stuck poll to complete. Reorder it
    ahead of igc_set_queue_napi() so the NAPI mapping is cleared only after
    polling has stopped, matching the recent igb fix b1e067240379.
    
    Fixes: fc9df2a0b520 ("igc: Enable RX via AF_XDP zero-copy")
    Suggested-by: Maciej Fijalkowski <[email protected]>
    Cc: [email protected]
    Signed-off-by: David Carlier <[email protected]>
    Reviewed-by: Maciej Fijalkowski <[email protected]>
    Reviewed-by: Dima Ruinskiy <[email protected]>
    Tested-by: Moriya Kadosh <[email protected]>
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
io_uring/net: initialize mshot_len for send [+ + +]
Author: Jens Axboe <[email protected]>
Date:   Sun Jul 26 08:12:38 2026 -0600

    io_uring/net: initialize mshot_len for send
    
    commit c77ffbc980efb337fd750c337d8157d532ea14e5 upstream.
    
    Commit:
    
    6a8afb9fff64 ("io_uring/net: allow multishot receive per-invocation cap")
    
    changed how io_mshot_prep_retry() set sr->len, and added the same
    initialization in io_mshot_prep_retry(). But it neglected to touch the
    send path, which may also uses the mshot retry path. Ensure that
    sr->mshot_len always gets initialized correctly.
    
    Fixes: 6a8afb9fff64 ("io_uring/net: allow multishot receive per-invocation cap")
    Cc: [email protected]
    Reported-by: Sung Keum <[email protected]>
    Reviewed-by: Gabriel Krisman Bertazi <[email protected]>
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
iomap: add a separate bio_set for iomap_split_ioend [+ + +]
Author: Christoph Hellwig <[email protected]>
Date:   Mon Jun 29 14:52:29 2026 +0200

    iomap: add a separate bio_set for iomap_split_ioend
    
    [ Upstream commit c679ce3be6cb63763d68ab9b5d9d73ddc0a40762 ]
    
    iomap_split_ioend can split bios that already come from
    iomap_ioend_bioset and thus deadlock when the bioset is exhausted.
    
    Add a separate bio_set to avoid this deadlock.
    
    Christian Brauner <[email protected]> says:
    Mark iomap_ioend_split_bioset static as it is only used in ioend.c,
    fixing the sparse warning reported by the kernel test robot.
    
    Fixes: 5fcbd555d483 ("iomap: split bios to zone append limits in the submission handlers")
    Signed-off-by: Christoph Hellwig <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Christian Brauner (Amutable) <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
iommu/arm-smmu-v3-iommufd: Require exactly one Stream ID for a vDEVICE [+ + +]
Author: Nicolin Chen <[email protected]>
Date:   Sun Jul 5 22:36:11 2026 -0700

    iommu/arm-smmu-v3-iommufd: Require exactly one Stream ID for a vDEVICE
    
    [ Upstream commit c3b8ee84a965058b41275069d4696f37a8b14bf6 ]
    
    arm_vsmmu_vsid_to_sid() maps a guest's vSID to a single physical Stream ID
    taken from master->streams[0], assuming a device has exactly one stream. A
    device with several streams gets only its first one mapped, so a guest vSID
    invalidation cannot reach the others' ATC and IOTLB entries; a device with
    none makes master->streams a ZERO_SIZE_PTR, read out of bounds.
    
    Add an arm_vsmmu_vdevice_init() op to reject the vDEVICE with -EOPNOTSUPP
    when master->num_streams is not one, rather than mapping it silently.
    
    Fixes: d68beb276ba26 ("iommu/arm-smmu-v3: Support IOMMU_HWPT_INVALIDATE using a VIOMMU object")
    Link: https://patch.msgid.link/r/b15f2b73520f389f3f57881da2f040e7bdc18876.1783311134.git.nicolinc@nvidia.com
    Reviewed-by: Kevin Tian <[email protected]>
    Assisted-by: Claude:claude-opus-4-8
    Reviewed-by: Pranjal Shrivastava <[email protected]>
    Signed-off-by: Nicolin Chen <[email protected]>
    Signed-off-by: Jason Gunthorpe <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
iommu/iommufd: Fix IOPF group ownership UAF [+ + +]
Author: Peiyang He <[email protected]>
Date:   Mon Jul 20 16:50:16 2026 +0800

    iommu/iommufd: Fix IOPF group ownership UAF
    
    commit 738e6f32e61d80b554e37015ecb7bc620b88001c upstream.
    
    iopf_group_alloc() links each last-page IOPF group into the generic IOPF
    pending list before invoking the domain fault handler.
    iommufd_fault_iopf_handler() also queued an accepted group in the
    IOMMUFD deliver list without removing it from the generic pending list.
    
    When detach or HWPT replacement drops the device's IOPF reference count
    to zero, an IOMMU driver may call iopf_queue_remove_device(). That
    function responds to and frees groups through the generic pending list
    without removing the same groups from IOMMUFD's deliver list or response
    xarray. A later read, response, or cleanup can then access the freed
    group and cause a UAF.
    
    Fix this by dequeuing an accepted group from the generic pending list
    before IOMMUFD queues it for userspace response.
    Make iopf_group_response() send a response regardless of pending-list
    membership, so the dequeued group can still be completed by IOMMUFD.
    
    Link: https://patch.msgid.link/r/3CFD314D0FE4D7EC+20260720085017.3998878-2-peiyang_he@smail.nju.edu.cn
    Closes: https://lore.kernel.org/all/B4F28798E2E784CA+d29f723c-b2b5-4b67-8d1c-4f7b9b0b27cb@smail.nju.edu.cn/
    Fixes: 34765cbc679c ("iommufd: Associate fault object with iommufd_hw_pgtable")
    Cc: [email protected]
    Tested-by: Peiyang He <[email protected]>
    Assisted-by: Codex:gpt-5.6-sol
    Signed-off-by: Peiyang He <[email protected]>
    Reviewed-by: Kevin Tian <[email protected]>
    Signed-off-by: Jason Gunthorpe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
iommufd/viommu: Publish a vDEVICE only after vdevice_init() succeeds [+ + +]
Author: Nicolin Chen <[email protected]>
Date:   Sun Jul 5 22:36:10 2026 -0700

    iommufd/viommu: Publish a vDEVICE only after vdevice_init() succeeds
    
    commit 9be311cfbe6154da146a7408e0d5e518a9321ed3 upstream.
    
    iommufd_vdevice_alloc_ioctl() adds the vDEVICE to the viommu->vdevs xarray
    with xa_cmpxchg() before the driver's vdevice_init() op runs. That op is
    where a driver validates the device and may reject it, but the xarray entry
    is already live by then: a concurrent IOMMU_HWPT_INVALIDATE can look it up
    with iommufd_viommu_find_dev() and run the driver invalidation path against
    a device that vdevice_init() would have refused.
    
    Reserve the index with xa_insert(): it stores a zero entry that reads back
    as NULL, and returns -EBUSY on a duplicate virt_id. Run vdevice_init() and
    store the vDEVICE pointer only once it succeeds. A failed vdevice_init()
    releases the reservation, so lookups observe the vDEVICE only after it is
    fully initialized and accepted.
    
    Fixes: ed42eee797ff3 ("iommufd/viommu: Add driver-defined vDEVICE support")
    Link: https://patch.msgid.link/r/1e05999347f4bf583edbc6a1312c857d5548708c.1783311134.git.nicolinc@nvidia.com
    Cc: [email protected]
    Reviewed-by: Kevin Tian <[email protected]>
    Assisted-by: Claude:claude-opus-4-8
    Reviewed-by: Pranjal Shrivastava <[email protected]>
    Signed-off-by: Nicolin Chen <[email protected]>
    Signed-off-by: Jason Gunthorpe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

iommufd/viommu: Release the igroup lock on the vdevice_size error path [+ + +]
Author: Nicolin Chen <[email protected]>
Date:   Sun Jul 5 22:36:09 2026 -0700

    iommufd/viommu: Release the igroup lock on the vdevice_size error path
    
    commit 339bd11591593ab7ce88136ab7fd01ef3813b724 upstream.
    
    iommufd_vdevice_alloc_ioctl() takes idev->igroup->lock, then validates the
    driver's vdevice_size against the core structure size with a WARN_ON_ONCE.
    On failure that guard jumps to out_put_idev, below out_unlock_igroup, so it
    skips the mutex_unlock(), leaving the igroup lock held and deadlocking the
    next vDEVICE operation on that group.
    
    Jump to out_unlock_igroup instead.
    
    Fixes: ed42eee797ff3 ("iommufd/viommu: Add driver-defined vDEVICE support")
    Link: https://patch.msgid.link/r/e903f775d491296a525097e2a90b3eb6a47cf2ef.1783311134.git.nicolinc@nvidia.com
    Cc: [email protected]
    Reviewed-by: Kevin Tian <[email protected]>
    Assisted-by: Claude:claude-opus-4-8
    Reviewed-by: Pranjal Shrivastava <[email protected]>
    Signed-off-by: Nicolin Chen <[email protected]>
    Signed-off-by: Jason Gunthorpe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
iommufd: Fix wrong hwpt passed to iommufd_auto_response_faults on replace [+ + +]
Author: Peiyang He <[email protected]>
Date:   Fri Jul 10 20:29:52 2026 +0800

    iommufd: Fix wrong hwpt passed to iommufd_auto_response_faults on replace
    
    commit ba5c0f28a26e7d9be1e0997f8920dd638e2782fd upstream.
    
    iommufd_hwpt_replace_device() calls:
    
            iommufd_auto_response_faults(hwpt, old_handle);
    
    passing the *new* hwpt together with the handle of
    the device's *old* domain. This should be a parameter mismatch:
    
    1. Semantically, iommufd_auto_response_faults(x, handle) scans
       x->fault's deliver list and response xarray for groups matching
       "handle". A group is queued under the hwpt that was attached at
       fault-delivery time. old_handle is fetched *before* the domain switch,
       so its group lives on old->fault, not on the new hwpt->fault.
    
    2. Historically, the first argument was "old". The routine was
       introduced by commit b7d8833677ba ("iommufd: Fault-capable hwpt
       attach/detach/replace") as __fault_domain_replace_dev() in
       fault.c, correctly calling iommufd_auto_response_faults(old, curr).
       Commit fb21b1568ada ("iommufd: Make attach_handle generic than
       fault specific") moved this into iommufd_hwpt_replace_device() in
       device.c and swapped it to "hwpt". This should be a refactor regression,
       not an intentional change.
    
    Fix this by passing "old" instead.
    
    Link: https://patch.msgid.link/r/9D652384339C69D5+20260710122952.885325-1-peiyang_he@smail.nju.edu.cn
    Fixes: fb21b1568ada ("iommufd: Make attach_handle generic than fault specific")
    Cc: [email protected]
    Signed-off-by: Peiyang He <[email protected]>
    Reviewed-by: Kevin Tian <[email protected]>
    Signed-off-by: Jason Gunthorpe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ipvs: do not mangle ICMP replies for non-first fragments [+ + +]
Author: Julian Anastasov <[email protected]>
Date:   Wed Jul 22 13:15:17 2026 +0300

    ipvs: do not mangle ICMP replies for non-first fragments
    
    [ Upstream commit 342e24a339b90e8e339a0f8c151ca479b8565661 ]
    
    Sashiko warns that ip_vs_nat_icmp() unconditionally mangles the
    payload for embedded non-first IPv4 fragments. The problem is
    in the very old inverted pp->dont_defrag check which should not
    continue when embedded is a non-first TCP/UDP/SCTP fragment.
    
    Check for embedded non-first fragment is also missing from
    ip_vs_out_icmp_v6(), it is needed before any connection
    lookups that expect ports after the network headers.
    
    Drop the blocking code from ip_vs_in_icmp_v6() which prevents
    ICMPv6 from local clients to use non-MASQ forwarding.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Link: https://sashiko.dev/#/patchset/20260720201122.79882-1-ja%40ssi.bg
    Signed-off-by: Julian Anastasov <[email protected]>
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ipvs: do not propagate one-packet flag to synced conns [+ + +]
Author: Zhiling Zou <[email protected]>
Date:   Mon Jul 13 19:52:32 2026 +0800

    ipvs: do not propagate one-packet flag to synced conns
    
    commit a63d2dbaeb50a85d4c976b15a36e6b0c7113db5b upstream.
    
    Synced connections can be created before their destination exists. When
    the destination is later added, ip_vs_bind_dest() copies connection flags
    from the destination into cp->flags.
    
    IP_VS_CONN_F_ONE_PACKET connections are not synced. If a synced
    connection inherits IP_VS_CONN_F_ONE_PACKET while it is already hashed,
    expiry can treat it as a one-packet connection and skip unlinking the
    existing conn_tab node, leaving stale hash nodes pointing at a freed
    struct ip_vs_conn.
    
    Drop IP_VS_CONN_F_ONE_PACKET from destination flags when binding synced
    connections.
    
    Fixes: 26ec037f9841 ("IPVS: one-packet scheduling")
    Cc: [email protected]
    Reported-by: Yuan Tan <[email protected]>
    Reported-by: Yifan Wu <[email protected]>
    Reported-by: Juefei Pu <[email protected]>
    Reported-by: Xin Liu <[email protected]>
    Suggested-by: Julian Anastasov <[email protected]>
    Signed-off-by: Zhiling Zou <[email protected]>
    Signed-off-by: Ren Wei <[email protected]>
    Acked-by: Julian Anastasov <[email protected]>
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ipvs: fix places with wrong packet offsets [+ + +]
Author: Julian Anastasov <[email protected]>
Date:   Wed Jul 22 13:15:16 2026 +0300

    ipvs: fix places with wrong packet offsets
    
    [ Upstream commit 15cab31a3730e05f0767b922a7450e5d784b2607 ]
    
    The offsets we use to packet headers and payloads should be
    based on skb->data. We even already respect non-zero
    network offset in ip_vs_fill_iph_skb() but some places
    do it wrongly and support only zero offset which is expected
    for the IP layer where IPVS has hooks.
    
    Change all places that instead of skb->data use offsets based
    on the network header (skb_network_header, ip_hdr, etc) because
    this doubles the network offset as noted by Sashiko.
    
    For ip_vs_nat_icmp_v6() we can even rely on the IPv6 header
    parsing done by the caller.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Link: https://sashiko.dev/#/patchset/20260710143733.29741-2-fw%40strlen.de
    Signed-off-by: Julian Anastasov <[email protected]>
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ipvs: fix the checksum validations [+ + +]
Author: Julian Anastasov <[email protected]>
Date:   Wed Jul 22 13:15:15 2026 +0300

    ipvs: fix the checksum validations
    
    [ Upstream commit e876b75b9020a97bbdc79721e7fc749024891c65 ]
    
    ip_vs_in_icmp_v6() is missing checksum validation for ICMPv6
    packets from clients. In fact, as for TCP/UDP we should
    validate the checksum for ICMP packets only when we
    mangle the packets on MASQ or on reply for tunnel.
    
    Also, Sashiko points out that handle_response_icmp() being
    common for IPv4 and IPv6 is missing the pseudo-header
    calculation while validating ICMPv6 messages from real
    servers which is a problem if checksum is not validated
    by the hardware.
    
    Fix the problems by creating ip_vs_checksum_common_check()
    helper and use it for TCP/UDP/ICMP both for IPv4 and IPv6.
    Rely on the nf_checksum() for validating the ICMP messages
    but use it also for TCP and UDP.
    
    Use correct IP offset for IP_VS_DBG_RL_PKT for TCP/UDP/SCTP.
    
    IPVS packets (TCP/UDP/SCTP/ICMP) do not need checksum
    validation on LOCAL_OUT (local clients or local real
    servers) and on FORWARD (traffic from servers on LAN).
    Do it only on LOCAL_IN, in case nf_checksum() is not
    called on PRE_ROUTING.
    
    Also, ip_vs_checksum_complete() can be marked static.
    
    Fixes: 2a3b791e6e11 ("IPVS: Add/adjust Netfilter hook functions and helpers for v6")
    Link: https://sashiko.dev/#/patchset/20260708180315.77413-1-ja%40ssi.bg
    Signed-off-by: Julian Anastasov <[email protected]>
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
keys: fix out-of-bounds read in keyring_get_key_chunk() [+ + +]
Author: Michael Bommarito <[email protected]>
Date:   Sun Jul 19 12:15:03 2026 -0400

    keys: fix out-of-bounds read in keyring_get_key_chunk()
    
    [ Upstream commit 63918731f9ae25b5deb022f118e941e6dddfcef4 ]
    
    For description-level chunks keyring_get_key_chunk() advances the read
    pointer by level * sizeof(long) past the inline prefix but only
    bounds-checks the prefix, so a long enough key description is read past
    its kmemdup(desc, desc_len + 1) allocation.  Compute the full byte
    offset and bounds-check the description against it before reading.
    
    The walk only reaches a description-level chunk when two keys collide
    through the hash, x, type and domain_tag chunks, so this is reached from
    an unprivileged add_key(2) with a crafted pair of same-type keys whose
    index hashes collide; KASAN reports a slab-out-of-bounds read.
    
    Fixes: f771fde82051 ("keys: Simplify key description management")
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: Michael Bommarito <[email protected]>
    Reviewed-by: Jarkko Sakkinen <[email protected]>
    Tested-by: Jarkko Sakkinen <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jarkko Sakkinen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

keys: make keyring key-chunk byte order agree with keyring_diff_objects() [+ + +]
Author: Michael Bommarito <[email protected]>
Date:   Sun Jul 19 12:15:04 2026 -0400

    keys: make keyring key-chunk byte order agree with keyring_diff_objects()
    
    [ Upstream commit 58565eef0f8d861aae92abfb7658458d661cee17 ]
    
    keyring_get_key_chunk() loads description bytes into the index chunk low
    address first, while keyring_diff_objects() numbers the first differing
    bit from the low end and folds the absolute byte index into the level
    without removing the inline-prefix offset the level already carries.
    The two disagree on byte order and bit position, so the array can be
    told two keys first differ at a bit that does not differ in the chunk
    the walker uses, letting crafted descriptions collide into one node.
    
    Load the chunk in the order keyring_diff_objects() assumes and drop the
    inline-prefix length when folding the byte index into the level.  This
    only changes the in-memory ordering used to place keys within a keyring;
    add, search and read of non-colliding keys are unaffected.
    
    Fixes: f771fde82051 ("keys: Simplify key description management")
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: Michael Bommarito <[email protected]>
    Reviewed-by: Jarkko Sakkinen <[email protected]>
    Tested-by: Jarkko Sakkinen <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jarkko Sakkinen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
KEYS: trusted: dcp: fix key_len validation and calc_blob_len() return type [+ + +]
Author: Fabrice Derepas <[email protected]>
Date:   Wed Jul 22 19:22:30 2026 +0300

    KEYS: trusted: dcp: fix key_len validation and calc_blob_len() return type
    
    [ Upstream commit 35d661c98fe4733490f20b4311616a3c2c30abc0 ]
    
    Two correctness and type-hygiene issues exist in the DCP trusted keys
    implementation.
    
    First, trusted_dcp_unseal() reads p->key_len from a user-supplied blob
    without checking if it exceeds MAX_KEY_SIZE.  If a crafted blob provides a
    payload_len larger than 128, the subsequent do_aead_crypto() call writes
    past the end of the p->key array into the adjacent p->blob buffer within
    the same struct trusted_key_payload -- the caller's own input, not
    unrelated kernel memory.  While not exploitable, this violates strict array
    bounds and triggers static analyzers.  Fix this by adding a validation
    check against MIN_KEY_SIZE and MAX_KEY_SIZE immediately after reading the
    length, matching the checks already done in trusted_core.c.
    
    Second, calc_blob_len() calculates a sum in size_t that truncates to
    unsigned int on 64-bit platforms.  Because the DCP hardware is only present
    on 32-bit i.MX SoC platforms, size_t and unsigned int are functionally
    equivalent in production, making this truncation harmless in practice.
    Nevertheless, updating the return type to size_t (and subsequently updating
    'blen' in the seal/unseal paths) resolves type-narrowing warnings and
    improves overall code hygiene.
    
    Fixes: 2e8a0f40a39c ("KEYS: trusted: Introduce NXP DCP-backed trusted keys")
    Signed-off-by: Fabrice Derepas <[email protected]>
    Reviewed-by: David Gstir <[email protected]>
    Reviewed-by: Richard Weinberger <[email protected]>
    Reviewed-by: Jarkko Sakkinen <[email protected]>
    Tested-by: Jarkko Sakkinen <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jarkko Sakkinen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ksmbd: fix use-after-free in __close_file_table_ids() [+ + +]
Author: Namjae Jeon <[email protected]>
Date:   Wed Jul 22 10:04:19 2026 +0900

    ksmbd: fix use-after-free in __close_file_table_ids()
    
    [ Upstream commit e7188199eff46a636f3436356f0aae039be6dd66 ]
    
    A ksmbd_file can remain alive after logical close while another session
    holds a temporary reference obtained through ksmbd_lookup_fd_inode().
    ksmbd_close_fd() currently marks the file closed and drops the idr-owned
    reference, but leaves the pointer published in the closing session's idr
    until the final reference is dropped.
    
    If the foreign holder performs the final ksmbd_fd_put(), __put_fd_final()
    supplies the foreign session's file table to __ksmbd_close_fd(). The object
    is then freed without being removed from its owner's idr, and the owner
    session later dereferences the stale pointer during file-table teardown.
    
    Remove the volatile id from the owner's idr while ksmbd_close_fd() still
    holds that table's lock, and clear volatile_id before dropping
    the idr-owned reference. A later foreign final put then only performs
    physical destruction and cannot remove the object from the wrong table.
    
    Fixes: 8510a043d334 ("ksmbd: increment reference count of parent fp")
    Reported-by: Yunseong Kim <[email protected]>
    Signed-off-by: Namjae Jeon <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ksmbd: reject repeated SMB2 NEGOTIATE requests [+ + +]
Author: Namjae Jeon <[email protected]>
Date:   Thu Jul 23 23:07:14 2026 +0900

    ksmbd: reject repeated SMB2 NEGOTIATE requests
    
    commit cb469993b3a61a72653770856d37af616d72d05f upstream.
    
    Unauthenticated client can send multiple successful SMB2 NEGOTIATE
    requests on one connection before SESSION_SETUP. While the connection is
    in KSMBD_SESS_NEED_SETUP, smb2_handle_negotiate() accepts another
    SMB3.1.1 NEGOTIATE and overwrites conn->preauth_info with a new allocation.
    Only the final allocation is freed when the connection is released, leaking
    one object for every additional successful request.
    
    A repeated SMB2 NEGOTIATE after a dialect has been selected is a protocol
    violation. MS-SMB2 section 3.3.5.4 requires the server to disconnect
    without replying in this case. Set the connection exiting when rejecting
    the request, in addition to suppressing the response.
    
    Reject SMB2 NEGOTIATE unless the connection is new or is waiting for the
    SMB2 NEGOTIATE that follows an SMB1 multi-protocol negotiate. Serialize
    both SMB1 and SMB2 negotiation paths under conn->srv_mutex, since they
    update connection-wide dialect and negotiation state.
    
    Move the locking contract to ksmbd_smb_negotiate_common(), where the state
    and dialect are selected, and add ksmbd_conn_new() for consistent state
    access.
    
    Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
    Cc: [email protected]
    Reported-by: Runa Takemoto <[email protected]>
    Signed-off-by: Namjae Jeon <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ksmbd: return success for deferred final close [+ + +]
Author: Namjae Jeon <[email protected]>
Date:   Sun Jun 21 19:41:08 2026 +0900

    ksmbd: return success for deferred final close
    
    [ Upstream commit c5db4de8988f1a621556ca5c4537f77b766ca07d ]
    
    ksmbd_close_fd() marks an open file as FP_CLOSED and drops the file table
    reference. If another in-flight request still holds a reference, the final
    close is deferred until that request drops its reference.
    
    The function currently returns -EINVAL in that deferred-final-close case
    because fp is cleared when the reference count does not reach zero.  That
    turns a valid close into STATUS_FILE_CLOSED.
    
    smb2.compound_find.compound_find_close sends QUERY_DIRECTORY and then
    closes the same directory handle before receiving the find response.
    The query holds a reference while it builds the response, so close must
    mark the handle closed and return success even though final teardown is
    delayed. Track whether the handle was successfully transitioned to
    FP_CLOSED and return success when only the final close is deferred.
    
    Signed-off-by: Namjae Jeon <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Stable-dep-of: e7188199eff4 ("ksmbd: fix use-after-free in __close_file_table_ids()")
    Signed-off-by: Sasha Levin <[email protected]>

 
kunit: tool: skip stty when stdin is not a tty [+ + +]
Author: Shuvam Pandey <[email protected]>
Date:   Fri Feb 27 18:16:36 2026 +0545

    kunit: tool: skip stty when stdin is not a tty
    
    [ Upstream commit e42c349f4cdfa43cb39a68c8f764f8cafc23a9a9 ]
    
    run_kernel() cleanup and signal_handler() invoke stty unconditionally.
    When stdin is not a tty (for example in CI or unit tests), this writes
    noise to stderr.
    
    Call stty only when stdin is a tty.
    
    Add regression tests for these paths:
    - run_kernel() with non-tty stdin
    - signal_handler() with non-tty stdin
    - signal_handler() with tty stdin
    
    Signed-off-by: Shuvam Pandey <[email protected]>
    Reviewed-by: David Gow <[email protected]>
    Signed-off-by: Shuah Khan <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

kunit: tool: Terminate kernel under test on SIGINT [+ + +]
Author: David Gow <[email protected]>
Date:   Sat Feb 28 18:07:22 2026 +0800

    kunit: tool: Terminate kernel under test on SIGINT
    
    [ Upstream commit 8f260b02eeeffbf2263c2b82b6e3e32fd73cde2b ]
    
    kunit.py will attempt to catch SIGINT / ^C in order to ensure the TTY isn't
    messed up, but never actually attempts to terminate the running kernel (be
    it UML or QEMU). This can lead to a bit of frustration if the kernel has
    crashed or hung.
    
    Terminate the kernel process in the signal handler, if it's running. This
    requires plumbing through the process handle in a few more places (and
    having some checks to see if the kernel is still running in places where it
    may have already been killed).
    
    Reported-by: Andy Shevchenko <[email protected]>
    Closes: https://lore.kernel.org/all/[email protected]/
    Signed-off-by: David Gow <[email protected]>
    Reviewed-by: Andy Shevchenko <[email protected]>
    Tested-by: Andy Shevchenko <[email protected]>
    Signed-off-by: Shuah Khan <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
KVM: arm64: Reject guest_memfd memslots when the VM has MTE [+ + +]
Author: Alexandru Elisei <[email protected]>
Date:   Wed Jul 22 10:03:54 2026 +0100

    KVM: arm64: Reject guest_memfd memslots when the VM has MTE
    
    [ Upstream commit 679d7201c1f09e37fa1c12ce28d84079c17fc87f ]
    
    The user cannot use MTE on VMAs created by mapping a guest_memfd file,
    as arch_calc_vm_flag_bits() does not set VM_MTE_ALLOWED.
    
    When creating a guest_memfd backed memslot,
    kvm_arch_prepare_memory_region() rejects the memslot if MTE is enabled for
    the VM and if guest_memfd has been mapped in a VMA that intersects the
    memslot.
    
    However, the documentation for KVM_SET_USER_MEMORY_REGION2 explicitly
    states that the only condition for userspace_addr is for it to be a legal
    userspace address, but the mapping is not required to be valid nor
    populated at memslot creation.
    
    If userspace sets userspace_addr to an address that hasn't been mapped, or
    if userspace_addr belongs to a VMA that isn't backed by the guest_memfd
    file, or if the VMA doesn't intersect the memslot, memslot creation is
    successful and KVM ends up with a VM with MTE and guest_memfd-backed
    memslots.
    
    The same happens if the order is reversed: when userspace enables MTE, KVM
    does not check if memslots backed by guest_memfd are already present.
    
    Fix both issues by rejecting guest_memfd-backed memslots when MTE is
    enabled, and by rejecting MTE when guest_memfd-backed memslots are already
    present.
    
    Fixes: 32e200bd6e44 ("KVM: arm64: Enable support for guest_memfd backed memory")
    Tested-by: Fuad Tabba <[email protected]>
    Reviewed-by: Fuad Tabba <[email protected]>
    Signed-off-by: Alexandru Elisei <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Marc Zyngier <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

KVM: s390: pci: Fix memory accounting for pinned/unpinned pages [+ + +]
Author: Farhan Ali <[email protected]>
Date:   Thu Jul 23 15:14:05 2026 -0700

    KVM: s390: pci: Fix memory accounting for pinned/unpinned pages
    
    commit 36f6999ecde3976731a8bfc0b8e667da6f593069 upstream.
    
    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: [email protected]
    Reviewed-by: Christian Borntraeger <[email protected]>
    Reviewed-by: Matthew Rosato <[email protected]>
    Signed-off-by: Farhan Ali <[email protected]>
    Tested-by: Matthew Rosato <[email protected]>
    [[email protected]: Fixed whitespace]
    Signed-off-by: Christian Borntraeger <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

KVM: s390: pci: Fix missing error codes and memory unaccounting [+ + +]
Author: Farhan Ali <[email protected]>
Date:   Thu Jul 23 15:14:06 2026 -0700

    KVM: s390: pci: Fix missing error codes and memory unaccounting
    
    commit f86842e4d6c482300f4567f492d512c9ccf5bc4f upstream.
    
    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: [email protected]
    Reviewed-by: Christian Borntraeger <[email protected]>
    Reviewed-by: Matthew Rosato <[email protected]>
    Signed-off-by: Farhan Ali <[email protected]>
    Tested-by: Matthew Rosato <[email protected]>
    Signed-off-by: Christian Borntraeger <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

KVM: s390: pci: Fix NULL dereference on AIBV allocation failure [+ + +]
Author: Farhan Ali <[email protected]>
Date:   Thu Jul 23 15:14:07 2026 -0700

    KVM: s390: pci: Fix NULL dereference on AIBV allocation failure
    
    commit 8bf09b9b7d3232806df95f409581f8a9fd99a3fa upstream.
    
    The airq_iv_create() can return NULL on failure, but the return value was
    never checked. If it fails, zdev->aibv will be NULL and fail when
    dereferenced in kvm_zpci_set_airq(). Add a NULL check and free the
    previously allocated AISB bit and zdev->aisb on failure.
    
    Fixes: 3c5a1b6f0a18 ("KVM: s390: pci: provide routines for enabling/disabling interrupt forwarding")
    Cc: [email protected]
    Reviewed-by: Christian Borntraeger <[email protected]>
    Reviewed-by: Matthew Rosato <[email protected]>
    Signed-off-by: Farhan Ali <[email protected]>
    Tested-by: Matthew Rosato <[email protected]>
    Signed-off-by: Christian Borntraeger <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

KVM: s390: pci: Reject adapter interrupt forwarding if already enabled [+ + +]
Author: Farhan Ali <[email protected]>
Date:   Thu Jul 23 15:14:04 2026 -0700

    KVM: s390: pci: Reject adapter interrupt forwarding if already enabled
    
    commit 8fa01be5a6149404adb82c0979a78f6347edd3ef upstream.
    
    The MPCIFC instruction doesn't allow registering adapter interrupts without
    first unregistering. So reject any request to enable interrupt forwarding
    if its already enabled for the zPCI device. This also fixes overwriting and
    thus leaking resources when the ioctl is called multiple times for the same
    device.
    
    Fixes: 3c5a1b6f0a18 ("KVM: s390: pci: provide routines for enabling/disabling interrupt forwarding")
    Cc: [email protected]
    Reviewed-by: Christian Borntraeger <[email protected]>
    Reviewed-by: Matthew Rosato <[email protected]>
    Signed-off-by: Farhan Ali <[email protected]>
    Tested-by: Matthew Rosato <[email protected]>
    Signed-off-by: Christian Borntraeger <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

KVM: s390: pci: Validate AIBV and AISB before pinning guest pages [+ + +]
Author: Farhan Ali <[email protected]>
Date:   Thu Jul 23 15:14:09 2026 -0700

    KVM: s390: pci: Validate AIBV and AISB before pinning guest pages
    
    commit 868d32ac72cba21c5c6d8a66a814b7c25a3a5c01 upstream.
    
    The AIBV holds one bit per MSI-X vector for a given function. The size of
    the bit vector is derived from the NOI and the AIBVO. If the size of the
    AIBV exceeds a single page boundary, then reject the request as we cannot
    safely pin the guest AIBV.
    
    Similarly reject the request if the AISB address is not 8-byte aligned as
    the architecture requires doubleword alignment for the summary bit address.
    Since the AISBO can address up to 64 bits, the size of the AISB can only be
    8 bytes for the function. This also ensures the AISB doesn't exceed a
    single page boundary.
    
    Fixes: 3c5a1b6f0a18 ("KVM: s390: pci: provide routines for enabling/disabling interrupt forwarding")
    Cc: [email protected]
    Reviewed-by: Christian Borntraeger <[email protected]>
    Reviewed-by: Matthew Rosato <[email protected]>
    Signed-off-by: Farhan Ali <[email protected]>
    Tested-by: Matthew Rosato <[email protected]>
    Signed-off-by: Christian Borntraeger <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

KVM: SVM: Update x2APIC MSR intercepts if AVIC is inhibited while L2 is active [+ + +]
Author: Sean Christopherson <[email protected]>
Date:   Fri Jul 10 09:20:51 2026 -0700

    KVM: SVM: Update x2APIC MSR intercepts if AVIC is inhibited while L2 is active
    
    commit 7d3aae206663c4e006b25a1c7a20a4029e67da76 upstream.
    
    Always update x2APIC MSR intercepts for L1 when AVIC is deactivated, even
    if L2 is active and KVM is using a separate MSR bitmap to run L2.  If AVIC
    is fully enabled prior to running L2, and is then inhibited while L2 is
    active (for a VM-scoped inhibit), then KVM will run L1 with AVIC disabled,
    but with x2APIC MSR intercepts disabled, i.e. will allow L1 to read most of
    the host's APIC state, send arbitrary interrupts, change task priority, and
    ultimately trivially DoS the host.
    
    E.g. sending a self-IPI in L1 on HYPERV_REENLIGHTENMENT_VECTOR, 0xee, with
    CONFIG_HYPERV=n in the host kernel as a "safe" PoC, yields:
    
      Spurious interrupt (vector 0xee) on CPU#425. Acked
    
    And hacking KVM to abuse kvm_set_posted_intr_wakeup_handler() to register a
    handler and WARN on POSTED_INTR_WAKEUP_VECTOR yields:
    
      ------------[ cut here ]------------
      WARNING: arch/x86/kvm/svm/svm.c:5594 at pi_wakeup_handler+0x9/0x10 [kvm_amd], CPU#156: nested_x2apic_t/316940
      CPU: 156 UID: 0 PID: 316940 Comm: nested_x2apic_t Tainted: G S   U
      Tainted: [S]=CPU_OUT_OF_SPEC, [U]=USER
      Hardware name: Google Astoria-Turin/astoria, BIOS 0.20260209.0-0 02/09/2026
      RIP: 0010:pi_wakeup_handler+0x9/0x10 [kvm_amd]
      Call Trace:
       <IRQ>
       sysvec_kvm_posted_intr_wakeup_ipi+0x64/0x80
       </IRQ>
       <TASK>
       asm_sysvec_kvm_posted_intr_wakeup_ipi+0x1a/0x20
      RIP: 0010:vcpu_run+0x1430/0x1e40 [kvm]
       kvm_arch_vcpu_ioctl_run+0x2c1/0x600 [kvm]
       kvm_vcpu_ioctl+0x580/0x6b0 [kvm]
       __se_sys_ioctl+0x6d/0xb0
       do_syscall_64+0x10a/0x480
       entry_SYSCALL_64_after_hwframe+0x4b/0x53
      RIP: 0033:0x46ff4b
       </TASK>
      ---[ end trace 0000000000000000 ]---
    
    Fixes: 091abbf578f9 ("KVM: x86: nSVM: optimize svm_set_x2apic_msr_interception")
    Cc: [email protected]
    Cc: Yosry Ahmed <[email protected]>
    Signed-off-by: Sean Christopherson <[email protected]>
    Link: https://patch.msgid.link/[email protected]/
    Signed-off-by: Paolo Bonzini <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

KVM: VMX: add memory clobber to asm for VMX instructions [+ + +]
Author: Paolo Bonzini <[email protected]>
Date:   Tue Jul 21 18:31:49 2026 +0200

    KVM: VMX: add memory clobber to asm for VMX instructions
    
    commit 0e65cd9e5d41c34f86b7c347967bedac54926041 upstream.
    
    VMCLEAR/VMREAD/VMWRITE/VMPTRLD access the internal VMCS cache, which
    is not visible to the compiler; without a memory clobber, the compiler
    can reorder them in troublesome ways because "asm volatile" and "asm goto"
    only protect against removal of the asm.  For example, placing a VMWRITE
    before the corresponding VMCS pointer is loaded can lead to corruption.
    While none of this has been observed, it is better to prevent than cure.
    
    Likewise, INVEPT and INVVPID access the TLB and, even though in their
    case the effect is only visible to the next VMLAUNCH/VMRESUME, it is
    technically correct to add the clobber there too.  So avoid any urge to
    special case them, and simply hardcode "memory" into the clobber list
    of vmx_asm1() and vmx_asm2().  __vmcs_readl() open-codes its own asm,
    so add the clobber there as well.
    
    Link: https://lore.kernel.org/kvm/CABgObfbL3t21yVeSwiLSjjOUER+rTYDPHYAH9YU4TWGRjx6XHg@mail.gmail.com/
    Cc: Sean Christopherson <[email protected]>
    Cc: [email protected]
    Signed-off-by: Paolo Bonzini <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
lib/alloc_tag: introduce mem_alloc_profiling_permanently_disabled() [+ + +]
Author: Harry Yoo (Oracle) <[email protected]>
Date:   Mon Aug 3 07:15:10 2026 +0000

    lib/alloc_tag: introduce mem_alloc_profiling_permanently_disabled()
    
    commit a37b0066a10aabf3c968b4566706fb866eaf9a85 upstream.
    
    mem_alloc_profiling_enabled() tells whether memalloc profiling is
    currently enabled. However, even when this function returns false,
    it can be enabled later.
    
    However, this is not enough. Some optimizations can be applied only when
    memalloc profiling is permanently disabled. For example, to skip the
    creation of KMALLOC_NO_OBJ_EXT caches at boot time, mem_profiling must
    be set to "never", "0" w/ debugging on, or have been shutdown so that
    it can no longer be enabled.
    
    Introduce mem_alloc_profiling_permanently_disabled() for this purpose.
    
    Signed-off-by: Harry Yoo (Oracle) <[email protected]>
    Acked-by: Suren Baghdasaryan <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Vlastimil Babka (SUSE) <[email protected]>
    Signed-off-by: Harry Yoo <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
Linux: Linux 6.18.44 [+ + +]
Author: Greg Kroah-Hartman <[email protected]>
Date:   Sun Aug 9 20:25:30 2026 +0200

    Linux 6.18.44
    
    Link: https://lore.kernel.org/r/[email protected]
    Tested-by: Pavel Machek (CIP) <[email protected]>
    Tested-by: Wentao Guan <[email protected]>
    Tested-by: Shuah Khan <[email protected]>
    Tested-by: Brett A C Sheffield <[email protected]>
    Tested-by: Peter Schneider <[email protected]>
    Tested-by: Ron Economos <[email protected]>
    Tested-by: Miguel Ojeda <[email protected]>
    Tested-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
media: chips-media: wave5: Support CBP profile [+ + +]
Author: Jackson Lee <[email protected]>
Date:   Tue Aug 4 06:47:12 2026 -0400

    media: chips-media: wave5: Support CBP profile
    
    [ Upstream commit f8505f9d6b223a26854003bfdba1a0772457886d ]
    
    Constrained Baseline Profile (CBP) and Baseline Profile (BP) have been
    treated as the same.
    Introduce the ability to differentiate between the two.
    
    Fixes: 9707a6254a8a ("media: chips-media: wave5: Add the v4l2 layer")
    Cc: [email protected]
    Signed-off-by: Jackson Lee <[email protected]>
    Signed-off-by: Nas Chung <[email protected]>
    Tested-by: Brandon Brnich <[email protected]>
    Reviewed-by: Nicolas Dufresne <[email protected]>
    Signed-off-by: Nicolas Dufresne <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: qcom: camss: csid-340: Fix unused variables [+ + +]
Author: Loic Poulain <[email protected]>
Date:   Tue Aug 4 20:08:32 2026 -0400

    media: qcom: camss: csid-340: Fix unused variables
    
    [ Upstream commit 0b61ce8dc4a71ea7baa19275c655677c612dde6d ]
    
    The CSID driver has some unused variables and function parameters
    that are no longer needed (due to refactoring). Clean up those
    unused elements:
    
    - Remove the `vc` parameter from `__csid_configure_rx()`.
    - Drop the unused `lane_cnt` variable.
    - Adjust call to `__csid_configure_rx()` accordingly.
    
    Signed-off-by: Loic Poulain <[email protected]>
    Reviewed-by: Bryan O'Donoghue <[email protected]>
    Reviewed-by: Vladimir Zapolskiy <[email protected]>
    Signed-off-by: Bryan O'Donoghue <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Stable-dep-of: cc1c35619c98 ("media: qcom: camss: Fix RDI streaming for CSID 340")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: qcom: camss: Fix RDI streaming for CSID 340 [+ + +]
Author: Bryan O'Donoghue <[email protected]>
Date:   Tue Aug 4 20:08:33 2026 -0400

    media: qcom: camss: Fix RDI streaming for CSID 340
    
    [ Upstream commit cc1c35619c9895f918f9e388e3caa6ab2ff2fbe7 ]
    
    Fix streaming from CSIDn RDI1 and RDI2 to VFEn RDI1 and RDI2. A pattern we
    have replicated throughout CAMSS where we use the VC number to populate
    both the VC fields and port fields of the CSID means that in practice only
    VC = 0 on CSIDn:RDI0 to VFEn:RDI0 works.
    
    Fix that for CSID 340 by separating VC and port. Fix to VC zero as a bugfix
    we will look to properly populate the VC field with follow on patches
    later.
    
    Fixes: f0fc808a466a ("media: qcom: camss: Add CSID 340 support")
    Cc: [email protected]
    Signed-off-by: Bryan O'Donoghue <[email protected]>
    Reviewed-by: Vladimir Zapolskiy <[email protected]>
    Reviewed-by: Loic Poulain <[email protected]>
    Signed-off-by: Bryan O'Donoghue <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

media: uapi: rkisp: Correct name version enum [+ + +]
Author: Niklas Söderlund <[email protected]>
Date:   Thu Aug 6 08:46:34 2026 -0400

    media: uapi: rkisp: Correct name version enum
    
    [ Upstream commit c4c01c4fd4a3916ffdfb35ad9f511c48e289f51c ]
    
    The name of the enum to hold the mapping of parameter buffer versions
    have a typo in the name, correct it. While this is a uAPI header the
    impact should be minimal as the enum is only used as a collection for
    the one version number supported.
    
    Fixes: e9d05e9d5db1 ("media: uapi: rkisp1-config: Add extensible params format")
    Cc: [email protected]
    Signed-off-by: Niklas Söderlund <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Laurent Pinchart <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    [ Adjusted context to keep the tree's `RKISP1_EXT_PARAM_BUFFER_V1 = 1` initializer instead of upstream's `V4L2_ISP_PARAMS_VERSION_V1`, which does not exist in this tree. ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mm/huge_memory: unlock i_mmap_rwsem before releasing after-split folios [+ + +]
Author: Kiryl Shutsemau (Meta) <[email protected]>
Date:   Wed Aug 5 14:45:25 2026 +0100

    mm/huge_memory: unlock i_mmap_rwsem before releasing after-split folios
    
    [ Upstream commit e923bd21058ea02fd0dcd3549d151d143fd036e5 ]
    
    __folio_split() keeps dereferencing the mapping after the split:
    shmem_uncharge(mapping->host) and remap_page() while the folios are still
    frozen/locked, and i_mmap_unlock_read(mapping) at the very end, after the
    after-split folios have been unlocked and freed.
    
    Nothing holds an inode reference across that.  The split relies on @folio
    -- which the beyond-EOF drop loop never removes, as it starts at
    folio_next(folio) -- staying locked and in the page cache to hold off
    eviction.  But the unlock loop unlocks @folio before i_mmap_unlock_read()
    runs.  If the caller's @lock_at is a tail beyond EOF, as memory_failure()
    passes when splitting a poisoned tail of a shmem THP that reaches past
    i_size during truncation, it too is gone from the page cache; so once
    @folio is unlocked no locked, in-cache folio pins the inode, and a
    concurrent final iput() can evict and RCU-free it before
    i_mmap_unlock_read() touches i_mmap_rwsem:
    
      BUG: KASAN: slab-use-after-free in __up_read+0x634/0x790
       i_mmap_unlock_read include/linux/fs.h:537 [inline]
       __folio_split+0x732/0x1640 mm/huge_memory.c:4100
       try_to_split_thp_page+0xab/0x390 mm/memory-failure.c:1675
       memory_failure+0x1394/0x26e0 mm/memory-failure.c:2470
    
      Freed by task 4601:
       shmem_free_in_core_inode+0x54/0xb0 mm/shmem.c:5177
       evict+0x57f/0xac0 fs/inode.c:870
    
    Do every mapping dereference while @folio still pins the inode: drop
    i_mmap_rwsem right after remap_page(), before the loop that unlocks and
    frees the after-split folios, and clear @mapping so the exit path does not
    unlock it again.  shmem_uncharge() and remap_page() already run before
    that point, so after this nothing past the unlock loop touches the inode
    or the mapping.
    
    This is now a rule the split depends on, alongside keeping @folio frozen
    until the page cache is updated: no inode or mapping dereference once the
    after-split folios start being unlocked.
    
    Link: https://lore.kernel.org/[email protected]
    Fixes: baa355fd3314 ("thp: file pages support for split_huge_page()")
    Signed-off-by: Kiryl Shutsemau (Meta) <[email protected]>
    Reported-by: Hao Zhang <[email protected]>
    Closes: https://lore.kernel.org/linux-mm/20260710071344.GA106129@zh-pc
    Co-developed-by: Hao Zhang <[email protected]>
    Signed-off-by: Hao Zhang <[email protected]>
    Acked-by: David Hildenbrand (Arm) <[email protected]>
    Reviewed-by: Zi Yan <[email protected]>
    Reviewed-by: Baolin Wang <[email protected]>
    Reviewed-by: Miaohe Lin <[email protected]>
    Cc: Baolin Wang <[email protected]>
    Cc: Barry Song <[email protected]>
    Cc: Dev Jain <[email protected]>
    Cc: Lance Yang <[email protected]>
    Cc: Liam R. Howlett <[email protected]>
    Cc: Lorenzo Stoakes <[email protected]>
    Cc: Naoya Horiguchi <[email protected]>
    Cc: Nico Pache <[email protected]>
    Cc: Ryan Roberts <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    (cherry picked from commit e923bd21058ea02fd0dcd3549d151d143fd036e5)
    
    Signed-off-by: Kiryl Shutsemau (Meta) <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
mm/hugetlb: fix list corruption in allocate_file_region_entries() [+ + +]
Author: Xiangfeng Cai <[email protected]>
Date:   Tue Jul 14 01:14:55 2026 +0800

    mm/hugetlb: fix list corruption in allocate_file_region_entries()
    
    commit dd9623f58ec702a07b2d67179d6fcea79c52231a upstream.
    
    allocate_file_region_entries() tops up resv->region_cache with freshly
    allocated file_region descriptors.  The allocation uses GFP_KERNEL, so
    resv->lock is dropped around it: the new entries are gathered on a
    stack-local list head, allocated_regions, and spliced into
    resv->region_cache once the lock is re-acquired.
    
    The splice used list_splice(), which moves the entries but does not
    re-initialize the source head, so allocated_regions is left pointing at an
    entry that now lives on resv->region_cache.  The top-up runs in a while
    loop that re-checks the cache deficit after re-acquiring the lock.  For a
    shared mapping the resv_map is shared by every mapper of the hugetlbfs
    inode, so a concurrent region_chg()/region_add()/region_del() on the same
    resv_map can consume cache entries during the unlocked window and force a
    second iteration.  That iteration calls list_add() on the stale head and
    corrupts the list; with CONFIG_DEBUG_LIST the __list_add_valid() check
    trips:
    
      list_add corruption. next->prev should be prev (ffffc900011ff7f8),
      but was ffff88814c281460. (next=ffff88814c545640).
      kernel BUG at lib/list_debug.c:31!
       allocate_file_region_entries+0x191/0x420
       region_chg+0x267/0x300
       hugetlb_reserve_pages+0x387/0xc80
       hugetlbfs_file_mmap+0x2ce/0x3f0
       mmap_region+0x1348/0x1a80
       do_mmap+0x85e/0xb90
       vm_mmap_pgoff+0x18c/0x330
       ksys_mmap_pgoff+0x2a1/0x3e0
       do_syscall_64+0xd7/0x420
    
    Without CONFIG_DEBUG_LIST the bad list_add() silently links a kernel-stack
    address into resv->region_cache, leading to later use-after-free.
    
    This was observed as a real host panic on a dense KVM host where a QEMU
    guest-RAM hugetlbfs file was mapped MAP_SHARED by both QEMU and a separate
    SPDK/DPDK vhost-user target, generating concurrent region_* traffic on one
    shared resv_map.
    
    Use list_splice_init() so the source head is re-initialized empty after
    each splice, making the retry loop safe.
    
    Link: https://lore.kernel.org/[email protected]
    Fixes: d3ec7b6e09e5 ("mm/hugetlb: use list_splice to merge two list at once")
    Signed-off-by: Xiangfeng Cai <[email protected]>
    Reviewed-by: Muchun Song <[email protected]>
    Cc: Baoquan He <[email protected]>
    Cc: David Hildenbrand <[email protected]>
    Cc: Oscar Salvador <[email protected]>
    Cc: Shuah Khan <[email protected]>
    Cc: Wei Yang <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

mm/hugetlb: fix swap entry corruption when clearing uffd-wp at fork() [+ + +]
Author: Kiryl Shutsemau (Meta) <[email protected]>
Date:   Wed Aug 5 14:43:46 2026 +0100

    mm/hugetlb: fix swap entry corruption when clearing uffd-wp at fork()
    
    [ Upstream commit 83abe2fd5b3aeb3123b5408a5a91709c5538fb23 ]
    
    copy_hugetlb_page_range() clears the uffd-wp bit of migration and hwpoison
    entries with huge_pte_clear_uffd_wp(), which operates on the present-PTE
    bit position.  Swap entries keep the uffd-wp state elsewhere -- the
    migration branch reads and sets it with pte_swp_uffd_wp() and
    pte_swp_mkuffd_wp() -- and the present-PTE position falls into the swap
    payload.  On x86-64 it lands in the inverted swap offset, where a
    naturally-aligned hugetlb PFN always has the affected bit set, so the
    clear advances the encoded PFN by two pages.
    
    No userfaultfd needs to be involved: the clear is guarded only by the
    child VMA not being uffd-wp registered, so a plain fork() with an
    in-flight hugetlb migration entry (or a poisoned hugetlb page) corrupts
    the entry copied into the child.  Instrumenting the clear and forking
    after MADV_HWPOISON on a 2MB anon hugetlb page shows:
    
      offset before=120e00
      offset after =120e02
    
    The fallout is mostly latent: rmap walks match migration entries by folio
    range and remove_migration_pte() rebuilds the PTE from the folio, so a
    within-folio PFN skew heals once migration completes.  But any path that
    re-encodes the corrupted offset -- e.g.  hugetlb_change_protection()
    rewriting a writable migration entry via
    make_readable_migration_entry(swp_offset(entry)) -- propagates it.
    
    Migration entries legitimately carry uffd-wp, so clear it with
    pte_swp_clear_uffd_wp(), matching copy_nonpresent_pte() and
    move_huge_pte().
    
    A hwpoison entry, on the other hand, never carries the uffd-wp bit: it is
    installed fresh by make_hwpoison_entry() (try_to_unmap_one() does not
    preserve uffd-wp on the hwpoison path) and hugetlb_change_protection()
    leaves hwpoison entries untouched.  There was nothing to clear there, only
    the corruption, so drop the clear entirely.
    
    Link: https://lore.kernel.org/[email protected]
    Fixes: bc70fbf269fd ("mm/hugetlb: handle uffd-wp during fork()")
    Signed-off-by: Kiryl Shutsemau <[email protected]>
    Reported-by: Sashiko AI review <[email protected]>
    Closes: https://lore.kernel.org/all/[email protected]/
    Suggested-by: David Hildenbrand <[email protected]>
    Acked-by: David Hildenbrand (Arm) <[email protected]>
    Assisted-by: Claude:claude-fable-5
    Cc: Muchun Song <[email protected]>
    Cc: Oscar Salvador <[email protected]>
    Cc: Peter Xu <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    (cherry picked from commit 83abe2fd5b3aeb3123b5408a5a91709c5538fb23)
    [ kas: adapt to the pre-softleaf idiom ]
    Signed-off-by: Kiryl Shutsemau (Meta) <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
mm/page_reporting: use system_freezable_wq to fix UAF during suspend [+ + +]
Author: Link Lin <[email protected]>
Date:   Tue Jul 21 00:55:33 2026 +0000

    mm/page_reporting: use system_freezable_wq to fix UAF during suspend
    
    commit 0b45f6927a14914ff685fe0e6f9d11232a1e03df upstream.
    
    During PM freeze (e.g.  S3 suspend or S4 hibernation), device drivers like
    virtio_balloon reset their underlying virtio devices and delete their
    virtqueues via vdev->config->del_vqs().
    
    However, page reporting work (page_reporting_process) was scheduled on the
    global system_wq.  Because system_wq lacks the WQ_FREEZABLE flag, the PM
    freezer skips it, leaving page_reporting_process active during suspend.
    
    If pages are freed into the buddy allocator while suspending (for example,
    when core MM invokes the balloon shrinker during S4 hibernation image
    saving), page reporting triggers virtballoon_free_page_report() on deleted
    virtqueues, resulting in a Use-After-Free / General Protection Fault:
    
        [  196.795226] general protection fault, probably for non-canonical address 0xaa1436fe70dae6df: 0000 [#1] SMP NOPTI
        [  196.825967] Workqueue: events page_reporting_process
        [  196.831038] RIP: 0010:virtqueue_add_split+0x233/0x4c0 [virtio_ring]
        [  196.927073] virtballoon_free_page_report+0x3a/0xe0 [virtio_balloon]
        [  196.946943] page_reporting_process+0x370/0x4f0
    
    Fix this by switching page reporting work to system_freezable_wq.  This
    ensures that the PM freezer pauses page_reporting_process before device
    drivers destroy their reporting virtqueues.  Because the reporting worker
    is frozen, memory reclamation/freeing (e.g.  via shrinker execution) can
    safely return pages to MM during freeze without triggering unfrozen
    reporting work on deleted virtqueues.
    
    This aligns with the driver's existing design. The comment in
    virtballoon_freeze() states:
        /*
         * The workqueue is already frozen by the PM core before this
         * function is called.
         */
    
    Testing:
    I have verified these fixes using Google’s virtualization infrastructure
    by running continuous suspend/resume iterations (40+ cycles) while
    churning memory using stress-ng (`stress-ng --vm 4 --vm-bytes 60%
    --timeout 1`) to constantly create free pages for the buddy allocator.  We
    also set the `page_reporting_order` parameter to 0 to make the page
    reporting worker highly sensitive, forcing it to pick up any 4K free
    pages.  This confirmed that the UAF crashes are no longer reproducible.
    
    Link: https://lore.kernel.org/[email protected]
    Fixes: 36e66c554b5c ("mm: introduce Reported pages")
    Signed-off-by: Link Lin <[email protected]>
    Suggested-by: David Hildenbrand (Arm) <[email protected]>
    Suggested-by: Michael S. Tsirkin <[email protected]>
    Acked-by: David Rientjes <[email protected]>
    Acked-by: David Hildenbrand (Arm) <[email protected]>
    Acked-by: Michael S. Tsirkin <[email protected]>
    Cc: Alexander Duyck <[email protected]>
    Cc: Greg Thelen <[email protected]>
    Cc: James Houghton <[email protected]>
    Cc: Jason Wang <[email protected]>
    Cc: Jiaqi Yan <[email protected]>
    Cc: Vlastimil Babka <[email protected]>
    Cc: Xuan Zhuo <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mm/percpu-km: fix bitmap overflow and accounting in pcpu_create_chunk() [+ + +]
Author: Zi Yan <[email protected]>
Date:   Thu Jul 9 15:12:01 2026 -0400

    mm/percpu-km: fix bitmap overflow and accounting in pcpu_create_chunk()
    
    commit 89b1b79c308818a715e75f28744b70d8940a07c9 upstream.
    
    In pcpu_create_chunk(), nr_pages is the total contiguous backing
    allocation, i.e., nr_units * pcpu_unit_pages, but pcpu_chunk_populated()
    uses it to set chunk->populated, whose size is pcpu_unit_pages, bitmap.
    Since bit N in chunk->populated means page offset N inside every unit is
    backed.  When nr_units > 1, the function writes beyond chunk->populated.
    Fix it by using chunk->nr_pages.
    
    It also fixes the global pcpu_nr_empty_pop_pages accounting, since
    pcpu_balance_free() only iterates up to chunk->nr_pages.
    
    Commit a63d4ac4ab609 ("percpu: make percpu-km set chunk->populated bitmap
    properly") introduced the bitmap overflow issue.  Later, commit
    b539b87fed37f ("percpu: implmeent pcpu_nr_empty_pop_pages and
    chunk->nr_populated") added pcpu_nr_empty_pop_pages and caused the
    accounting issue.
    
    Link: https://lore.kernel.org/20260709-fix-pcpu_create_chunk-in-percpu-km-v1-1-1f64745a84cc@nvidia.com
    Fixes: a63d4ac4ab609 ("percpu: make percpu-km set chunk->populated bitmap properly")
    Reported-by: Sashiko <[email protected]>
    Closes: https://sashiko.dev/#/patchset/20260703-keep-subpage-private-zero-at-free-v2-0-2970fe777dd6%40nvidia.com?part=1
    Assisted-by: Codex:GPT-5
    Signed-off-by: Zi Yan <[email protected]>
    Acked-by: Dennis Zhou <[email protected]>
    Cc: Christoph Lameter <[email protected]>
    Cc: Tejun Heo <[email protected]>
    Cc: Zi Yan <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mm/slab: prevent unbounded recursion in free path with new kmalloc type [+ + +]
Author: Harry Yoo (Oracle) <[email protected]>
Date:   Mon Aug 3 07:15:11 2026 +0000

    mm/slab: prevent unbounded recursion in free path with new kmalloc type
    
    commit d9e6a7623938968e3752b67e37eaff097e559a54 upstream.
    
    Commit 280ea9c3154b ("mm/slab: avoid allocating slabobj_ext array from
    its own slab") avoided recursive allocation of obj_exts from kmalloc
    caches of the same size, by bumping the obj_exts array's allocation
    size whenever the array size equals the size of the object being
    allocated.
    
    However, as reported by Danielle Costantino and Shakeel Butt,
    even slabs from kmalloc caches of different sizes can form a cycle
    by allocating obj_exts arrays from each other [1]:
    
      What happened: a KMALLOC_NORMAL slab's obj_exts array (used by
      allocation profiling / memcg accounting) is itself kmalloc()'d from a
      KMALLOC_NORMAL cache, so the "slab holds another slab's obj_exts array"
      relation can form cycles. With sizeof(struct slabobj_ext) == 16 and
      the host's geometry:
    
      - kmalloc-512 has 64 objects/slab -> array is 64*16 == 1024 bytes,
        served from kmalloc-1k;
      - kmalloc-1k  has 32 objects/slab -> array is 32*16 ==  512 bytes,
        served from kmalloc-512.
    
      A kmalloc-512 slab and a kmalloc-1k slab therefore hold each other's
      obj_exts array.  Discarding one frees the other's array, which empties
      and discards that slab, which frees the first's array, and so on:
      __free_slab() -> free_slab_obj_exts() -> kfree() -> discard_slab() ->
      __free_slab() recurses along the cycle until the stack is exhausted.
    
    With memory allocation profiling, this allows unbounded recursion
    in the free path and led to a stack overflow on a production host in
    the Meta fleet [1]:
    
      BUG: TASK stack guard page was hit
      Oops: stack guard page
      RIP: 0010:kfree+0x8/0x5d0
      Call Trace:
       __free_slab+0x66/0xc0
       kfree+0x3f0/0x5d0
       ... ( ~125x __free_slab <-> kfree ) ...
       <kernel driver freeing a resource>
       do_syscall_64
    
    It is proposed [1] to resolve this issue by always serving the obj_exts
    array allocation from kmalloc caches (or large kmalloc) of sizes larger
    than the object size. However, as pointed out by Vlastimil Babka [2],
    this can waste an excessive amount of memory as slabs from large
    kmalloc sizes (e.g. kmalloc-8k) generally need obj_exts arrays much
    smaller than the object size.
    
    Therefore, rather than bumping the size, let us take a different
    approach; disallow formation of cycles between kmalloc types when
    allocating obj_exts arrays. Currently, all obj_exts arrays are served
    from normal kmalloc caches. Cycles cannot be created if obj_exts arrays
    of normal kmalloc caches are served from a special kmalloc type that can
    never have obj_exts arrays.
    
    To achieve this, create a new kmalloc type called KMALLOC_NO_OBJ_EXT.
    KMALLOC_NO_OBJ_EXT caches are created with SLAB_NO_OBJ_EXT flag when
    either 1) memory allocation profiling is not permanently disabled,
    or 2) kmalloc types with a priority higher than KMALLOC_CGROUP are
    aliased with KMALLOC_NORMAL.
    
    Sheaf bootstrapping for KMALLOC_NO_OBJ_EXT caches now must be deferred
    because allocation of a barn can trigger obj_exts array allocation of
    normal kmalloc caches when the KMALLOC_NO_OBJ_EXT cache for that size
    is not ready yet. For simplicity, perform bootstrapping of sheaves for
    all kmalloc caches later.
    
    Introduce a new slab alloc flag, SLAB_ALLOC_NO_OBJ_EXT, to prevent
    allocation of obj_exts arrays, and let kmalloc_slab() override the type
    to KMALLOC_NO_OBJ_EXT when specified. Note that kmalloc_type() remains
    unchanged because kmalloc_flags() bypasses the kmalloc fastpath.
    
    Do not pass SLAB_ALLOC_NO_RECURSE to kmalloc_flags() in
    alloc_slab_obj_exts() and instead use SLAB_ALLOC_NO_OBJ_EXT only when
    the objects are allocated from normal kmalloc caches. While this
    prevents unbounded recursive allocation of obj_exts, it allows
    KMALLOC_NO_OBJ_EXT caches to have sheaves.
    
    Since sheaf allocations specify SLAB_ALLOC_NO_RECURSE that prevents
    allocation of both sheaves and obj_exts arrays, the recursion depth
    is bounded.
    
    obj_exts arrays for non-kmalloc-normal caches can now have a valid tag.
    Do not call mark_obj_codetag_empty() when freeing an obj_exts array to
    avoid false warnings. KMALLOC_NO_OBJ_EXT don't need this as they never
    allocate those arrays.
    
    Reported-by: Danielle Costantino <[email protected]>
    Reported-by: Shakeel Butt <[email protected]>
    Closes: https://lore.kernel.org/linux-mm/[email protected] [1]
    Fixes: 4b8736964640 ("mm/slab: add allocation accounting into slab allocation and free paths")
    Cc: [email protected]
    Link: https://lore.kernel.org/linux-mm/[email protected] [2]
    Signed-off-by: Harry Yoo (Oracle) <[email protected]>
    Reviewed-by: Suren Baghdasaryan <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Vlastimil Babka (SUSE) <[email protected]>
    [[email protected]: Backport notes:
     - Fix a minor conflict due to missing partitioned
       kmalloc caches in 6.18.
    
     - Use __GFP_NO_OBJ_EXT instead of SLAB_ALLOC_NO_OBJ_EXT
       since slab's internal alloc_flags do not exist in 6.18.
    
     - Deferring sheaf bootstrapping for kmalloc caches is not applied
       as they don't have sheaves in 6.18.
    
     - Adjust the comment for SLAB_NO_OBJ_EXT, like in the commit
       982e31382d9a ("mm/slab: decouple SLAB_NO_SHEAVES from
       SLAB_NO_OBJ_EXT"). The rest of that commit is a no-op in 6.18 as
       kmalloc caches don't have sheaves and thus only adjust the comment.
    
     - Apply the __GFP_NO_OBJ_EXT flag to the !allow_spin path in
       alloc_slab_obj_exts(). ]
    Signed-off-by: Harry Yoo <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
mm/util: don't read __page_2 for order-1 folios in snapshot_page() [+ + +]
Author: Aboorva Devarajan <[email protected]>
Date:   Thu Jul 9 01:49:54 2026 +0530

    mm/util: don't read __page_2 for order-1 folios in snapshot_page()
    
    commit 7441d6348c70738e9ed307510db171c7a9b3f4bf upstream.
    
    snapshot_page() currently reads __page_2 after checking nr_pages > 1, but
    it should only do so when nr_pages > 2.
    
    If an order-1 folio is allocated at the end of a vmemmap section,
    __page_2 will not exist and reading it will cause a fault.
    
    During DLPAR memory remove on a 22 TB ppc64le LPAR, snapshot_page() oopsed
    on the page isolation path while reading an order-1 folio's __page_2 from
    an adjacent absent section (unmapped vmemmap).
    
    Fix this to avoid reading memmap that doesn't exist (e.g., a vmemmap
    hole).
    
    Link: https://lore.kernel.org/[email protected]
    Fixes: 31a31da8a618 ("mm: move _pincount in folio to page[2] on 32bit")
    Signed-off-by: Aboorva Devarajan <[email protected]>
    Reported-by: Sourabh Jain <[email protected]>
    Acked-by: David Hildenbrand (Arm) <[email protected]>
    Reviewed-by: Lorenzo Stoakes <[email protected]>
    Reviewed-by: Matthew Wilcox (Oracle) <[email protected]>
    Reviewed-by: Luiz Capitulino <[email protected]>
    Cc: Liam R. Howlett <[email protected]>
    Cc: Michal Hocko <[email protected]>
    Cc: Mike Rapoport <[email protected]>
    Cc: "Ritesh Harjani (IBM)" <[email protected]>
    Cc: Suren Baghdasaryan <[email protected]>
    Cc: Vlastimil Babka <[email protected]>
    Cc: <[email protected]> # v6.15+
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mm/vmstat: fold stranded per-cpu node stats when a node comes online [+ + +]
Author: Gregory Price <[email protected]>
Date:   Sat Jun 27 16:22:43 2026 -0400

    mm/vmstat: fold stranded per-cpu node stats when a node comes online
    
    commit ea3034b2b00fa50c8d2518d0804c9d427bbafa86 upstream.
    
    A per-node vmstat counter is pgdat->vm_stat[] plus per-cpu deltas.  A
    balanced counter can sit split as global=+N / per-cpu=-N.
    
    The folds reconciling the split only walk online nodes, so when
    try_offline_node() marks a node offline the per-cpu deltas are stranded.
    
    A subsequent online resets the per-cpu area but not pgdat->vm_stat[],
    orphaning the +N permanently.  All NR_VM_NODE_STAT_ITEMS are affected.
    
    The existing code zeroes the per-cpu counters and causes a permanent skew.
    Fold the stranded deltas instead, before the node rejoins the online set.
    The node is not online yet and the hotplug lock is held, so the remote
    access to per-cpu values is safe.
    
    Discovered when node compaction hung for a nearly empty node, as the math
    to determine throttling broke.  Reproduced by repeated memory
    hotplug/unplug cycles on a node under pressure: NR_ISOLATED_ANON ratchets
    up and never returns to zero.
    
    Link: https://lore.kernel.org/[email protected]
    Fixes: 75ef71840539 ("mm, vmstat: add infrastructure for per-node vmstats")
    Signed-off-by: Gregory Price <[email protected]>
    Cc: Johannes Weiner <[email protected]>
    Cc: Mel Gorman <[email protected]>
    Cc: Mike Rapoport <[email protected]>
    Cc: Vlastimil Babka <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mm: memcg: initialize *locked in memcg1_oom_prepare() stub [+ + +]
Author: Breno Leitao <[email protected]>
Date:   Thu Jul 16 06:42:18 2026 -0700

    mm: memcg: initialize *locked in memcg1_oom_prepare() stub
    
    commit 1833ce36b35426504c64600c94f322437ea44bb2 upstream.
    
    mem_cgroup_oom() passes an uninitialized "locked" to memcg1_oom_prepare()
    and reads it back in memcg1_oom_finish():
    
            bool locked, ret;
            ...
            if (!memcg1_oom_prepare(memcg, &locked))
                    return false;
            ret = mem_cgroup_out_of_memory(memcg, mask, order);
            memcg1_oom_finish(memcg, locked);
    
    This relies on memcg1_oom_prepare() setting *locked whenever it returns
    true.  The CONFIG_MEMCG_V1=y version does, but the stub used when
    CONFIG_MEMCG_V1=n returns true without touching *locked, so
    memcg1_oom_finish() consumes an uninitialized value.  On a memcg OOM this
    is reported by UBSAN:
    
      UBSAN: invalid-load in mm/memcontrol.c:1932:27
      load of value 0 is not a valid value for type 'bool' (aka '_Bool')
    
    Initialize *locked to false in the stub; with cgroup v1 compiled out there
    is no OOM lock to take.
    
    Link: https://lore.kernel.org/[email protected]
    Fixes: e93d4166b40a ("mm: memcg: put cgroup v1-specific code under a config option")
    Signed-off-by: Breno Leitao <[email protected]>
    Reviewed-by: Joshua Hahn <[email protected]>
    Acked-by: Johannes Weiner <[email protected]>
    Reviewed-by: SeongJae Park <[email protected]>
    Acked-by: Shakeel Butt <[email protected]>
    Cc: Michal Hocko <[email protected]>
    Cc: Muchun Song <[email protected]>
    Cc: Roman Gushchin <[email protected]>
    Cc: Shakeel Butt <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

mm: migrate_device: fix pte_pfn/pte_dirty called on non-present PTE [+ + +]
Author: Kefeng Wang <[email protected]>
Date:   Mon Jul 6 19:19:58 2026 +0800

    mm: migrate_device: fix pte_pfn/pte_dirty called on non-present PTE
    
    commit 63867c82d0c0c2d182016a32b1cc0103116b0ea5 upstream.
    
    pte_pfn() and pte_dirty() have undefined behaviour when called on a
    non-present PTE. In migrate_vma_collect_pmd(), these functions may be
    invoked on non-present entries (e.g., device-private entries), leading
    to potential crashes from pte_pfn() or incorrect dirty folio accounting
    from pte_dirty(). Fix both by guarding with pte_present() checks.
    
    Link: https://lore.kernel.org/[email protected]
    Link: https://lore.kernel.org/[email protected]
    Fixes: fd35ca3d12cc ("mm/migrate_device.c: copy pte dirty bit to page")
    Fixes: 6c287605fd56 ("mm: remember exclusively mapped anonymous pages with PG_anon_exclusive")
    Signed-off-by: Kefeng Wang <[email protected]>
    Reviewed-by: Balbir Singh <[email protected]>
    Acked-by: Zi Yan <[email protected]>
    Cc: Alistair Popple <[email protected]>
    Cc: Byungchul Park <[email protected]>
    Cc: David Hildenbrand <[email protected]>
    Cc: Gregory Price <[email protected]>
    Cc: "Huang, Ying" <[email protected]>
    Cc: Joshua Hahn <[email protected]>
    Cc: Matthew Brost <[email protected]>
    Cc: Rakie Kim <[email protected]>
    Cc: Ying Huang <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mshv: adjust interrupt control structure for ARM64 [+ + +]
Author: Jinank Jain <[email protected]>
Date:   Mon Nov 24 14:25:59 2025 +0000

    mshv: adjust interrupt control structure for ARM64
    
    [ Upstream commit 9d70ef7a18e0ec1653ac63020a13a5d4dda7cc0d ]
    
    Interrupt control structure (union hv_interupt_control) has different
    fields when it comes to x86 vs ARM64. Bring in the correct structure
    from HyperV header files and adjust the existing interrupt routing
    code accordingly.
    
    Signed-off-by: Jinank Jain <[email protected]>
    Signed-off-by: Anirudh Rayabharam (Microsoft) <[email protected]>
    Signed-off-by: Wei Liu <[email protected]>
    Stable-dep-of: 0289a67cd70b ("mshv: Fix level-triggered check on uninitialized data")
    Signed-off-by: Sasha Levin <[email protected]>

mshv: Fix duplicate GSI detection for GSI 0 [+ + +]
Author: Stanislav Kinsburskii <[email protected]>
Date:   Thu May 7 15:43:49 2026 +0000

    mshv: Fix duplicate GSI detection for GSI 0
    
    [ Upstream commit 649dd135491945afa544351e3e6d4a727de87020 ]
    
    The duplicate routing entry check in mshv_update_routing_table() uses
    guest_irq_num != 0 to detect whether a GSI slot is already occupied.
    This fails for GSI 0 because its guest_irq_num is 0 both when the slot
    is unused (zero-initialized) and when legitimately assigned. As a
    result, duplicate entries for GSI 0 are silently accepted, with the
    second entry overwriting the first — corrupting the routing table
    without any error reported to userspace.
    
    While GSI 0 (legacy timer) is unlikely to appear in MSI-based routing
    in practice, the check is semantically wrong — it conflates
    "uninitialized" with "GSI number 0." Use girq_entry_valid instead,
    which is explicitly set to true when an entry is populated and remains
    zero for unused slots regardless of the GSI number.
    
    Fixes: 621191d709b14 ("Drivers: hv: Introduce mshv_root module to expose /dev/mshv to VMMs")
    Signed-off-by: Stanislav Kinsburskii <[email protected]>
    Reviewed-by: Anirudh Rayabharam (Microsoft) <[email protected]>
    Signed-off-by: Wei Liu <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

mshv: fix hv_input_get_system_property struct [+ + +]
Author: Wei Liu <[email protected]>
Date:   Tue Jun 30 14:57:54 2026 -0700

    mshv: fix hv_input_get_system_property struct
    
    commit d6f0248f04a96249660591e47fcf37ba98ac7ea3 upstream.
    
    Keep it in sync with the correct definition.
    
    The old code worked by chance.
    
    Fixes: e68bda71a2384 ("hyperv: Add new Hyper-V headers in include/hyperv")
    Cc: [email protected]
    Signed-off-by: Wei Liu <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

mshv: Fix level-triggered check on uninitialized data [+ + +]
Author: Stanislav Kinsburskii <[email protected]>
Date:   Thu May 7 15:43:43 2026 +0000

    mshv: Fix level-triggered check on uninitialized data
    
    [ Upstream commit 0289a67cd70bf9d3807e289f4efd643e16a6c6b4 ]
    
    In mshv_irqfd_assign(), the level-triggered validation for resample
    irqfds checks irqfd_lapic_irq.lapic_control.level_triggered before
    mshv_irqfd_update() has populated the field. Since the irqfd struct is
    zero-allocated, level_triggered is always 0 at that point, causing the
    check to always reject resample irqfds with -EINVAL. This makes
    level-triggered interrupt resampling — used to avoid interrupt storms
    with assigned devices — completely non-functional.
    
    Move the check after the mshv_irqfd_update() call, which resolves the
    IRQ routing entry and populates irqfd_lapic_irq with the actual trigger
    mode.
    
    Fixes: 621191d709b14 ("Drivers: hv: Introduce mshv_root module to expose /dev/mshv to VMMs")
    Signed-off-by: Stanislav Kinsburskii <[email protected]>
    Reviewed-by: Anirudh Rayabharam (Microsoft) <[email protected]>
    Signed-off-by: Wei Liu <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

mshv: Fix race in mshv_irqfd_deassign [+ + +]
Author: Stanislav Kinsburskii <[email protected]>
Date:   Thu May 7 15:43:15 2026 +0000

    mshv: Fix race in mshv_irqfd_deassign
    
    [ Upstream commit 0762262ac3e70f65b3bb843fe892f8bac1562d08 ]
    
    mshv_irqfd_deactivate() and the hlist traversal of pt_irqfds_list
    require pt->pt_irqfds_lock to be held, but mshv_irqfd_deassign()
    omits it. This races with the EPOLLHUP path in mshv_irqfd_wakeup(),
    which does take the lock before calling mshv_irqfd_deactivate().
    
    Additionally, mshv_irqfd_deactivate() uses hlist_del() which poisons
    the node pointers rather than resetting them. Since
    mshv_irqfd_is_active() relies on hlist_unhashed() (checks pprev ==
    NULL), a poisoned node still appears active. If a concurrent path calls
    mshv_irqfd_deactivate() again on the same irqfd, the guard fails to
    prevent a double hlist_del() on poisoned pointers.
    
    Fix both issues:
    - Add the missing spin_lock_irq/spin_unlock_irq around the list
      traversal in mshv_irqfd_deassign(), matching mshv_irqfd_release().
    - Use hlist_del_init() instead of hlist_del() so the node is properly
      marked as unhashed after removal, making the is_active guard reliable.
    
    Fixes: 621191d709b14 ("Drivers: hv: Introduce mshv_root module to expose /dev/mshv to VMMs")
    Signed-off-by: Stanislav Kinsburskii <[email protected]>
    Reviewed-by: Anirudh Rayabharam (Microsoft) <[email protected]>
    Signed-off-by: Wei Liu <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

mshv: Fix sleeping under spinlock in mshv_portid_alloc [+ + +]
Author: Stanislav Kinsburskii <[email protected]>
Date:   Thu May 7 15:43:59 2026 +0000

    mshv: Fix sleeping under spinlock in mshv_portid_alloc
    
    [ Upstream commit a9708e550d11a53b22d932cdbfaa10c26346a2d0 ]
    
    idr_alloc() is called with GFP_KERNEL inside idr_lock(), which holds a
    spinlock. GFP_KERNEL allows the allocator to sleep, triggering a
    sleeping-while-atomic bug.
    
    Fix by using idr_preload(GFP_KERNEL) before taking the lock to
    pre-allocate memory in a sleepable context, then idr_alloc() with
    GFP_NOWAIT inside the spinlock-protected section.
    
    Fixes: 621191d709b1 ("Drivers: hv: Introduce mshv_root module to expose /dev/mshv to VMMs")
    Signed-off-by: Stanislav Kinsburskii <[email protected]>
    Reviewed-by: Anirudh Rayabharam (Microsoft) <[email protected]>
    Signed-off-by: Wei Liu <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

mshv: Order pt_vp_array publish against irqfd assertion path [+ + +]
Author: Stanislav Kinsburskii <[email protected]>
Date:   Thu Jul 23 00:28:11 2026 +0000

    mshv: Order pt_vp_array publish against irqfd assertion path
    
    [ Upstream commit b098dc869219c15dc49bf9cf63fb5fc1481d3373 ]
    
    mshv_partition_ioctl_create_vp() initialises a VP struct (allocations,
    mutex_init, init_waitqueue_head, page mappings) and then publishes the
    pointer into partition->pt_vp_array.  Several ISR paths read this array
    locklessly: the intercept ISR, the two scheduler ISRs, and
    mshv_try_assert_irq_fast() on the irqfd fast path.
    
    Of these, only mshv_try_assert_irq_fast() can structurally race the
    publish.  It runs from an eventfd waker without holding pt_mutex, and
    MSHV_IRQFD does not require the target lapic_apic_id (== vp_index) to
    refer to an existing VP at registration time.  A user can therefore
    register an irqfd targeting a yet-to-be-created VP, then trigger
    mshv_try_assert_irq_fast() concurrently with MSHV_CREATE_VP for the
    same index.  On weakly-ordered architectures the reader can observe a
    non-NULL pointer in pt_vp_array before the initialising stores to the
    VP struct become visible, leading to use of partially-initialised
    fields (e.g. vp_register_page).
    
    The other ISR readers cannot reach this race: the hypervisor will not
    generate intercept or scheduler messages for a VP that has never been
    told to run, and the user can only call MSHV_RUN_VP on the VP fd
    returned by MSHV_CREATE_VP, which by construction is returned after
    the publish.  Leave those readers as plain loads.
    
    Use smp_store_release() in mshv_partition_ioctl_create_vp() to publish
    the pointer, and pair it with smp_load_acquire() in
    mshv_try_assert_irq_fast().  On x86 these compile to plain accesses
    under TSO; on ARM64 they emit one-instruction acquire/release barriers,
    acceptable on this fast path.
    
    The destroy-side path (destroy_partition() clearing pt_vp_array[i] to
    NULL after kfree(vp)) has a separate ordering and lifetime concern
    that is out of scope here.
    
    Fixes: 621191d709b14 ("Drivers: hv: Introduce mshv_root module to expose /dev/mshv to VMMs")
    Signed-off-by: Stanislav Kinsburskii <[email protected]>
    Reviewed-by: Anirudh Rayabharam (Microsoft) <[email protected]>
    Signed-off-by: Wei Liu <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
net/handshake: Close the submit-side sock_hold race [+ + +]
Author: Chuck Lever <[email protected]>
Date:   Thu Aug 6 01:40:04 2026 +0800

    net/handshake: Close the submit-side sock_hold race
    
    [ Upstream commit 5da98f55b13173c08f003011b76531b25c821c07 ]
    
    handshake_req_submit() publishes the request via
    handshake_req_hash_add() and __add_pending_locked(), drops
    hn_lock, and calls handshake_genl_notify() (which can sleep)
    before taking sock_hold() on req->hr_sk. A fast tlshd ACCEPT
    followed by DONE can drive handshake_complete()'s sock_put()
    into the window between the spin_unlock and the late
    sock_hold(); on a system where the consumer's fd held the
    only sk reference, the late sock_hold() then operates on an
    sk whose refcount has reached zero.
    
    The preceding two patches install an explicit file reference
    on struct handshake_req. That file pins sock->file, which
    pins the embedded struct socket, which defers inet_release()'s
    sock_put(). As long as hr_file is held, sk cannot reach refcount
    zero from the consumer side, and the submit-side sock_hold()
    with its matching sock_put() calls in handshake_complete() and
    handshake_req_cancel() is now redundant.
    
    Drop all three. The file reference already keeps each request's
    socket alive, and the lifetime story is contained in a single
    get_file()/fput() pair.
    
    Fixes: 3b3009ea8abb ("net/handshake: Create a NETLINK service for handling handshake requests")
    Signed-off-by: Chuck Lever <[email protected]>
    Reviewed-by: Hannes Reinecke <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    (cherry picked from commit 5da98f55b13173c08f003011b76531b25c821c07)
    Signed-off-by: Wentao Guan <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net/handshake: convert handshake_nl_accept_doit() to FD_PREPARE() [+ + +]
Author: Christian Brauner <[email protected]>
Date:   Thu Aug 6 01:39:56 2026 +0800

    net/handshake: convert handshake_nl_accept_doit() to FD_PREPARE()
    
    [ Upstream commit fe67b063f687d8f32c466778aad57508bc1c618a ]
    
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Christian Brauner <[email protected]>
    (cherry picked from commit fe67b063f687d8f32c466778aad57508bc1c618a)
    Signed-off-by: Wentao Guan <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net/handshake: Drain pending requests at net namespace exit [+ + +]
Author: Chuck Lever <[email protected]>
Date:   Thu Aug 6 01:40:06 2026 +0800

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

net/handshake: Fix null-ptr-deref in handshake_complete() [+ + +]
Author: Wang Liang <[email protected]>
Date:   Thu Aug 6 01:39:58 2026 +0800

    net/handshake: Fix null-ptr-deref in handshake_complete()
    
    [ Upstream commit dabac51b8102e1643d8e297a8e6948dab190aa4c ]
    
    A null pointer dereference in handshake_complete() was observed [1].
    
    When handshake_req_next() return NULL in handshake_nl_accept_doit(),
    function handshake_complete() will be called unexpectedly which triggers
    this crash. Fix it by goto out_status when req is NULL.
    
    [1]
    Oops: general protection fault, probably for non-canonical address 0xdffffc0000000005: 0000 [#1] SMP KASAN PTI
    RIP: 0010:handshake_complete+0x36/0x2b0 net/handshake/request.c:288
    Call Trace:
     <TASK>
     handshake_nl_accept_doit+0x32d/0x7e0 net/handshake/netlink.c:129
     genl_family_rcv_msg_doit+0x204/0x300 net/netlink/genetlink.c:1115
     genl_family_rcv_msg+0x436/0x670 net/netlink/genetlink.c:1195
     genl_rcv_msg+0xcc/0x170 net/netlink/genetlink.c:1210
     netlink_rcv_skb+0x14c/0x430 net/netlink/af_netlink.c:2550
     genl_rcv+0x2d/0x40 net/netlink/genetlink.c:1219
     netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
     netlink_unicast+0x878/0xb20 net/netlink/af_netlink.c:1344
     netlink_sendmsg+0x897/0xd70 net/netlink/af_netlink.c:1894
     sock_sendmsg_nosec net/socket.c:727 [inline]
     __sock_sendmsg net/socket.c:742 [inline]
     ____sys_sendmsg+0xa39/0xbf0 net/socket.c:2592
     ___sys_sendmsg+0x121/0x1c0 net/socket.c:2646
     __sys_sendmsg+0x155/0x200 net/socket.c:2678
     do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
     do_syscall_64+0x5f/0x350 arch/x86/entry/syscall_64.c:94
     entry_SYSCALL_64_after_hwframe+0x76/0x7e
     </TASK>
    
    Fixes: fe67b063f687 ("net/handshake: convert handshake_nl_accept_doit() to FD_PREPARE()")
    Reviewed-by: Chuck Lever <[email protected]>
    Reported-by: Dan Carpenter <[email protected]>
    Closes: https://lore.kernel.org/kernel-tls-handshake/[email protected]/T/#m7cfa5c11efc626d77622b2981591197a2acdd65e
    Signed-off-by: Wang Liang <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    
    (cherry picked from commit dabac51b8102e1643d8e297a8e6948dab190aa4c)
    Signed-off-by: Wentao Guan <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net/handshake: hand off the pinned file reference to accept_doit [+ + +]
Author: Chuck Lever <[email protected]>
Date:   Thu Aug 6 01:40:02 2026 +0800

    net/handshake: hand off the pinned file reference to accept_doit
    
    [ Upstream commit f4251190e58b209999c1ba9e6d2976136a1be055 ]
    
    handshake_req_next() removes the request from the per-net
    pending list and drops hn_lock before handshake_nl_accept_doit()
    reads req->hr_sk->sk_socket and dereferences sock->file (once in
    FD_PREPARE() and again in get_file()).  In that window a
    consumer running tls_handshake_cancel() followed by sockfd_put()
    (svc_sock_free) or __fput_sync() (xs_reset_transport) releases
    sock->file.  sock_release() then runs sock_orphan(), zeroing
    sk_socket, and frees the struct socket.  The accept-side code
    either reads NULL through sk_socket or chases freed memory.
    
    The submit-side sock_hold() does not prevent this.  sk_refcnt
    protects struct sock, but struct socket and sock->file are
    independently refcounted via the file descriptor the consumer
    owns.  Pinning sk leaves sock and sock->file unprotected.
    
    Retarget the accept-side dereferences at req->hr_file, which was
    pinned at submit time, instead of req->hr_sk->sk_socket->file.
    Pinning on its own is not sufficient: a consumer that cancels
    between handshake_req_next() returning and accept_doit reaching
    FD_PREPARE() takes the !remove_pending() branch in
    handshake_req_cancel() and drops hr_file before the accept side
    takes its own reference.  Hand off an additional file reference
    inside handshake_req_next(), under hn_lock, so the accept side
    operates on a reference that no concurrent handshake_req_cancel()
    can revoke.  FD_PREPARE() consumes that handed-off reference,
    either by transferring it to the new fd in fd_publish() or by
    dropping it in the cleanup destructor on error; the explicit
    get_file() that previously balanced FD_PREPARE() is therefore
    redundant and goes away.
    
    Update handshake_req_cancel_test2 and _test3 to simulate the
    FD_PREPARE() consumption with an fput() so the kunit file-count
    assertions stay balanced.
    
    Reported-by: Chris Mason <[email protected]>
    Fixes: 3b3009ea8abb ("net/handshake: Create a NETLINK service for handling handshake requests")
    Signed-off-by: Chuck Lever <[email protected]>
    Reviewed-by: Hannes Reinecke <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    (cherry picked from commit f4251190e58b209999c1ba9e6d2976136a1be055)
    Signed-off-by: Wentao Guan <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net/handshake: Take a long-lived file reference at submit [+ + +]
Author: Chuck Lever <[email protected]>
Date:   Thu Aug 6 01:40:00 2026 +0800

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

 
net/smc: fix socket use-after-free during link group termination [+ + +]
Author: Xuanqiang Luo <[email protected]>
Date:   Thu Jul 23 18:54:54 2026 +0800

    net/smc: fix socket use-after-free during link group termination
    
    commit f621d6ebeebb6374342571e4ddf45fdbc420f6cd upstream.
    
    __smc_lgr_terminate() drops conns_lock after finding a connection in
    lgr->conns_all, but before taking a reference on its socket. The connection
    is embedded in the socket, and its registration reference protects it only
    while the connection remains in the tree.
    
    A concurrent close can unregister the connection and drop that reference,
    freeing the socket before the termination worker reaches sock_hold().
    
    The race is reachable when close overlaps link group termination.
    Local stress testing reproduced the use-after-free and KASAN reported:
    
      BUG: KASAN: slab-use-after-free in __smc_lgr_terminate.part.0 [smc]
      Write of size 4 by task kworker/3:3
      Workqueue: events smc_lgr_terminate_work [smc]
      __smc_lgr_terminate.part.0 [smc]
    
    The socket was allocated by smc_create(), freed through
    slab_free_after_rcu_debug(), and was followed by:
    
      refcount_t: addition on 0; use-after-free.
      __smc_lgr_terminate.part.0 [smc]
    
    Take the socket reference while conns_lock still protects the tree entry.
    The unregister path then cannot drop the last reference until termination
    has finished using the socket.
    
    Fixes: 69318b5215f2 ("net/smc: improve abnormal termination locking")
    Cc: [email protected]
    Signed-off-by: Xuanqiang Luo <[email protected]>
    Reviewed-by: Mahanta Jambigi <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
net: bridge: mrp: fix Option TLV length in MRP_Test frames [+ + +]
Author: David Corvaglia <[email protected]>
Date:   Sun Jul 26 06:26:05 2026 +0000

    net: bridge: mrp: fix Option TLV length in MRP_Test frames
    
    [ Upstream commit 5546da86894d5906f131b05890705a7abf949d84 ]
    
    oui is a pointer, so sizeof(oui) is the pointer size. The MRA
    Option TLV thus advertises a wrong length (15 vs 10 on x86_64),
    causing misparsing of the frame on peers. Fix is to replace
    with sizeof(*oui).
    
    Fixes: f7458934b079 ("net: bridge: mrp: Update the Test frames for MRA")
    Signed-off-by: David Corvaglia <[email protected]>
    Acked-by: Nikolay Aleksandrov <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: bridge: stop fast-leave after deleting a port group [+ + +]
Author: Zhiling Zou <[email protected]>
Date:   Fri Jul 24 00:52:48 2026 +0800

    net: bridge: stop fast-leave after deleting a port group
    
    commit a39789f211b8a4125f0c70e05b30cf715f4f187d upstream.
    
    br_multicast_leave_group() iterates mp->ports with pp = &p->next in
    its fast-leave path. After br_multicast_del_pg() removes p,
    continuing the loop advances pp through the deleted entry.
    
    If multicast-to-unicast was enabled, the bridge can hold multiple port
    groups for the same port and group with different source MAC
    addresses. Once multicast-to-unicast is disabled,
    br_port_group_equal() matches those entries by port only. A fast leave
    can then delete one entry and continue from its stale next pointer,
    leaving mp->ports pointing at a deleted port group.
    
    Fast leave only needs to remove one matching port group. Break after
    br_multicast_del_pg() so the loop stops before dereferencing the
    removed entry.
    
    Fixes: 6db6f0eae605 ("bridge: multicast to unicast")
    Cc: [email protected]
    Reported-by: Vega <[email protected]>
    Signed-off-by: Zhiling Zou <[email protected]>
    Signed-off-by: Ren Wei <[email protected]>
    Acked-by: Nikolay Aleksandrov <[email protected]>
    Link: https://patch.msgid.link/1cf0898872ef7c72d5f4c0304414a192c6dac591.1784707712.git.zhilinz@nebusec.ai
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: do not send ICMP/NDISC Redirects when peer allocation fails [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Fri Jul 24 07:29:01 2026 +0000

    net: do not send ICMP/NDISC Redirects when peer allocation fails
    
    [ Upstream commit dbc3791e3b2472e1ccc08947e0f83b443470ff4f ]
    
    When inet_getpeer_v4() or inet_getpeer_v6() fails to allocate a peer entry
    under memory pressure or tree size caps, redirect handlers previously fell
    back to sending un-rate-limited ICMP/NDISC Redirect messages.
    
    In IPv4, ip_rt_send_redirect() called icmp_send() directly when peer == NULL.
    In IPv6, ip6_forward() and ndisc_send_redirect() passed a NULL peer into
    inet_peer_xrlim_allow(), which returned true when peer == NULL.
    
    Because ICMP/NDISC Redirects are not part of the default global rate limit
    mask (sysctl_icmp_ratemask), sending redirects when peer == NULL creates
    an un-rate-limited ICMP packet storm.
    
    Fix this by failing closed in ip_rt_send_redirect(), ip6_forward(), and
    ndisc_send_redirect() when peer is NULL.
    
    Fixes: 92d868292634 ("inetpeer: Move ICMP rate limiting state into inet_peer entries.")
    Signed-off-by: Eric Dumazet <[email protected]>
    Reviewed-by: Ido Schimmel <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: dsa: mt7530: check bus->read() errors in the MDIO regmap backend [+ + +]
Author: Daniel Golle <[email protected]>
Date:   Tue Jul 28 05:52:14 2026 +0100

    net: dsa: mt7530: check bus->read() errors in the MDIO regmap backend
    
    [ Upstream commit b4ce102b2cd88424c5860fbbb20b9eb343a93bf4 ]
    
    bus->read() returns a negative errno on failure, but
    mt7530_regmap_read() assigns it to a u16, truncating e.g. -ETIMEDOUT
    into 0xff92, and returns success. The garbage word is then consumed as
    register data, and read-modify-write cycles write it back to the
    switch. Check both reads and propagate their errors.
    
    The same defect existed in mt7530_mii_read() since the driver was
    introduced and moved into the regmap backend unchanged.
    
    Fixes: b8f126a8d543 ("net-next: dsa: add dsa support for Mediatek MT7530 switch")
    Signed-off-by: Daniel Golle <[email protected]>
    Reviewed-by: Andrew Lunn <[email protected]>
    Link: https://patch.msgid.link/3c628e48276c2e5522c8795a6be60d11c7a76a7d.1785213071.git.daniel@makrotopia.org
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: dsa: mt7530: error out on failed reads in MT7531 PHY polling [+ + +]
Author: Daniel Golle <[email protected]>
Date:   Tue Jul 28 05:52:29 2026 +0100

    net: dsa: mt7530: error out on failed reads in MT7531 PHY polling
    
    [ Upstream commit 77a9ebe8818cf6dd1699bd6728cb5d66307801d7 ]
    
    The MT7531 indirect PHY access functions poll MT7531_PHY_IAC through
    a helper which returns 0 when the underlying read fails, so a failed
    bus transaction clears MT7531_PHY_ACS_ST and the access carries on,
    returning garbage PHY register data to phylib.
    
    Poll using regmap_read_poll_timeout(), which stops on read errors and
    propagates them. These functions hold the MDIO bus lock across the
    whole sequence, so the unlocked regmap accesses remain correct. Remove
    the now-unused _mt7530_unlocked_read().
    
    Fixes: c288575f7810 ("net: dsa: mt7530: Add the support of MT7531 switch")
    Signed-off-by: Daniel Golle <[email protected]>
    Reviewed-by: Andrew Lunn <[email protected]>
    Link: https://patch.msgid.link/79e85d68d210cc37342978171aa6432aa2954333.1785213071.git.daniel@makrotopia.org
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: ethernet: mtk_eth_soc: pass eth to mtk_handle_irq_rx in poll_controller [+ + +]
Author: Chenguang Zhao <[email protected]>
Date:   Thu Jul 23 13:57:35 2026 +0800

    net: ethernet: mtk_eth_soc: pass eth to mtk_handle_irq_rx in poll_controller
    
    [ Upstream commit e095f249e2209674f6366f6db0383a2b96e19239 ]
    
    mtk_handle_irq_rx expects a struct mtk_eth * (matching the request_irq
    cookie), but mtk_poll_controller incorrectly passed the net_device *.
    Calling ndo_poll_controller with CONFIG_NET_POLL_CONTROLLER enabled
    would then crash.
    
    Fixes: 8186f6e382d8 ("net-next: mediatek: fix compile error inside mtk_poll_controller()")
    Signed-off-by: Chenguang Zhao <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: ipv6: clear suppressed fib6 rule result [+ + +]
Author: Zhiling Zou <[email protected]>
Date:   Fri Jul 24 00:48:52 2026 +0800

    net: ipv6: clear suppressed fib6 rule result
    
    commit 6aea62e433fe1b586202a5fee8b5807ce635e1d7 upstream.
    
    fib6_rule_suppress() drops a suppressed route with ip6_rt_put_flags(),
    but leaves res->rt6 pointing at the released rt6_info.
    
    If no later rule supplies a replacement, fib6_rule_lookup() still sees
    res.rt6 and returns that stale dst to its caller. A suppressing rule can
    therefore leak a released route back to rt6_lookup(), and the next put
    hits rcuref_put_slowpath() from dst_release().
    
    Clear res->rt6 when suppressing the route so suppressed lookups fall
    through to the null dst instead of reusing the released one.
    
    Fixes: cdef485217d3 ("ipv6: fix memory leak in fib6_rule_suppress")
    Cc: [email protected]
    Reported-by: Vega <[email protected]>
    Signed-off-by: Zhiling Zou <[email protected]>
    Signed-off-by: Ren Wei <[email protected]>
    Reviewed-by: Ido Schimmel <[email protected]>
    Link: https://patch.msgid.link/4b8acb7787d54e440155585dd32ebdf0bef7d122.1784710966.git.zhilinz@nebusec.ai
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: libwx: fix FDIR ATR queue mismatch for software VLAN packets [+ + +]
Author: Jiawen Wu <[email protected]>
Date:   Fri Jul 24 15:46:57 2026 +0800

    net: libwx: fix FDIR ATR queue mismatch for software VLAN packets
    
    [ Upstream commit 732ed8f75ce583d115716f668dc80d730f3ad610 ]
    
    When TX VLAN hardware offload is disabled, VLAN tags are embedded in
    the packet payload (software VLAN). Previously, the driver failed to
    set the WX_TX_FLAGS_SW_VLAN flag for these packets during transmission.
    
    This missing flag caused the txgbe FDIR ATR logic to fall through to the
    default hash calculation path. This resulted in asymmetric hash values
    for Tx and Rx flows, preventing return packets from being steered to the
    same queue as the transmit packets.
    
    Fix this by detecting software VLANs via eth_type_vlan(skb->protocol)
    and setting WX_TX_FLAGS_SW_VLAN. This ensures the ATR feature selects
    the correct hashing algorithm to maintain Tx/Rx queue symmetry.
    
    Fixes: b501d261a5b3 ("net: txgbe: add FDIR ATR support")
    Signed-off-by: Jiawen Wu <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: mpls: initialize rtm_tos in mpls_getroute() [+ + +]
Author: Yehyeong Lee <[email protected]>
Date:   Thu Jul 23 10:08:29 2026 +0900

    net: mpls: initialize rtm_tos in mpls_getroute()
    
    [ Upstream commit 295dd295e2137e10e9a5b1891d97e0f08de76f03 ]
    
    mpls_getroute() builds the RTM_NEWROUTE reply to an RTM_GETROUTE
    request by filling a struct rtmsg allocated from an skb whose data
    area is not zeroed (alloc_skb(NLMSG_GOODSIZE, ...)). It sets every
    field of the header except rtm_tos:
    
            r = nlmsg_data(nlh);
            r->rtm_family    = AF_MPLS;
            r->rtm_dst_len  = 20;
            r->rtm_src_len  = 0;
            r->rtm_table    = RT_TABLE_MAIN;
            r->rtm_type     = RTN_UNICAST;
            r->rtm_scope    = RT_SCOPE_UNIVERSE;
            r->rtm_protocol = rt->rt_protocol;
            r->rtm_flags    = 0;
    
    struct rtmsg has no padding, so the one uninitialised byte rtm_tos
    (offset 3) is copied straight to user space on recvmsg(), leaking a
    byte of uninitialised heap memory. This is in contrast to
    mpls_dump_route(), which fills the very same header and does set
    rtm_tos = 0.
    
    Initialize rtm_tos to 0, matching mpls_dump_route().
    
    Reproduced with KMSAN by adding an MPLS route and issuing a
    non-RTM_F_FIB_MATCH RTM_GETROUTE for its label:
    
      BUG: KMSAN: kernel-infoleak in _copy_to_iter+0x36c/0x33f0
       _copy_to_iter+0x36c/0x33f0
       __skb_datagram_iter+0x196/0x12c0
       skb_copy_datagram_iter+0x5b/0x210
       netlink_recvmsg+0x37b/0xef0
       ...
      Uninit was created at:
       __alloc_skb+0x8ca/0x10e0
       mpls_getroute+0x1280/0x3a40
       rtnetlink_rcv_msg+0x1138/0x15a0
       ...
      Byte 19 of 64 is uninitialized
    
    (byte 19 = nlmsghdr(16) + rtmsg offset 3 = rtm_tos)
    
    Fixes: 397fc9e5cefe ("mpls: route get support")
    Signed-off-by: Yehyeong Lee <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: openvswitch: fix potential UAF on meter attach failure [+ + +]
Author: Ilya Maximets <[email protected]>
Date:   Mon Jul 27 14:10:21 2026 +0200

    net: openvswitch: fix potential UAF on meter attach failure
    
    commit a58a2b0ce354df531ebc71fc870058c2feb59f6b upstream.
    
    While attaching a newly created meter attach_meter() function makes
    the new meter visible to other CPUs but can still fail afterwards.
    On failure, it detaches the meter back and returns an error.
    
    However, this is an unexpected behavior for the ovs_meter_cmd_set()
    that uses a plain kfree(meter) on attach failure without waiting for
    RCU readers to stop using it, assuming it was never visible.
    
    This is never a problem for ovs-vswitchd as it always creates meters
    before creating any flows that use them.  But the UAF can be triggered
    with a custom application using uAPI:
    
     BUG: KASAN: slab-use-after-free in ovs_meter_execute (net/openvswitch/meter.c:653)
     Read of size 8 at addr ffff88810d152650 by task meter/2508
    
     Call Trace:
      ovs_meter_execute (net/openvswitch/meter.c:653)
      do_execute_actions (net/openvswitch/actions.c:1407)
      ovs_execute_actions (net/openvswitch/actions.c:1584)
      ovs_packet_cmd_execute (net/openvswitch/datapath.c:703)
      ...
      netlink_sendmsg (af_netlink.c:1900)
    
     Allocated by task 2519:
      __kasan_kmalloc (mm/kasan/common.c:398 mm/kasan/common.c:415)
      ovs_meter_cmd_set (net/openvswitch/meter.c:422)
      ...
      netlink_sendmsg (af_netlink.c:1900)
    
     Freed by task 2519:
      kfree (mm/slub.c:2705 mm/slub.c:6405 mm/slub.c:6720)
      ovs_meter_cmd_set (net/openvswitch/meter.c:479)
      ...
      netlink_sendmsg (af_netlink.c:1900)
    
    Fix that by making sure attach_meter() doesn't make the meter visible
    until all the checks are done and the function can't fail anymore.
    
    This also makes sure the "hash" value is calculated after the potential
    re-sizing of the table.
    
    Reported by Trend Micro's Zero Day Initiative as ZDI-CAN-31642.
    
    Fixes: c7c4c44c9a95 ("net: openvswitch: expand the meters supported number")
    Cc: [email protected]
    Signed-off-by: Ilya Maximets <[email protected]>
    Reviewed-by: Eelco Chaudron <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: openvswitch: fix skb leak on flow key update failure during ct [+ + +]
Author: Ilya Maximets <[email protected]>
Date:   Mon Jul 27 20:18:31 2026 +0200

    net: openvswitch: fix skb leak on flow key update failure during ct
    
    commit bc62e843bc48f933da765ce47079fd992e535794 upstream.
    
    ovs_ct_execute() always steals or frees the skb on failure while
    ovs_flow_key_update() does not.  So, if it fails and we return right
    away, the skb ends up leaked.
    
    Fix that by breaking instead and letting the common error handling
    code at the bottom of the loop to free the skb properly.
    
    This is a very unlikely scenario as it requires the packet to become
    unparseable by applying a set of actions on a previously parseable skb,
    but should be fixed nevertheless.
    
    Reported by Sashiko.
    
    Fixes: ec0d043d05e6 ("openvswitch: Ensure flow is valid before executing ct")
    Cc: [email protected]
    Signed-off-by: Ilya Maximets <[email protected]>
    Reviewed-by: Aaron Conole <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: openvswitch: fix skb leak on flow key update failure during recirculation [+ + +]
Author: Ilya Maximets <[email protected]>
Date:   Mon Jul 27 20:18:30 2026 +0200

    net: openvswitch: fix skb leak on flow key update failure during recirculation
    
    commit e1cf066244dad576221b7123a0e5005967f25a20 upstream.
    
    do_execute_actions() returns right away when execute_recirc() fails on
    the last action as it assumes this function always takes ownership of
    the skb when 'last' is true.  But when the flow key update fails, the
    function doesn't free the skb and it ends up leaked.
    
    This is a very unlikely scenario as it requires the packet to become
    unparseable by applying a set of actions on a previously parseable skb,
    but should be fixed nevertheless.
    
    Reported by Sashiko.
    
    Fixes: 971427f353f3 ("openvswitch: Add recirc and hash action.")
    Cc: [email protected]
    Signed-off-by: Ilya Maximets <[email protected]>
    Reviewed-by: Aaron Conole <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: phylink: put link_gpio if phylink_create fails [+ + +]
Author: Christian Marangi <[email protected]>
Date:   Sun Jul 26 17:08:05 2026 +0200

    net: phylink: put link_gpio if phylink_create fails
    
    [ Upstream commit 0fe1e3e8f3380d7862296a73b528d164e96c76b8 ]
    
    In phylink_create() if phylink_register_sfp() returns an error, link_gpio
    obtained by phylink_parse_fixedlink() is never released. While this is a
    very unlikely scenario, it's worth to fix/handle this.
    
    This was present from the very first implementation of phylink but got
    relevant only with the introduction of ce0aa27ff3f6 ("sfp: add sfp-bus to
    bridge between network devices and sfp cages") where additional function
    were added after phylink_parse_fixedlink() making the release of link_gpio
    needed if such additional function errored out.
    
    While at it, restructure the exit condition of phylink_create() with the
    goto pattern to reduce code duplication on handling error conditions.
    
    Fixes: ce0aa27ff3f6 ("sfp: add sfp-bus to bridge between network devices and sfp cages")
    Signed-off-by: Christian Marangi <[email protected]>
    Reviewed-by: Andrew Lunn <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: pktgen: fix proc entry use-after-free [+ + +]
Author: Chengfeng Ye <[email protected]>
Date:   Sun Jul 19 22:57:40 2026 +0800

    net: pktgen: fix proc entry use-after-free
    
    commit 817ff6efdb7f484ea547218e11e17d8e43daa3b4 upstream.
    
    pktgen_change_name() replaces pkt_dev->entry while holding t->if_lock.
    pktgen_remove_device() removes the same entry before
    _rem_dev_from_if_list() takes that lock.
    
    This allows the following interleaving:
    
      CPU 0 (NETDEV_CHANGENAME)       CPU 1 (kpktgend)
      if_lock(t)
      proc_remove(pkt_dev->entry)
                                      proc_remove(pkt_dev->entry)
      pkt_dev->entry = proc_create_data(...)
      if_unlock(t)
    
    The kthread can pass the stale proc_dir_entry to proc_remove() after the
    rename path has freed it. A reproducer with a widened race window reports:
    
      BUG: KASAN: slab-use-after-free in proc_remove+0x78/0x80
      Read of size 8 at addr ffff8881478fea70 by task kpktgend_0/67
      Call Trace:
       proc_remove+0x78/0x80
       pktgen_remove_device.isra.0+0x11c/0x4c0
       pktgen_thread_worker+0x1214/0x6bc0
       kthread+0x2c6/0x3b0
      Allocated by task 95:
       __proc_create+0x204/0x790
       proc_create_data+0x72/0xe0
       pktgen_thread_write+0xd61/0x1510
      Freed by task 28:
       kmem_cache_free+0xcb/0x3d0
       proc_free_inode+0x5b/0x80
       rcu_core+0x50a/0x1850
      The buggy address belongs to the object at ffff8881478fea00
       which belongs to the cache proc_dir_entry of size 192
    
    Move proc_remove() into the if_lock-protected list removal helper. Keep it
    before list_del_rcu() to preserve the ordering required by add_device().
    The rename path must then finish replacing the entry before removal, or
    it observes that the device is no longer on the list.
    
    Fixes: 39df232f1a9b ("[PKTGEN]: fix device name handling")
    Cc: [email protected]
    Signed-off-by: Chengfeng Ye <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: sxgbe: check descriptor ring allocation failures [+ + +]
Author: Chenguang Zhao <[email protected]>
Date:   Thu Jul 23 10:18:20 2026 +0800

    net: sxgbe: check descriptor ring allocation failures
    
    [ Upstream commit 51b093a7ba27476e1f639455f005e8d2e75390e4 ]
    
    sxgbe_open() ignores the return value of init_dma_desc_rings() and
    continues to program DMA with invalid ring addresses when allocation
    fails. Check the return value and disconnect the PHY on failure.
    
    Fixes: 1edb9ca69e8a ("net: sxgbe: add basic framework for Samsung 10Gb ethernet driver")
    Signed-off-by: Chenguang Zhao <[email protected]>
    Reviewed-by: Vadim Fedorenko <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: sxgbe: free TX rings on RX allocation failure [+ + +]
Author: Chenguang Zhao <[email protected]>
Date:   Thu Jul 23 10:18:19 2026 +0800

    net: sxgbe: free TX rings on RX allocation failure
    
    [ Upstream commit c870f7e2890b9f78ac84515a9809cc5c183c975e ]
    
    When RX descriptor ring allocation fails, init_dma_desc_rings() only
    frees the partially allocated RX rings and returns. The TX rings that
    were allocated earlier in the same function are leaked.
    
    Rearrange error labels to clean up TX rings upon RX failures.
    
    Fixes: 1edb9ca69e8a ("net: sxgbe: add basic framework for Samsung 10Gb ethernet driver")
    Signed-off-by: Chenguang Zhao <[email protected]>
    Reviewed-by: Vadim Fedorenko <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: udp_tunnel: fix memory leak in udp_tunnel_nic_unregister() [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Fri Jul 24 09:11:37 2026 +0000

    net: udp_tunnel: fix memory leak in udp_tunnel_nic_unregister()
    
    [ Upstream commit 080695e6f005e2396f1207fd69d24c442cb230c6 ]
    
    syzbot reported a memory leak [1] in the UDP tunnel NIC offload code.
    
    When device registration fails (e.g. in register_netdevice()), netdev core
    unwinds by sending a single NETDEV_UNREGISTER notification. If work was queued
    during NETDEV_REGISTER (utn->work_pending is set), udp_tunnel_nic_unregister()
    returns early:
    
            if (utn->work_pending)
                    return;
    
    Because failed registrations do not enter netdev_wait_allrefs_any(), no
    subsequent NETDEV_UNREGISTER rebroadcast will ever occur. As a result, the
    struct udp_tunnel_nic allocated in udp_tunnel_nic_alloc() is leaked
    permanently.
    
    Fix this by removing the early return. Instead, synchronously cancel any
    pending work with cancel_delayed_work_sync() before freeing @utn.
    
    To be able to call cancel_delayed_work_sync() while holding RTNL (the work also
    needs RTNL), switch udp_tunnel_nic_device_sync_work() to rtnl_trylock(). If RTNL
    is contended, requeue the work with a 1 jiffy delay (via queue_delayed_work())
    to prevent high CPU contention while waiting for RTNL lock.
    
    The utn->work_pending bookkeeping is no longer needed and is removed, as
    the workqueue core already tracks the pending/running state of the work.
    
    [1]
    BUG: memory leak
    unreferenced object 0xffff888127d5f840 (size 96):
      comm "syz-executor", pid 5806, jiffies 4294942188
      backtrace (crc 99fdb6c8):
        __kmalloc_noprof+0x3bf/0x550
        udp_tunnel_nic_alloc net/ipv4/udp_tunnel_nic.c:756 [inline]
        udp_tunnel_nic_register net/ipv4/udp_tunnel_nic.c:833 [inline]
        udp_tunnel_nic_netdevice_event+0x804/0xab0 net/ipv4/udp_tunnel_nic.c:931
        notifier_call_chain+0x59/0x160 kernel/notifier.c:85
        call_netdevice_notifiers_info+0x7d/0xb0 net/core/dev.c:2250
        register_netdevice+0xc10/0xeb0 net/core/dev.c:11478
    
    Fixes: cc4e3835eff4 ("udp_tunnel: add central NIC RX port offload infrastructure")
    Reported-by: [email protected]
    Closes: https://lore.kernel.org/netdev/[email protected]/T/#u
    Signed-off-by: Eric Dumazet <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
netfilter: br_netfilter: Reallocate headroom if necessary in neigh_hh_bridge() [+ + +]
Author: Lorenzo Bianconi <[email protected]>
Date:   Thu May 14 16:46:38 2026 +0200

    netfilter: br_netfilter: Reallocate headroom if necessary in neigh_hh_bridge()
    
    [ Upstream commit b2870fc21601db9133bc70c48c603b487614fa3b ]
    
    neigh_hh_bridge() assumes the skb always has sufficient headroom to copy
    the aligned  L2 header. This assumption can trigger the crash reported
    below using the following netfilter setup:
    
    $modprobe br_netfilter
    $sysctl -w net.bridge.bridge-nf-call-iptables=1
    
    $root@OpenWrt:~# nft list ruleset
    table ip nat {
            chain prerouting {
                    type nat hook prerouting priority dstnat; policy accept;
                    ip daddr 192.168.83.123 dnat to 192.168.83.120
            }
    }
    
    - iperf3 client (192.168.83.119) --> bridge (192.168.83.118) --> iperf3 server (192.168.83.120)
    
    the iperf3 client is sending packet for 192.168.83.123 to the bridge device.
    
    [ 1579.036575] Unable to handle kernel write to read-only memory at virtual address ffffff8004d76ffe
    [ 1579.045482] Mem abort info:
    [ 1579.048273]   ESR = 0x000000009600004f
    [ 1579.052024]   EC = 0x25: DABT (current EL), IL = 32 bits
    [ 1579.057363]   SET = 0, FnV = 0
    [ 1579.060417]   EA = 0, S1PTW = 0
    [ 1579.063550]   FSC = 0x0f: level 3 permission fault
    [ 1579.068345] Data abort info:
    [ 1579.071224]   ISV = 0, ISS = 0x0000004f, ISS2 = 0x00000000
    [ 1579.076720]   CM = 0, WnR = 1, TnD = 0, TagAccess = 0
    [ 1579.081770]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
    [ 1579.087092] swapper pgtable: 4k pages, 39-bit VAs, pgdp=0000000080dc4000
    [ 1579.093794] [ffffff8004d76ffe] pgd=180000009ffff003, p4d=180000009ffff003, pud=180000009ffff003, pmd=180000009ffe3003, pte=0060000084d76787
    [ 1579.106343] Internal error: Oops: 000000009600004f [#1] SMP
    [ 1579.193824] CPU: 0 UID: 0 PID: 235 Comm: napi/qdma_eth-3 Tainted: G           O       6.12.57 #0
    [ 1579.202614] Tainted: [O]=OOT_MODULE
    [ 1579.206102] Hardware name: Airoha AN7581 Evaluation Board (DT)
    [ 1579.211929] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    [ 1579.218889] pc : br_nf_pre_routing_finish_bridge+0x1ac/0xcc8 [br_netfilter]
    [ 1579.225859] lr : br_nf_pre_routing_finish_bridge+0x18c/0xcc8 [br_netfilter]
    [ 1579.232822] sp : ffffffc0817cba20
    [ 1579.236128] x29: ffffffc0817cba20 x28: 0000000000000000 x27: ffffff8002b89000
    [ 1579.243273] x26: ffffff8004d7700e x25: 0000000000000008 x24: 0000000000000000
    [ 1579.250416] x23: ffffffc08179d4c0 x22: 0000000000000000 x21: ffffffc08179d4c0
    [ 1579.257561] x20: ffffff8004d9b800 x19: ffffff8015010000 x18: 0000000000000014
    [ 1579.264704] x17: ffffffbf9e930000 x16: ffffffc0817c8000 x15: 0000000000000070
    [ 1579.271848] x14: 0000000000000080 x13: 0000000000000001 x12: 0000000000000000
    [ 1579.278993] x11: ffffffc0798caae0 x10: ffffff8014db6fd8 x9 : 0000000000000000
    [ 1579.286136] x8 : 0000000000000003 x7 : ffffffc08171f628 x6 : 000000001a3b83d3
    [ 1579.293281] x5 : 0000000000000000 x4 : 1beb76f22fee0000 x3 : ffffff8004d7700e
    [ 1579.300425] x2 : 0000000000000000 x1 : ffffff8004d9b8bc x0 : ffffff80026ed000
    [ 1579.307570] Call trace:
    [ 1579.310018]  br_nf_pre_routing_finish_bridge+0x1ac/0xcc8 [br_netfilter]
    [ 1579.316632]  br_nf_hook_thresh+0xd4/0x14bc [br_netfilter]
    [ 1579.322032]  br_nf_hook_thresh+0x250/0x14bc [br_netfilter]
    [ 1579.327517]  br_nf_hook_thresh+0x76c/0x14bc [br_netfilter]
    [ 1579.333003]  br_handle_frame+0x180/0x480
    [ 1579.336935]  __netif_receive_skb_core.constprop.0+0x540/0xf40
    [ 1579.342682]  __netif_receive_skb_one_core+0x28/0x50
    [ 1579.347561]  process_backlog+0x98/0x1e0
    [ 1579.351398]  __napi_poll+0x34/0x1c4
    [ 1579.354887]  net_rx_action+0x178/0x330
    [ 1579.358638]  handle_softirqs+0x108/0x2d4
    [ 1579.362560]  __do_softirq+0x10/0x18
    [ 1579.366051]  ____do_softirq+0xc/0x20
    [ 1579.369627]  call_on_irq_stack+0x30/0x4c
    [ 1579.373550]  do_softirq_own_stack+0x18/0x20
    [ 1579.377734]  do_softirq+0x4c/0x60
    [ 1579.381050]  __local_bh_enable_ip+0x88/0x98
    [ 1579.385234]  napi_threaded_poll_loop+0x188/0x21c
    [ 1579.389853]  napi_threaded_poll+0x70/0x80
    [ 1579.393863]  kthread+0xd8/0xdc
    [ 1579.396918]  ret_from_fork+0x10/0x20
    [ 1579.400499] Code: 88dffc22 3707ffc2 f9406663 f9406684 (f81f0064)
    [ 1579.406589] ---[ end trace 0000000000000000 ]---
    [ 1579.411209] Kernel panic - not syncing: Oops: Fatal exception in interrupt
    [ 1579.418083] SMP: stopping secondary CPUs
    [ 1579.422012] Kernel Offset: disabled
    
    Fix the issue reallocating the skb headroom if necessary in neigh_hh_bridge routine.
    
    Fixes: e179e6322ac33 ("netfilter: bridge-netfilter: Fix MAC header handling with IP DNAT")
    Reviewed-by: Ido Schimmel <[email protected]>
    Signed-off-by: Lorenzo Bianconi <[email protected]>
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

netfilter: ipset: do not update comments from kernel-side hash adds [+ + +]
Author: David Lee <[email protected]>
Date:   Mon Jul 13 09:59:15 2026 +0000

    netfilter: ipset: do not update comments from kernel-side hash adds
    
    commit f30415929be8aeb002d557c8d3f7ab2d2188003a upstream.
    
    mtype_resize() copies comment pointers with memcpy(), not the comment
    objects themselves. During the window after an entry has been copied but
    before the table swap and backlog replay, the old table is still
    published for packet-side updates while the replacement-table entry
    already holds the same ip_set_comment_rcu pointer.
    
    If xt_SET --add-set ... --exist hits that old entry in this window,
    mtype_add() calls ip_set_init_comment() even though packet-side adds
    carry no comment payload. That call frees the shared comment through the
    old entry, so the replacement-table entry now holds a stale pointer.
    When the queued add is replayed on the new table, mtype_add() calls
    ip_set_init_comment() again and strlen() dereferences the stale pointer.
    
    Fix this in mtype_add() by skipping ip_set_init_comment() when
    ext->target marks a packet-side add. Userspace adds still update
    comments, while packet-side adds can no longer free comment storage
    shared with a resize copy.
    
    Fixes: f66ee0410b1c ("netfilter: ipset: Fix "INFO: rcu detected stall in hash_xxx" reports")
    Cc: [email protected]
    Signed-off-by: David Lee <[email protected]>
    Assisted-by: Codex:gpt-5.5
    Acked-by: Jozsef Kadlecsik <[email protected]>
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

netfilter: nf_conntrack_expect: restore helper propagation via expectation [+ + +]
Author: Pablo Neira Ayuso <[email protected]>
Date:   Thu May 7 13:00:28 2026 +0200

    netfilter: nf_conntrack_expect: restore helper propagation via expectation
    
    [ Upstream commit dcb0f9aefdd604d36710fda53c25bd7cf4a3e37a ]
    
    A recent series to fix expectations broke helper propagation via
    expectation, this mechanism is used by the sip and h323 helper. This
    also propagates the conntrack helper to expected connections. I changed
    semantics of exp->helper which now tells us the actual helper that
    created the expectation.
    
    Add an explicit assign_helper field to expectations for this purpose
    and update helpers to use it.
    
    Restore this feature for userspace conntrack helper via ctnetlink
    nfqueue integration so it is again possible to attach a helper to an
    expectation, where it makes sense. This is not restored via ctnetlink
    expectation creation as there is no client for such feature. Use the
    expectation layer 4 protocol number for the helper lookup for
    consistency.
    
    Make sure the expectation using this helper propagation mechanism also
    go away when the helper is unregistered.
    
    Fixes: 9c42bc9db90a ("netfilter: nf_conntrack_expect: honor expectation helper field")
    Fixes: 917b61fa2042 ("netfilter: ctnetlink: ignore explicit helper on new expectations")
    Reported-by: Ilya Maximets <[email protected]>
    Tested-by: Ilya Maximets <[email protected]>
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
netfilter: nf_conntrack_sip: widen NAT rewrite delta to s32 in sip_help_tcp() [+ + +]
Author: Xiang Mei <[email protected]>
Date:   Sun Jul 12 16:42:01 2026 -0700

    netfilter: nf_conntrack_sip: widen NAT rewrite delta to s32 in sip_help_tcp()
    
    [ Upstream commit db3d0e0e5d4bc5ab4fe445b9f413d1b486508ca5 ]
    
    sip_help_tcp() stores the size change of each NAT-rewritten SIP message
    in s16 diff and accumulates it in s16 tdiff, but a single message can
    grow by more than S16_MAX while the packet stays under the 65535
    enlarge_skb() limit: nf_nat_sip() rewrites every matching URI, and a long
    Contact list expands the message by tens of kilobytes. diff then wraps,
    and "datalen = datalen + diff - msglen" yields a huge unsigned datalen,
    so the next iteration's ct_sip_get_header() reads past the linearized skb
    tail.
    
    Widen diff, tdiff and the seq_adjust hook to s32. Both are bounded by the
    65535 byte packet limit, and the seqadj core is already s32
    (nf_ct_seqadj_set() takes s32), so no previously accepted input is
    rejected.
    
      BUG: KASAN: use-after-free in ct_sip_get_header (net/netfilter/nf_conntrack_sip.c:464)
      Read of size 1 at addr ffff888010800000 by task ksoftirqd/1/25
       ct_sip_get_header (net/netfilter/nf_conntrack_sip.c:464)
       sip_help_tcp (net/netfilter/nf_conntrack_sip.c:1694)
       nf_confirm (net/netfilter/nf_conntrack_proto.c:183)
       nf_hook_slow (net/netfilter/core.c:619)
       ip6_output (net/ipv6/ip6_output.c:246)
       ip6_forward (net/ipv6/ip6_output.c:690)
       ipv6_rcv (net/ipv6/ip6_input.c:351)
       __netif_receive_skb_one_core (net/core/dev.c:6212)
       process_backlog (net/core/dev.c:6676)
       __napi_poll (net/core/dev.c:7735)
       net_rx_action (net/core/dev.c:7955)
       handle_softirqs (kernel/softirq.c:622)
       run_ksoftirqd (kernel/softirq.c:1076)
       ...
    
    Fixes: f5b321bd37fb ("netfilter: nf_conntrack_sip: add TCP support")
    Reported-by: Weiming Shi <[email protected]>
    Link: https://patch.msgid.link/netfilter-devel/[email protected]
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: Xiang Mei <[email protected]>
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

netfilter: nf_tables: make nft_object rhltable per table [+ + +]
Author: Pablo Neira Ayuso <[email protected]>
Date:   Thu Jul 16 10:13:37 2026 +0200

    netfilter: nf_tables: make nft_object rhltable per table
    
    [ Upstream commit f4f699790590bd0896c48a71e9232a65198f92f0 ]
    
    The nft_object rhltable is global, this allows for accessing objects
    that are being dismangled from lookup path by other existing netns.
    Given the nft_obj_destroy() releases the object inmediately, this might
    lead to use-after-free of these objects that are being released.
    Make the existing rhltable per table to address this issue to deal with
    with the nft_rcv_nl_event() path too.
    
    Update nft_obj_lookup() to take the table as non-const, otherwise,
    compiler complains when passing the objname_ht to rhltable_lookup().
    
    Fixes: 4d44175aa5bb ("netfilter: nf_tables: handle nft_object lookups via rhltable")
    Suggested-by: Florian Westphal <[email protected]>
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

netfilter: nft_payload: fix mask build for partial field offload [+ + +]
Author: Xiang Mei (Microsoft) <[email protected]>
Date:   Sun Jul 19 22:15:23 2026 +0000

    netfilter: nft_payload: fix mask build for partial field offload
    
    [ Upstream commit 39e88f28fb32bf02bd4b525c24c842c9cff5663d ]
    
    nft_payload_offload_mask() builds the offload match mask for a payload
    expression that covers only part of a header field.  For a partial IPv6
    address match (field_len = 16, priv_len = 1) that shift is 1 << 120, which
    is undefined on the 32-bit int operand.  It also trims only one word, so
    the remaining words stay 0xffffffff (and when priv_len is a multiple of 4
    the trim is skipped entirely), leaving the mask covering more bytes than
    the rule matches.
    
      UBSAN: shift-out-of-bounds in net/netfilter/nft_payload.c:278:20
      shift exponent 120 is too large for 32-bit type 'int'
      ...
    
    The match is byte-granular and struct nft_data is zero-initialised, so the
    correct mask is simply the first priv_len bytes set to 0xff. Set those
    bytes directly and drop the word/shift trimming; this removes the undefined
    shift and no longer over-masks the trailing bytes.
    
    Fixes: a5d45bc0dc50 ("netfilter: nftables_offload: build mask based from the matching bytes")
    Reported-by: [email protected]
    Signed-off-by: Xiang Mei (Microsoft) <[email protected]>
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

netfilter: xt_hashlimit: validate hashtable supports XT_HASHLIMIT_RATE_MATCH [+ + +]
Author: Pablo Neira Ayuso <[email protected]>
Date:   Tue Jul 21 22:02:46 2026 +0200

    netfilter: xt_hashlimit: validate hashtable supports XT_HASHLIMIT_RATE_MATCH
    
    [ Upstream commit 305b63e1402267459fdabb183af4527f6799eebf ]
    
    The XT_HASHLIMIT_RATE_MATCH flag mode changes the semantics of the
    dsthash_ent structure which represents an entry in the hashtable.  There
    is a union area which uses a different layout to express the rate match
    mode.
    
    Update .checkentry path to validate the XT_HASHLIMIT_RATE_MATCH mode
    flag is requested by two or more different rules that refer to the same
    hashtable. Otherwise, uninitialized access to the burst field in the
    union is possible.
    
    Reject the use of the XT_HASHLIMIT_RATE_MATCH mode flag if set on by
    revision less than 3 too.
    
    Fixes: bea74641e378 ("netfilter: xt_hashlimit: add rate match mode")
    Reported-and-tested-by: Talha Berk Arslan <[email protected]>
    Link: https://patch.msgid.link/[email protected]/
    Signed-off-by: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
netfs: clear PG_private_2 on copy-to-cache append failure [+ + +]
Author: Yichong Chen <[email protected]>
Date:   Mon Jul 27 14:07:12 2026 +0100

    netfs: clear PG_private_2 on copy-to-cache append failure
    
    [ Upstream commit a81fc9266e1c5fef9ccf675a9b44b2f4ab464923 ]
    
    netfs_pgpriv2_copy_to_cache() marks the folio with PG_private_2 before
    netfs_pgpriv2_copy_folio() appends it to the copy-to-cache rolling
    buffer.
    
    If the append fails, the folio is not queued for cache writeback, so
    the PG_private_2 state and its reference must be released immediately.
    
    Fixes: e2d46f2ec332 ("netfs: Change the read result collector to only use one work item")
    Signed-off-by: Yichong Chen <[email protected]>
    Signed-off-by: David Howells <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    cc: Paulo Alcantara <[email protected]>
    cc: [email protected]
    cc: [email protected]
    Signed-off-by: Christian Brauner (Amutable) <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

netfs: handle single writeback rolling buffer allocation failure [+ + +]
Author: Yichong Chen <[email protected]>
Date:   Mon Jul 27 14:07:13 2026 +0100

    netfs: handle single writeback rolling buffer allocation failure
    
    [ Upstream commit 37a1c535c80c67d98668d190c7432f9ebda43310 ]
    
    netfs_write_folio_single() takes an extra folio reference before
    appending the folio to the rolling buffer.
    
    rolling_buffer_append() can fail if it cannot allocate another
    folio_queue. Check the return value and drop the extra folio reference
    before returning the error.
    
    Fixes: 49866ce7ea8d ("netfs: Add support for caching single monolithic objects such as AFS dirs")
    Signed-off-by: Yichong Chen <[email protected]>
    Signed-off-by: David Howells <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    cc: Paulo Alcantara <[email protected]>
    cc: [email protected]
    cc: [email protected]
    Signed-off-by: Christian Brauner (Amutable) <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

netfs: release readahead folios on iterator preparation failure [+ + +]
Author: Yichong Chen <[email protected]>
Date:   Mon Jul 27 14:07:14 2026 +0100

    netfs: release readahead folios on iterator preparation failure
    
    [ Upstream commit 87eb3d272dcbcbbfe5c1576c10e5dc72810cf1f6 ]
    
    netfs_prepare_read_iterator() batches readahead folios in put_batch so that
    the folio references can be dropped after the I/O iterator has been
    prepared.
    
    If rolling_buffer_load_from_ra() fails after earlier folios have been
    batched, the function returns immediately and leaves those references held.
    Release the batch before returning the error.
    
    Fixes: 06fa229ceb36 ("netfs: Abstract out a rolling folio buffer implementation")
    Signed-off-by: Yichong Chen <[email protected]>
    Signed-off-by: David Howells <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    cc: Paulo Alcantara <[email protected]>
    cc: [email protected]
    cc: [email protected]
    Signed-off-by: Christian Brauner (Amutable) <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
octeontx2-pf: Set correct sequence for carrier off and tx queue stop [+ + +]
Author: Suman Ghosh <[email protected]>
Date:   Fri Jul 24 12:58:31 2026 +0530

    octeontx2-pf: Set correct sequence for carrier off and tx queue stop
    
    [ Upstream commit 16809472409d998afcda402e32b8229b389337c4 ]
    
    During link down event, we were doing netif_tx_stop_all_queues() first
    and then netif_carrier_off(). This can cause a potential race since
    carrier is still on during down event. This patch reverse the calling
    order to fix the issue.
    
    Fixes: 50fe6c02e5ad ("octeontx2-pf: Register and handle link notifications")
    Signed-off-by: Suman Ghosh <[email protected]>
    Signed-off-by: Ratheesh Kannoth <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
of/address: Fix NULL bus dereference in of_pci_range_parser_one() [+ + +]
Author: Carlo Caione <[email protected]>
Date:   Mon Jul 27 10:36:59 2026 +0200

    of/address: Fix NULL bus dereference in of_pci_range_parser_one()
    
    commit bba13ad17b1a11b3f1ed9b3a5d556191d7755a59 upstream.
    
    The bus matching rework made of_match_bus() return NULL for nodes with
    ranges/dma-ranges but no local #address-cells. parser_init() stored that
    NULL bus, and the range iterator later dereferenced it.
    
    Reject such nodes in parser_init(), leaving an explicit empty
    iterator for callers that ignore the init return, and make
    of_dma_get_max_cpu_address() honour the init failure so a rejected node
    cannot clamp the DMA limit.
    
    Fixes: 64ee3cf096ac ("of/address: Rework bus matching to avoid warnings")
    Cc: [email protected]
    Signed-off-by: Carlo Caione <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Rob Herring (Arm) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
of: reserved_mem: prevent OOB when too many dynamic regions are defined [+ + +]
Author: Sang-Heon Jeon <[email protected]>
Date:   Sun Jun 14 22:38:06 2026 +0900

    of: reserved_mem: prevent OOB when too many dynamic regions are defined
    
    [ Upstream commit db3dbdfea1b8f38774419c5c2c14e4b81c48708d ]
    
    On boot, fdt_scan_reserved_mem() saves each dynamically-placed
    /reserved-memory subnode into a local array of size
    MAX_RESERVED_REGIONS.
    
    If the device tree defines more than MAX_RESERVED_REGIONS
    dynamically-placed regions, fdt_scan_reserved_mem() writes past the
    end of the local array.
    
    Add a bounds check that logs an error and skips the excess regions,
    restoring the original behavior.
    
    Fixes: 8a6e02d0c00e ("of: reserved_mem: Restructure how the reserved memory regions are processed")
    Signed-off-by: Sang-Heon Jeon <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Rob Herring (Arm) <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
phy: qcom: m31-eusb2: Fix return value of init call [+ + +]
Author: Krishna Kurapati <[email protected]>
Date:   Sat Jul 18 15:01:31 2026 +0530

    phy: qcom: m31-eusb2: Fix return value of init call
    
    [ Upstream commit 361f533a2dce2c2841fe4dc0c9d85a67117edf95 ]
    
    The init call currently returns success irrespective of any failures
    during repeater init or clock enablement. Return appropriate error value
    in the init call failure path.
    
    Fixes: 9c8504861cc4 ("phy: qcom: Add M31 based eUSB2 PHY driver")
    Signed-off-by: Krishna Kurapati <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Vinod Koul <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

phy: zynqmp: fix clock error handling in xpsgtr_phy_init() [+ + +]
Author: Radhey Shyam Pandey <[email protected]>
Date:   Mon Jul 20 21:08:30 2026 +0530

    phy: zynqmp: fix clock error handling in xpsgtr_phy_init()
    
    [ Upstream commit e4779e2a16d600892aaf743438f6ce8cc4eb3c4c ]
    
    Propagate clk_prepare_enable() failures to the caller instead of
    returning success, and disable the reference clock on initialization
    error paths to avoid leaking clock references when phy_exit() is not
    called.
    
    Fixes: 25d700833513 ("phy: xilinx: phy-zynqmp: dynamic clock support for power-save")
    Signed-off-by: Radhey Shyam Pandey <[email protected]>
    Reviewed-by: Michal Simek <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Vinod Koul <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

phy: zynqmp: fix L0_TM_DISABLE_SCRAMBLE_ENCODER mask [+ + +]
Author: Nava kishore Manne <[email protected]>
Date:   Sat Jun 27 21:22:27 2026 +0530

    phy: zynqmp: fix L0_TM_DISABLE_SCRAMBLE_ENCODER mask
    
    commit 6cb22477929489a412df8d153e550e77a012e701 upstream.
    
    The L0_TX_DIG_61 register bit 2 is a reserved read-only field.
    The previous mask value 0x0f incorrectly included bit 2, causing
    unintended writes to a reserved bit on every scrambler bypass
    operation.
    
    Correct the mask to (BIT(3) | GENMASK(1, 0)) to cover only the
    valid scramble bypass control bits.
    
    Fixes: 4a33bea00314 ("phy: zynqmp: Add PHY driver for the Xilinx ZynqMP Gigabit Transceiver")
    Cc: [email protected]
    Signed-off-by: Nava kishore Manne <[email protected]>
    Signed-off-by: Radhey Shyam Pandey <[email protected]>
    Acked-by: Michal Simek <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Vinod Koul <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

phy: zynqmp: fix runtime PM leak on probe allocation failure [+ + +]
Author: Radhey Shyam Pandey <[email protected]>
Date:   Mon Jul 20 21:08:31 2026 +0530

    phy: zynqmp: fix runtime PM leak on probe allocation failure
    
    [ Upstream commit f3506e15cf72e94f62d5f2d173e5b7008f644cde ]
    
    Allocate saved_regs before pm_runtime_resume_and_get() so a
    devm_kmalloc() failure does not leave an unreleased runtime PM usage
    counter.
    
    Fixes: 5af9b304bc60 ("phy: xilinx: phy-zynqmp: Fix SGMII linkup failure on resume")
    Signed-off-by: Radhey Shyam Pandey <[email protected]>
    Reviewed-by: Michal Simek <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Vinod Koul <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

phy: zynqmp: keep SERDES scrambler and 8b/10b enabled for USB [+ + +]
Author: Nava kishore Manne <[email protected]>
Date:   Sat Jun 27 21:22:29 2026 +0530

    phy: zynqmp: keep SERDES scrambler and 8b/10b enabled for USB
    
    commit 7eb61caf45607e1e1270f51f8f93f0ded53146da upstream.
    
    USB Gen1 requires scrambling and 8b/10b encoding to be performed in the
    physical layer. Do not bypass PHY-side scrambler or encoder/decoder for
    USB operation, as mandated by the USB 3.x specification.
    
    Scrambler and 8b/10b bypass remain restricted to SATA and SGMII
    modes, where encoding is handled in the controller.
    
    Fixes: 4a33bea00314 ("phy: zynqmp: Add PHY driver for the Xilinx ZynqMP Gigabit Transceiver")
    Cc: [email protected]
    Signed-off-by: Nava kishore Manne <[email protected]>
    Signed-off-by: Radhey Shyam Pandey <[email protected]>
    Acked-by: Michal Simek <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Vinod Koul <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

phy: zynqmp: use read-modify-write for SERDES scrambler bypass [+ + +]
Author: Nava kishore Manne <[email protected]>
Date:   Sat Jun 27 21:22:28 2026 +0530

    phy: zynqmp: use read-modify-write for SERDES scrambler bypass
    
    commit 21e0749f931702765b9d52d05740092bc87fcd8d upstream.
    
    xpsgtr_bypass_scrambler_8b10b() used xpsgtr_write_phy() which performs
    a full register write, silently clearing any bits beyond the intended
    bypass control fields.
    
    Switch to xpsgtr_clr_set_phy() with clr=mask, set=mask to set only
    the bypass bits while preserving the remaining bits in each register.
    
    Fixes: 4a33bea00314 ("phy: zynqmp: Add PHY driver for the Xilinx ZynqMP Gigabit Transceiver")
    Cc: [email protected]
    Signed-off-by: Nava kishore Manne <[email protected]>
    Signed-off-by: Radhey Shyam Pandey <[email protected]>
    Acked-by: Michal Simek <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Vinod Koul <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
pinctrl-amd: Don't clear S4 wake bits at probe [+ + +]
Author: Mario Limonciello <[email protected]>
Date:   Mon Jul 20 11:28:44 2026 -0500

    pinctrl-amd: Don't clear S4 wake bits at probe
    
    [ Upstream commit ffe8a0c6b55285ceaf2f42fc20c3a0594d14f1e9 ]
    
    commit 6bc3462a0f5e ("pinctrl: amd: Mask wake bits on probe again")
    introduced a regression where Wake-on-LAN no longer works after suspend
    or shutdown on some AMD platforms.
    
    Firmware-programmed S4 wake bits for devices like PCIe NICs using PCI
    PME are cleared at probe, but nothing restores them. Unlike S0i3/S3 wake
    sources that use enable_irq_wake() -> amd_gpio_irq_set_wake(), PCIe PME
    does not use GPIO IRQ infrastructure and relies on firmware configuration.
    
    The original intent of commit 6bc3462a0f5e ("pinctrl: amd: Mask wake
    bits on probe again") was to clear spurious wake bits left by firmware
    to prevent unwanted wakeups. However, S4 wake bits are used for
    hardware-level wake sources like WoL that bypass the kernel's IRQ wake
    API.
    
    Fix by preserving S4 wake bits at probe and only clearing S0i3/S3 bits:
    - Firmware-configured S4 wake sources (WoL) continue working
    - Kernel maintains control of S3/S0i3 wake policy via set_wake()
    - S3-only wake sources work correctly per commit f31f33dbb3ba ("pinctrl:
      amd: Take suspend type into consideration which pins are non-wake")
    
    The trade-off is that firmware-programmed spurious S4 wake bits remain
    set, but this is less problematic than breaking WoL.
    
    Fixes: 6bc3462a0f5e ("pinctrl: amd: Mask wake bits on probe again")
    Signed-off-by: Mario Limonciello <[email protected]>
    Signed-off-by: Linus Walleij <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
pinctrl: bm1880: add missing select GENERIC_PINCONF [+ + +]
Author: Benjamin Boortz <[email protected]>
Date:   Mon Jul 20 19:51:04 2026 +0200

    pinctrl: bm1880: add missing select GENERIC_PINCONF
    
    commit dad6e107b3cd9d20514e7799b7ad8674f81e3f30 upstream.
    
    drivers/pinctrl/pinctrl-bm1880.c initialises its pinconf_ops with
    .is_generic = true, but that field is only present when
    CONFIG_GENERIC_PINCONF is enabled (guarded by #ifdef in pinconf.h).
    The Kconfig entry for PINCTRL_BM1880 never selects GENERIC_PINCONF,
    so any config that enables CONFIG_PINCTRL_BM1880=y without
    CONFIG_GENERIC_PINCONF=y fails to compile:
    
      drivers/pinctrl/pinctrl-bm1880.c:1288:10: error: 'const struct pinconf_ops' has no member named 'is_generic'
    
    Found by randconfig testing on arm64; tinyconfig reproducer below.
    Add the missing select to fix the build.
    
    Fixes: 49bd61ebce5f ("pinctrl: Add pinconf support for BM1880 SoC")
    Cc: [email protected]
    Signed-off-by: Benjamin Boortz <[email protected]>
    Signed-off-by: Linus Walleij <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

pinctrl: devicetree: don't free uninitialized dev_name on error path [+ + +]
Author: Karl Mehltretter <[email protected]>
Date:   Sun Jul 19 14:11:40 2026 +0200

    pinctrl: devicetree: don't free uninitialized dev_name on error path
    
    commit 015b5bcbcb622b32317642be91a7f79aa5413649 upstream.
    
    dt_remember_or_free_map() duplicates dev_name for each map entry. If
    kstrdup_const() fails, dt_free_map() frees dev_name in all num_maps
    entries, including entries that have not been initialized.
    
    Some pinctrl drivers, including pinctrl-imx, allocate the map with
    kmalloc() and leave dev_name for the core to initialize. The untouched
    entries therefore contain uninitialized data which is passed to
    kfree_const().
    
    Reproduced on qemu's mcimx6ul-evk (pinctrl-imx) with failslab injection
    while binding the pinctrl-consuming device, under KASAN:
    
      BUG: KASAN: double-free in dt_free_map+0x34/0xa4
      Free of addr c425a900 by task init/1
       kfree from dt_free_map+0x34/0xa4
       dt_free_map from dt_remember_or_free_map+0x184/0x198
       dt_remember_or_free_map from pinctrl_dt_to_map+0x33c/0x4c8
       pinctrl_dt_to_map from create_pinctrl+0x9c/0x5c0
    
    Initialize all dev_name fields to NULL before duplicating the device
    name, making the full-map cleanup safe after a partial failure.
    
    Fixes: be4c60b563ed ("pinctrl: devicetree: Avoid taking direct reference to device name string")
    Cc: [email protected]
    Assisted-by: Claude:claude-fable-5
    Signed-off-by: Karl Mehltretter <[email protected]>
    Signed-off-by: Linus Walleij <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

pinctrl: microchip-sgpio: add missing select REGMAP_MMIO [+ + +]
Author: Benjamin Boortz <[email protected]>
Date:   Sun Jul 19 11:41:46 2026 +0200

    pinctrl: microchip-sgpio: add missing select REGMAP_MMIO
    
    commit 25cb6e9a13123d1039cdc75b446ac52e1ebdc26d upstream.
    
    The driver calls ocelot_regmap_from_resource() via <linux/mfd/ocelot.h>,
    which internally uses devm_regmap_init_mmio() and requires REGMAP_MMIO.
    The Kconfig entry does not select REGMAP_MMIO, causing a build failure
    when no other driver in the config happens to pull in REGMAP_MMIO:
    
      include/linux/mfd/ocelot.h:34:24: error: implicit declaration of function 'devm_regmap_init_mmio'
    
    Found by randconfig testing on arm64; tinyconfig reproducer below.
    
    Fixes: 2afbbab45c26 ("pinctrl: microchip-sgpio: update to support regmap")
    Cc: [email protected]
    Signed-off-by: Benjamin Boortz <[email protected]>
    Reviewed-by: Andy Shevchenko <[email protected]>
    Signed-off-by: Linus Walleij <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

pinctrl: qcom: sc8280xp: Add missing wakeup entries for GPIO143/151 [+ + +]
Author: Konrad Dybcio <[email protected]>
Date:   Fri Jun 26 15:08:05 2026 +0200

    pinctrl: qcom: sc8280xp: Add missing wakeup entries for GPIO143/151
    
    [ Upstream commit 437a8d2aa1aa442c4a176fdf4700a9b3bb0c8794 ]
    
    Pins 143 and 151 were not included in the PDC wakeup map. They are
    normally used for PCIe2A and PCIe3a PERST# respectively, so they're
    unlikely to be excercised in practice, but still add them for the sake
    of completeness.
    
    Fixes: c0e4c71a9e7c ("pinctrl: qcom: Introduce sc8280xp TLMM driver")
    Signed-off-by: Konrad Dybcio <[email protected]>
    Link: https://patch.msgid.link/20260626-topic-8280_pinctrl_wakeup-v1-1-2ccb267148f5@oss.qualcomm.com
    Signed-off-by: Bartosz Golaszewski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

pinctrl: qcom: Unconditionally mark gpio as wakeup enable [+ + +]
Author: Sneh Mankad <[email protected]>
Date:   Tue Jun 16 17:24:53 2026 +0530

    pinctrl: qcom: Unconditionally mark gpio as wakeup enable
    
    [ Upstream commit 859e02a369ab328a77dfcabf59562100e55f9c5c ]
    
    GPIO interrupts that are wakeup capable need to be forwarded to wakeup
    capable parent irqchip. This is done via writing to it's wakeup_enable bit.
    
    Currently the bit is set only for PDC irqchip by checking skip_wake_irqs.
    skip_wake_irqs is set to differentiate between parent irqchips MPM and
    PDC. It is set when the parent irqchip is PDC to inform pinctrl about
    skipping the IRQ setting up at TLMM.
    
    However, the functionality to forward GPIO interrupts during SoC low
    power mode is needed regardless of which parent irqchip it is.
    Without the functionality it is impossible for MPM irqchip to detect the
    GPIO interrupt during SoC low power mode since for MPM irqchip the
    skip_wake_irqs is always false.
    
    Remove skip_wake_irqs condition when setting wakeup enable bit to allow
    forwarding GPIO interrupts for SoCs using MPM irqchip too.
    
    Fixes: 76b446f5b86e ("pinctrl: qcom: handle intr_target_reg wakeup_present/enable bits")
    Signed-off-by: Sneh Mankad <[email protected]>
    Reviewed-by: Maulik Shah <[email protected]>
    Reviewed-by: Linus Walleij <[email protected]>
    Reviewed-by: Konrad Dybcio <[email protected]>
    Link: https://patch.msgid.link/20260616-enable_wakeup_capable_gpios-v3-1-fb59647d89cb@oss.qualcomm.com
    Signed-off-by: Bartosz Golaszewski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
power: supply: bq25890: fix the -10 C NTC lookup entry [+ + +]
Author: Xu Rao <[email protected]>
Date:   Thu Jul 23 14:54:44 2026 +0800

    power: supply: bq25890: fix the -10 C NTC lookup entry
    
    commit 160a783aa65b74782bc17cb874af1a6d3f5fba3c upstream.
    
    The TSPCT lookup table is monotonically decreasing except for ADC code
    121, where the sequence reads -9.0 C, -1.0 C, -12.0 C.  This makes the
    reported battery temperature jump upward by eight degrees for one code
    and then downward by eleven degrees for the next code.
    
    The entry is a missing zero: use -10.0 C so the sequence remains
    monotonic between -9.0 C and -12.0 C.
    
    Fixes: 9652c02428f3 ("power: bq25890: add POWER_SUPPLY_PROP_TEMP")
    Cc: [email protected]
    Signed-off-by: Xu Rao <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Sebastian Reichel <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

power: supply: max17040: handle missing status supplier [+ + +]
Author: Jianing Li <[email protected]>
Date:   Wed Jul 1 14:10:42 2026 +0800

    power: supply: max17040: handle missing status supplier
    
    commit 725668c6b6aa3971fe850659102c250d0d676e18 upstream.
    
    MAX17040 does not report charger state itself, so the driver forwards
    POWER_SUPPLY_PROP_STATUS to a supplier power supply. If no supplier is
    registered, power_supply_get_property_from_supplier() returns -ENODEV and
    leaves the output value untouched.
    
    max17040_get_property() currently ignores that error and returns success,
    so userspace can read an uninitialized status value from the battery power
    supply. This happens on systems that use the fuel gauge without a charger
    supplier relationship in firmware.
    
    Return POWER_SUPPLY_STATUS_UNKNOWN when no supplier provides STATUS, and
    propagate other supplier lookup errors.
    
    Fixes: f4b782af61ae ("power: max17040: pass status property from supplier")
    Cc: [email protected] # 6.7+
    Signed-off-by: Jianing Li <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Sebastian Reichel <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
powerpc/boot: Fix simpleboot CPU node lookup check [+ + +]
Author: Thorsten Blum <[email protected]>
Date:   Thu Jul 2 23:15:55 2026 +0200

    powerpc/boot: Fix simpleboot CPU node lookup check
    
    [ Upstream commit c824ab65685bb119c6c6a3a200b3428c72862d5a ]
    
    fdt_node_offset_by_prop_value() returns a negative error code on
    failure - fix the check accordingly.
    
    Fixes: d2477b5cc8ca ("[POWERPC] bootwrapper: Add a firmware-independent simpleboot target.")
    Signed-off-by: Thorsten Blum <[email protected]>
    Reviewed-by: Ritesh Harjani (IBM) <[email protected]>
    Signed-off-by: Madhavan Srinivasan <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

powerpc/boot: Fix treeboot-akebono CPU node lookup check [+ + +]
Author: Thorsten Blum <[email protected]>
Date:   Thu Jul 2 23:15:57 2026 +0200

    powerpc/boot: Fix treeboot-akebono CPU node lookup check
    
    [ Upstream commit b24fc8278b70a9d27ec801a427ab4de9b769d69a ]
    
    fdt_node_offset_by_prop_value() returns a negative error code on
    failure - fix the check accordingly.
    
    Fixes: 2a2c74b2efcb ("IBM Akebono: Add the Akebono platform")
    Signed-off-by: Thorsten Blum <[email protected]>
    Reviewed-by: Ritesh Harjani (IBM) <[email protected]>
    Signed-off-by: Madhavan Srinivasan <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

powerpc/boot: Fix treeboot-currituck CPU node lookup check [+ + +]
Author: Thorsten Blum <[email protected]>
Date:   Thu Jul 2 23:15:56 2026 +0200

    powerpc/boot: Fix treeboot-currituck CPU node lookup check
    
    [ Upstream commit 43863f6575d2211e8c5157fefb83ad0ad046aab4 ]
    
    fdt_node_offset_by_prop_value() returns a negative error code on
    failure - fix the check accordingly.
    
    Fixes: 228d55053397 ("powerpc/47x: Add support for the new IBM currituck platform")
    Signed-off-by: Thorsten Blum <[email protected]>
    Reviewed-by: Ritesh Harjani (IBM) <[email protected]>
    Signed-off-by: Madhavan Srinivasan <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
powerpc/ps3: Fix map failure path in dma_ioc0_map_pages() [+ + +]
Author: Thorsten Blum <[email protected]>
Date:   Sat Jul 11 15:09:32 2026 +0200

    powerpc/ps3: Fix map failure path in dma_ioc0_map_pages()
    
    commit 0bb024f11d120abff3e8db9144a585b9d7fb8459 upstream.
    
    If lv1_put_iopte() fails in dma_ioc0_map_pages(), the error path
    decrements iopage but keeps using the failed mapping's offset. As a
    result, it repeatedly tries to invalidate the failed IOPTE slot and
    leaves the already installed IOPTEs valid.
    
    Recompute offset and invalidate the installed IOPTEs instead.
    
    Fixes: 6bb5cf102541 ("[POWERPC] PS3: System-bus rework")
    Cc: [email protected]
    Signed-off-by: Thorsten Blum <[email protected]>
    Reviewed-by: Ritesh Harjani (IBM) <[email protected]>
    Reviewed-by: Geert Uytterhoeven <[email protected]>
    Signed-off-by: Madhavan Srinivasan <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ptp: netc: fix potential interrupt storm caused by incorrect unbind order [+ + +]
Author: Wei Fang <[email protected]>
Date:   Mon Jul 27 14:03:48 2026 +0800

    ptp: netc: fix potential interrupt storm caused by incorrect unbind order
    
    [ Upstream commit 54ad7ea45d63146a8e3c57375f8a269d4cf7ecea ]
    
    In netc_timer_remove(), hardware interrupts are disabled by clearing
    TMR_TEMASK before ptp_clock_unregister() is called. This may cause a
    race condition during driver unbind that could leave hardware interrupts
    active. For example, a concurrent PTP_CLK_REQ_EXTTS ioctl can re-enable
    TMR_TEMASK after it has been cleared, leaving a pending hardware
    interrupt when the driver unbinds.
    
    Since the NETC Timer does not support PCIe FLR, hardware state is not
    reset during probe. When the driver is rebound and the IRQ is registered,
    the pending interrupt fires immediately. At that point priv->tmr_emask
    is still zero, so netc_timer_isr() does not clear the interrupt status
    and unconditionally returns IRQ_HANDLED, resulting in an uninterruptible
    infinite interrupt storm.
    
    Fix this in several ways. First, request the IRQ with IRQF_NO_AUTOEN so
    it is not enabled when request_irq() runs, and clear TMR_TEMASK in
    netc_timer_init() before enabling it. The IRQ is only enabled at the end
    of probe once the timer has been reprogrammed and the PTP clock has been
    registered. This ensures a stale pending interrupt from a previous unbind
    or an unclean shutdown cannot be delivered before the driver is fully
    initialized.
    
    Second, in netc_timer_remove() call disable_irq() before
    ptp_clock_unregister() and move the TMR_TEMASK/TMR_CTRL clearing after
    it. disable_irq() masks the line and waits for any in-flight
    netc_timer_isr() to finish, so no ISR can dereference priv->clock after
    ptp_clock_unregister() has freed it. Unregistering the PTP clock before
    clearing the mask also guarantees that no in-flight or concurrent ioctl
    can re-enable hardware interrupts.
    
    Finally, return IRQ_NONE from netc_timer_isr() when the masked event
    status is zero, so the kernel's spurious interrupt detection can disable
    a stuck line instead of looping forever.
    
    Fixes: 671e266835b8 ("ptp: netc: add periodic pulse output support")
    Reported-by: Sashiko <[email protected]>
    Closes: https://sashiko.dev/#/patchset/20260720012508.23227-1-wei.fang%40oss.nxp.com
    Signed-off-by: Wei Fang <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
qede: sync udp_tunnel ports outside qede_lock in the recovery path [+ + +]
Author: Denis V. Lunev <[email protected]>
Date:   Sun Jul 26 12:43:11 2026 +0200

    qede: sync udp_tunnel ports outside qede_lock in the recovery path
    
    [ Upstream commit 451c9075d6c53f2438d110addbeeeea6fac18567 ]
    
    A TX timeout on a qede NIC that has VXLAN/GENEVE tunnel ports
    configured wedges the rtnetlink control plane of the whole machine:
    
      NETDEV WATCHDOG: ens6f1 (qede): transmit queue 2 timed out 10226 ms
      [qede_tx_timeout:586(ens6f1)]TX timeout on queue 2!
      [qede_recovery_handler:2665(ens6f0)]Starting a recovery process
    
    The recovery path deadlocks on the driver's own mutex:
    
      qede_sp_task
       rtnl_lock()
       mutex_lock(&edev->qede_lock)        <- taken
       qede_recovery_handler
        qede_load
        udp_tunnel_nic_reset_ntf
         __udp_tunnel_nic_device_sync
          info->sync_table == qede_udp_tunnel_sync
           mutex_lock(&edev->qede_lock)    <- same task: deadlock
    
    The mutex is not recursive, so the kworker blocks on itself with
    rtnl_lock held, and neither lock is ever released. Every task that
    calls rtnl_lock() afterwards (ip, ovs-vswitchd, lldpad, IPv6
    addrconf, sshd) blocks forever while the node still answers ping.
    In a vmcore from an affected production node rtnl_mutex.owner
    decodes to the very kworker blocked at the innermost mutex_lock()
    above.
    
    Re-sync the tunnel ports from qede_sp_task() after the internal lock
    is dropped, still under rtnl_lock as the udp_tunnel API requires.
    This mirrors qede_open(), which calls udp_tunnel_nic_reset_ntf()
    under rtnl without the internal lock.
    
    qede_recovery_handler() now returns whether it has successfully
    reloaded an open device, and the caller re-syncs the ports only in
    that case. This keeps the old gating exactly: a device that was down
    or a failed recovery returns false, as those paths never reached the
    udp_tunnel_nic_reset_ntf() call before either.
    
    This was the only user of the qede_lock()/qede_unlock() helpers, so
    remove them.
    
    Fixes: 8cd160a29415 ("qede: convert to new udp_tunnel_nic infra")
    Signed-off-by: Denis V. Lunev <[email protected]>
    CC: Andrew Lunn <[email protected]>
    CC: "David S. Miller" <[email protected]>
    CC: Eric Dumazet <[email protected]>
    CC: Jakub Kicinski <[email protected]>
    CC: Paolo Abeni <[email protected]>
    Reviewed-by: Jacob Keller <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
rds: Fix inet6_addr_lst NULL dereference when IPv6 is disabled [+ + +]
Author: Ilia Gavrilov <[email protected]>
Date:   Thu Jul 9 16:27:54 2026 +0000

    rds: Fix inet6_addr_lst NULL dereference when IPv6 is disabled
    
    [ Upstream commit 9c805e592a29be9e4e61ff1bd567da04aa8fd6f9 ]
    
    When booting with the 'ipv6.disable=1' parameter, inet6_addr_lst
    is never initialized because inet6_init() exits before addrconf_init()
    is called to initialize it. An attempt to bind an RDS socket to
    an ipv6 address results in a crash in __ipv6_chk_addr_and_flags()
    
    KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
    RIP: 0010:__ipv6_chk_addr_and_flags+0x1df/0x7e0
    Call Trace:
     <TASK>
     ipv6_chk_addr+0x3b/0x50
     rds_tcp_laddr_check+0x155/0x3b0 [rds_tcp]
     rds_trans_get_preferred+0x15d/0x2d0 [rds]
     ? trace_hardirqs_on+0x2d/0x110
     rds_bind+0x1433/0x1d60 [rds]
     ? rds_remove_bound+0xd50/0xd50 [rds]
     ? aa_af_perm+0x250/0x250
     ? __might_fault+0xde/0x190
     ? __sys_bind+0x1dc/0x210
     __sys_bind+0x1dc/0x210
     ? __ia32_sys_socketpair+0x100/0x100
     ? restore_fpregs_from_fpstate+0x53/0x100
     __x64_sys_bind+0x73/0xb0
     ? syscall_enter_from_user_mode+0x1c/0x50
     do_syscall_64+0x34/0x80
     entry_SYSCALL_64_after_hwframe+0x6e/0xd8
    RIP: 0033:0x7f47f8269ea9
     </TASK>
    
    The following code reproduces the issue:
    
    struct sockaddr_in6 addr;
    s = socket(PF_RDS, SOCK_SEQPACKET, 0);
    
    memset(&addr, 0, sizeof(addr));
    inet_pton(AF_INET6, ADDRESS, &addr.sin6_addr);
    addr.sin6_family = AF_INET6;
    addr.sin6_port = htons(PORT);
    
    bind(s, &addr, sizeof(addr));
    
    Found by InfoTeCS on behalf of Linux Verification Center
    (linuxtesting.org) with Syzkaller.
    
    Fixes: eee2fa6ab322 ("rds: Changing IP address internal representation to struct in6_addr")
    Fixes: 1e2b44e78eea ("rds: Enable RDS IPv6 support")
    Signed-off-by: Ilia Gavrilov <[email protected]>
    Reviewed-by: Allison Henderson <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Stable-dep-of: 78f75d632f74 ("rds: tcp: hold the RCU lock across ipv6_chk_addr() in rds_tcp_laddr_check()")
    Signed-off-by: Sasha Levin <[email protected]>

rds: tcp: hold the RCU lock across ipv6_chk_addr() in rds_tcp_laddr_check() [+ + +]
Author: Xiang Mei <[email protected]>
Date:   Wed Jul 22 14:02:03 2026 -0700

    rds: tcp: hold the RCU lock across ipv6_chk_addr() in rds_tcp_laddr_check()
    
    [ Upstream commit 78f75d632f74b8de0f081a128588f7c37d0d1164 ]
    
    rds_tcp_laddr_check() looks up a scoped IPv6 interface with
    dev_get_by_index_rcu(), drops the RCU read-side lock, and only then
    passes the bare struct net_device * into ipv6_chk_addr().
    
    dev_get_by_index_rcu() only keeps the device alive within the same RCU
    read-side section. After rcu_read_unlock(), a concurrent RTM_DELLINK can
    free the net_device; ipv6_chk_addr() then dereferences the stale pointer
    in __ipv6_chk_addr_and_flags() (e.g. l3mdev_master_dev_rcu(dev)), reading
    freed memory.
    
    Keep the RCU read-side lock held across the ipv6_chk_addr() call instead
    of dropping it right after the lookup, so the device cannot be freed
    while it is in use.
    
      BUG: KASAN: slab-use-after-free in __ipv6_chk_addr_and_flags (... net/ipv6/addrconf.c:1998)
      Read of size 8 at addr ffff8880106ec000 by task exploit/153
      Call Trace:
       ...
       kasan_report (mm/kasan/report.c:595)
       __ipv6_chk_addr_and_flags (... net/ipv6/addrconf.c:1998)
       ipv6_chk_addr (net/ipv6/addrconf.c:2031 net/ipv6/addrconf.c:1972)
       rds_tcp_laddr_check (net/rds/tcp.c:370)
       rds_bind (net/rds/bind.c:248)
       __sys_bind (net/socket.c:1920)
       __x64_sys_bind (net/socket.c:1956)
       do_syscall_64 (arch/x86/entry/syscall_64.c:63)
       entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121)
    
    Fixes: eee2fa6ab322 ("rds: Changing IP address internal representation to struct in6_addr")
    Reported-by: Weiming Shi <[email protected]>
    Signed-off-by: Xiang Mei <[email protected]>
    Reviewed-by: Allison Henderson <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
riscv: drop __init from vec_check_unaligned_access_speed_all_cpus [+ + +]
Author: Anirudh Srinivasan <[email protected]>
Date:   Fri Jun 12 11:24:43 2026 -0500

    riscv: drop __init from vec_check_unaligned_access_speed_all_cpus
    
    [ Upstream commit f51fed61eea0daba2f95f1a6074085e4cd513c7b ]
    
    This function runs within a kthread and need not necessarily finish
    before system finishes boot and free_initmem() unmaps the .init.text
    section. This function makes calls to SBI for probing unaligned access
    speed, and if this is slow for some reason (say some debug prints were
    added to SBI), the kthread can still be running at this point and result
    in an instruction page fault when trying to fetch from the freed region.
    
    [   25.642087] Unable to handle kernel paging request at virtual address ffffffff80a04ef8
    [   25.646694] Current vec_check_unali pgtable: 4K pagesize, 48-bit VAs, pgdp=0x00004000316e9000
    [   25.653170] [ffffffff80a04ef8] pgd=000010004be7e401, p4d=000010004be7e401, pud=000010004be7e001, pmd=000010000c3000e3
    [   25.661244] Oops [#1]
    [   25.662997] Modules linked in:
    [   25.665357] CPU: 3 UID: 0 PID: 42 Comm: vec_check_unali Not tainted 7.0.0-tt-blackhole-asrinivasan-00007-g30ff73f18211 #570 PREEMPTLAZY
    [   25.674669] Hardware name: Tenstorrent Blackhole (DT)
    [   25.678545] epc : vec_check_unaligned_access_speed_all_cpus+0x18/0x2c
    [   25.683458]  ra : vec_check_unaligned_access_speed_all_cpus+0x18/0x2c
    [   25.688372] epc : ffffffff80a04ef8 ra : ffffffff80a04ef8 sp : ffff8f8000203e20
    [   25.693874]  gp : ffffffff814dc168 tp : ffffaf8001ad9900 t0 : 0000000000000000
    [   25.699401]  t1 : fffffffffffffff0 t2 : ffffaf8001ad9a10 s0 : ffff8f8000203e30
    [   25.704912]  s1 : ffffaf80018dc780 a0 : 0000000000000000 a1 : 0000000000000002
    [   25.710407]  a2 : 00000000000001f0 a3 : 0000000000000018 a4 : 0000000000000000
    [   25.715917]  a5 : 0000000000000000 a6 : ffffaf8001c03d98 a7 : ffffaf8001c03e30
    [   25.721419]  s2 : ffff8f8000023c98 s3 : ffffaf8001aa1240 s4 : ffffffff80a04ee0
    [   25.726937]  s5 : 0000000000000000 s6 : 0000000000000000 s7 : 0000000000000000
    [   25.732450]  s8 : 0000000000000000 s9 : 0000000000000000 s10: 0000000000000000
    [   25.737944]  s11: 0000000000000000 t3 : 0000000000000002 t4 : 0000000000000402
    [   25.743481]  t5 : 0000000000000040 t6 : 0000000000000004 ssp : 0000000000000000
    [   25.749024] status: 0000000200000120 badaddr: ffffffff80a04ef8 cause: 000000000000000c
    [   25.755060] [<ffffffff80a04ef8>] vec_check_unaligned_access_speed_all_cpus+0x18/0x2c
    [   25.760964] [<ffffffff80047a10>] kthread+0xd8/0xfc
    [   25.764660] [<ffffffff80010c48>] ret_from_fork_kernel+0x18/0x1c4
    [   25.769220] [<ffffffff80895fe6>] ret_from_fork_kernel_asm+0x16/0x18
    [   25.774018] Code: cccc cccc cccc cccc cccc cccc cccc cccc cccc cccc (cccc) cccc
    
    Drop __init from its signature so that this doesn't happen.
    
    Fixes: a00e022be531 ("riscv: Annotate unaligned access init functions")
    Signed-off-by: Anirudh Srinivasan <[email protected]>
    Assisted-by: Claude:claude-opus-4-6
    Link: https://patch.msgid.link/20260612-vec_unaligned_drop_init-v1-1-df969210ae34@oss.tenstorrent.com
    Signed-off-by: Paul Walmsley <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

riscv: mm: Fix out-of-bounds page-table walk during memory hot-remove [+ + +]
Author: Karl Mehltretter <[email protected]>
Date:   Wed Jul 29 03:21:32 2026 +0200

    riscv: mm: Fix out-of-bounds page-table walk during memory hot-remove
    
    [ Upstream commit a0188cc133696627857d16054e43f9ebc7efc821 ]
    
    remove_pud_mapping() and remove_p4d_mapping() obtain a child table base
    with pud_offset(p4dp, 0) and p4d_offset(pgd, 0), then add the index for
    addr.
    
    RISC-V folds page-table levels at runtime. When a level is folded, its
    offset helper returns the parent entry itself, but the index can still be
    nonzero. Adding it walks past the parent table. Sv48 folds P4D, while Sv39
    folds both P4D and PUD, so memory hot-remove can descend into unrelated
    memory and pass an invalid page to __free_pages(). This can trigger:
    
      kernel BUG at include/linux/mm.h:1810!
      VM_BUG_ON_PAGE(page_ref_count(page) == 0)
      arch_remove_memory+0x1e/0x5c
      try_remove_memory+0x15e/0x200
      remove_memory+0x24/0x3c
    
    Only add the index when the corresponding page-table level is enabled,
    matching p4d_offset() and pud_offset().
    
    Fixes: c75a74f4ba19 ("riscv: mm: Add memory hotplugging support")
    Assisted-by: Claude:claude-fable-5
    Signed-off-by: Karl Mehltretter <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paul Walmsley <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
rtase: fix double free of multi-frag skb on DMA map failure [+ + +]
Author: Yun Lu <[email protected]>
Date:   Tue Jul 21 10:38:36 2026 +0800

    rtase: fix double free of multi-frag skb on DMA map failure
    
    [ Upstream commit 6fb7b769d6ed6d1d2e02af4a80e57a2477f35086 ]
    
    In rtase_start_xmit(), when the head buffer DMA mapping fails after
    rtase_xmit_frags() has mapped all fragments, the error path clears
    the fragment descriptors with rtase_tx_clear_range(), which frees
    the skb through the last-frag slot and accounts tx_dropped. Control
    then falls through to the common error label, which frees the same
    skb a second time and counts it again.
    
    Return right after clearing the fragments when the skb owns frags;
    the no-frag case still drops through and frees the head skb once.
    
    Fixes: d6e882b89fdf ("rtase: Implement .ndo_start_xmit function")
    Signed-off-by: Yun Lu <[email protected]>
    Reviewed-by: Jacob Keller <[email protected]>
    Reviewed-by: Justin Lai <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
s390/dasd: Fix potential NULL pointer dereference [+ + +]
Author: Jan Höppner <[email protected]>
Date:   Mon Jul 27 16:28:39 2026 +0200

    s390/dasd: Fix potential NULL pointer dereference
    
    commit 9973026f572db6b67570cadc30942f3014e41079 upstream.
    
    dasd_release_space() checks the implementation of the is_ese()
    discipline function before calling it to determine if a given device is
    an ESE DASD.
    
    The current usage of the logical AND operator will lead to a NULL
    pointer dereference as the function is called even if the function
    pointer is NULL.
    
    Fix this by using the logical OR operator.
    
    Fixes: 91dc4a197569 ("s390/dasd: Add new ioctl to release space")
    Cc: [email protected] # v5.3+
    Reported-by: Vasily Gorbik <[email protected]>
    Acked-by: Eduard Shishkin <[email protected]>
    Reviewed-by: Stefan Haberland <[email protected]>
    Signed-off-by: Jan Höppner <[email protected]>
    Signed-off-by: Stefan Haberland <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

s390/dasd: Fix undersized format-check buffer [+ + +]
Author: Stefan Haberland <[email protected]>
Date:   Mon Jul 27 16:28:40 2026 +0200

    s390/dasd: Fix undersized format-check buffer
    
    commit 7f40b346462f563a0d6e841a77b5163d2a882a04 upstream.
    
    fmt_buffer_size in dasd_eckd_check_device_format() is declared as
    int, even though one of the multiplicands, sizeof(struct eckd_count),
    is a size_t. The expression
    
        trkcount * rpt_max * sizeof(struct eckd_count)
    
    is therefore correctly evaluated at 64-bit width, but the result is
    silently truncated when it is stored back into the 32-bit
    fmt_buffer_size variable. For a sufficiently large track range
    (start_unit/stop_unit are caller-controlled) this truncation
    yields a buffer size far smaller than the number of tracks actually
    requested. kzalloc() then succeeds with an undersized allocation,
    while the subsequent channel program build still operates on the
    untruncated track count and writes past the end of that buffer.
    
    Compute the buffer size with check_mul_overflow() and keep it in a
    size_t, so that a value that no longer fits results in -EINVAL
    instead of a silently truncated allocation size.
    
    Fixes: 8fd575200db5 ("s390/dasd: Add new ioctl BIODASDCHECKFMT")
    Cc: [email protected] #4.7
    Reviewed-by: Jan Höppner <[email protected]>
    Signed-off-by: Stefan Haberland <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
s390/pci: Fix s390_pci_mmio_write syscall error return without MIO [+ + +]
Author: Niklas Schnelle <[email protected]>
Date:   Wed Jul 22 15:08:34 2026 +0200

    s390/pci: Fix s390_pci_mmio_write syscall error return without MIO
    
    commit b7ab86bdc65eadcfc43a0e3faf682a3f750cfb96 upstream.
    
    On a machine without PCI memory-I/O (MIO) support or when running with
    pci=nomio the s390 specific PCI MMIO write syscall checks if the MMIO
    cookie is above ZPCI_IOMAP_ADDR_BASE as a sanity check before even
    trying to perform the MMIO. If this check fails the return value was
    left unchanged and thus 0 from prior operations falsely indicating
    success. This could potentially confuse user-space into falsely
    believing the MMIO, on a mapping not valid for MMIO was successful.
    
    Fix this by setting the return value to -EFAULT prior to the check
    following the same pattern as elsewhere in the same function.
    
    Cc: [email protected]
    Reviewed-by: Julian Ruess <[email protected]>
    Reviewed-by: Farhan Ali <[email protected]>
    Fixes: a67a88b0b8de ("s390/pci: remove races against pte updates")
    Signed-off-by: Niklas Schnelle <[email protected]>
    Signed-off-by: Vasily Gorbik <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
s390/qeth: Check CAP_NET_ADMIN for private ioctls [+ + +]
Author: Aswin Karuvally <[email protected]>
Date:   Thu Jul 23 16:00:50 2026 +0200

    s390/qeth: Check CAP_NET_ADMIN for private ioctls
    
    commit d211028bac1bd0fff0026bfa2a8328e5b78cd0e6 upstream.
    
    Gate the SIOCDEVPRIVATE ioctl commands SIOC_QETH_ADP_SET_SNMP_CONTROL,
    SIOC_QETH_GET_CARD_TYPE and SIOC_QETH_QUERY_OAT with CAP_NET_ADMIN
    capable check to ensure unprivileged users cannot invoke them.
    
    Fixes: 18787eeebd71 ("qeth: use ndo_siocdevprivate")
    Cc: [email protected]
    Suggested-by: Christian Borntraeger <[email protected]>
    Reviewed-by: Christian Borntraeger <[email protected]>
    Reviewed-by: Alexandra Winter <[email protected]>
    Signed-off-by: Aswin Karuvally <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
s390/zcrypt: Fix buffer over-read in cca_cipher2protkey [+ + +]
Author: Harald Freudenberger <[email protected]>
Date:   Wed Jul 29 13:40:09 2026 +0200

    s390/zcrypt: Fix buffer over-read in cca_cipher2protkey
    
    commit 36b230835b8a008266aad22168ca52afacc8a58d upstream.
    
    Add validation of both the actual key buffer size and token length
    fields in all the cca_check_sec*token() functions. Additionally check
    in cca_gencipherkey() for possible underflow with returned key size.
    
    The CCA token structures contain user-controlled len fields that
    were used in operations without proper validation against both the
    actual buffer size and minimum token structure size. An attacker
    could set this field larger than the actual buffer size, leading to
    reading beyond buffer boundaries. This may result in a kernel crash or
    exposure of memory via sending this as part of a request down to the
    crypto card. Also an attacker could have used a very small len value
    and thus enforce a buffer under-run which may produce similar effects
    as a over-read.
    
    So now a key must
    - key buf length must be at least sizeof the token struct
    - the key len field inside the token must fit into the range of
      sizeof key token struct ... key buf length
    
    Fixes: 4bc123b18ce6 ("s390/zcrypt: Add low level functions for CCA AES cipher keys")
    Cc: [email protected]
    Reviewed-by: Ingo Franzki <[email protected]>
    Signed-off-by: Harald Freudenberger <[email protected]>
    Signed-off-by: Vasily Gorbik <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

s390/zcrypt: Fix missing mem scrub at clear key import in cca_clr2cipherkey() [+ + +]
Author: Harald Freudenberger <[email protected]>
Date:   Wed Jul 29 16:01:34 2026 +0200

    s390/zcrypt: Fix missing mem scrub at clear key import in cca_clr2cipherkey()
    
    commit 01476391aecef36a3b789ee844357b22fbc90665 upstream.
    
    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: [email protected]
    Reviewed-by: Holger Dengler <[email protected]>
    Signed-off-by: Harald Freudenberger <[email protected]>
    Signed-off-by: Vasily Gorbik <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

s390/zcrypt: Fix wrong domain value verification with EP11 CPRBs [+ + +]
Author: Harald Freudenberger <[email protected]>
Date:   Thu Jul 23 11:54:52 2026 +0200

    s390/zcrypt: Fix wrong domain value verification with EP11 CPRBs
    
    commit 983279d7f86ade73db86f886e09172dd567031b5 upstream.
    
    There is a wrong upper limit check for the domain value when an EP11
    CPRB is processed for sending to a crypto card. This check is only
    active on custom device nodes but may lead to access heap memory
    behind perms->adm when an administrative CPRB is sent.
    Add correct limit (AP_DOMAINS = 256) checking to fix this.
    
    Fixes: cfd68b33094e ("s390/zcrypt: Filter admin CPRBs on custom devices")
    Cc: [email protected]
    Reviewed-by: Finn Callies <[email protected]>
    Signed-off-by: Harald Freudenberger <[email protected]>
    Signed-off-by: Vasily Gorbik <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

s390/zcrypt: Validate length for CCA AES cipher key requests [+ + +]
Author: Holger Dengler <[email protected]>
Date:   Wed Jul 29 11:36:15 2026 +0200

    s390/zcrypt: Validate length for CCA AES cipher key requests
    
    commit 06afe425d5283b9764303de47f554da5a808ce8a upstream.
    
    cca_cipher2protkey() derives the copy length for the CPRB parameter
    block directly from the length field in the key token. Reject the
    request early if the token length exceeds the available space in the
    parameter block.
    
    Fixes: 4bc123b18ce6 ("s390/zcrypt: Add low level functions for CCA AES cipher keys")
    Signed-off-by: Holger Dengler <[email protected]>
    Cc: [email protected] # 5.4+
    Reviewed-by: Harald Freudenberger <[email protected]>
    Signed-off-by: Vasily Gorbik <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

s390/zcrypt: Validate length for CCA ECC private key requests [+ + +]
Author: Holger Dengler <[email protected]>
Date:   Wed Jul 29 11:36:16 2026 +0200

    s390/zcrypt: Validate length for CCA ECC private key requests
    
    commit a9ae0f6dd45c3ccc1d69363f7aea8af179122730 upstream.
    
    cca_ecc2protkey() derives the copy length for the CPRB parameter
    block directly from the length field in the key token. Reject the
    request early if the token length exceeds the available space in the
    parameter block.
    
    Fixes: fa6999e326fe ("s390/pkey: support CCA and EP11 secure ECC private keys")
    Signed-off-by: Holger Dengler <[email protected]>
    Cc: [email protected] # 5.10+
    Reviewed-by: Harald Freudenberger <[email protected]>
    Signed-off-by: Vasily Gorbik <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
sched/deadline: Use revised wakeup rule only for running dl_server [+ + +]
Author: Gabriele Monaco <[email protected]>
Date:   Fri May 22 14:58:33 2026 +0200

    sched/deadline: Use revised wakeup rule only for running dl_server
    
    [ Upstream commit 1842bf97af109f5ebf830175c9725bf81ebb78b1 ]
    
    Commit 14a857056466 ("sched/deadline: Use revised wakeup rule for
    dl_server") applies the revised wakeup rule to any server, as a result
    servers that are not running (dl_defer_running == 0) and start with a
    deadline overflow get enqueued and can boost tasks as if they were
    running, invalidating the defer rule and the documented state model.
    
    Apply the revised wakeup rule only for deferrable servers that are
    marked as running.
    
    Fixes: 14a857056466 ("sched/deadline: Use revised wakeup rule for dl_server")
    Signed-off-by: Gabriele Monaco <[email protected]>
    Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
    Acked-by: Juri Lelli <[email protected]>
    Tested-by: Andrea Righi <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
scsi: libiscsi: Fix stale-data leak into the SCSI sense buffer [+ + +]
Author: HyeongJun An <[email protected]>
Date:   Tue Jul 14 19:49:34 2026 +0900

    scsi: libiscsi: Fix stale-data leak into the SCSI sense buffer
    
    [ Upstream commit 98b87885de4b7f605533a2860685f5689fce8e82 ]
    
    iscsi_scsi_cmd_rsp() copies the sense data of a SCSI Response from the
    target-supplied data segment.  The segment carries a 2-byte sense length
    followed by the sense bytes, so it must hold 2 + senselen bytes, but the
    bounds check only requires datalen >= senselen:
    
            senselen = get_unaligned_be16(data);
            if (datalen < senselen)
                    goto invalid_datalen;
            memcpy(sc->sense_buffer, data + 2,
                   min_t(uint16_t, senselen, SCSI_SENSE_BUFFERSIZE));
    
    A target that returns a SCSI Response whose datalen equals senselen
    (with senselen <= SCSI_SENSE_BUFFERSIZE) makes the memcpy() from data +
    2 read up to two bytes past the received data.  Those bytes are stale
    conn->data contents and end up in the command's sense buffer, which is
    returned to userspace.
    
    Account for the 2-byte sense length prefix in the check.
    
    Fixes: 7996a778ff8c ("[SCSI] iscsi: add libiscsi")
    Suggested-by: Sashiko AI <[email protected]>
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: HyeongJun An <[email protected]>
    Acked-by: Chris Leech <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: libiscsi_tcp: Bound SCSI Response data segment to the connection buffer [+ + +]
Author: HyeongJun An <[email protected]>
Date:   Thu Jul 16 15:58:48 2026 +0900

    scsi: libiscsi_tcp: Bound SCSI Response data segment to the connection buffer
    
    [ Upstream commit c1dea15f819cded9b3faf58f8bec72323568b6e6 ]
    
    iscsi_tcp_hdr_dissect() receives the data segment of several PDU types
    into the fixed-size conn->data buffer, which is allocated for
    ISCSI_DEF_MAX_RECV_SEG_LEN (8192) bytes.  For the LOGIN_RSP, TEXT_RSP,
    REJECT and ASYNC_EVENT opcodes the dissect path already rejects a PDU
    whose DataSegmentLength exceeds that buffer.
    
    The SCSI Command Response (ISCSI_OP_SCSI_CMD_RSP) path also copies its
    data segment (sense/response data) into conn->data via
    iscsi_tcp_data_recv_prep(), but it does so without the same check.  The
    only upstream bound on in.datalen is conn->max_recv_dlength, the
    initiator's advertised MaxRecvDataSegmentLength, which is commonly
    negotiated well above 8192 (open-iscsi defaults to 262144).  A target
    that returns a SCSI Response with a DataSegmentLength between 8193 and
    max_recv_dlength therefore overflows the 8192-byte conn->data buffer.
    
    Once the same bound applies, ISCSI_OP_SCSI_CMD_RSP is handled exactly
    like those responses: bound the data segment, receive it into conn->data
    when present, and otherwise complete the PDU with no data.  Fold the
    opcode into that case group rather than duplicating the check.
    
    Fixes: a081c13e39b5 ("[SCSI] iscsi_tcp: split module into lib and lld")
    Suggested-by: Chris Leech <[email protected]>
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: HyeongJun An <[email protected]>
    Acked-by: Chris Leech <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: libsas: Fix HA resume deadlock and hisi_sas disk-wake race [+ + +]
Author: Xingui Yang <[email protected]>
Date:   Thu Jul 16 16:11:45 2026 +0800

    scsi: libsas: Fix HA resume deadlock and hisi_sas disk-wake race
    
    [ Upstream commit 3dbbbf656b850c9c8de05df6ad4a1dfc6ff02845 ]
    
    Commit fbefe22811c3 ("scsi: libsas: Don't always drain event workqueue
    for HA resume") introduced sas_resume_ha_no_sync() to avoid a deadlock:
    the PHYE_RESUME_TIMEOUT handler, running on the HA event workqueue,
    calls sas_deform_port() -> sas_destruct_devices(), which removes SCSI
    devices and waits for the host to become runtime-active. But the host
    cannot resume until sas_resume_ha() -> sas_drain_work() returns, and the
    drain is blocked on that very handler.
    
    However skipping the drain reintroduces a race: hisi_sas returns from
    resume before all PHY UP work and libsas discovery work finish. The
    controller may then autosuspend while disks are still waking up. The
    disks issue IO to a suspended controller, the IO fails, and the disks
    get disabled.
    
    Fix the deadlock at its source by moving the PHYE_RESUME_TIMEOUT
    notification to after sas_drain_work(). By then the host resume is about
    to complete, so device removal through device_link no longer blocks on
    the resume and the cycle is broken.
    
    With the deadlock gone, restore sas_resume_ha() (the draining variant)
    in hisi_sas and remove sas_resume_ha_no_sync().
    
    The reorder is safe for the other libsas consumers (isci, pm8001,
    aic94xx, mvsas). During suspend, sas_suspend_devices() calls
    sas_notify_lldd_dev_gone() for each device, which sets dev->lldd_dev to
    NULL. When scsi_unblock_requests re-enables I/O in resume, any I/O to a
    timed-out phy's disk is immediately rejected by the LLDD before reaching
    hardware: isci returns SAS_DEVICE_UNKNOWN (mapped to DID_BAD_TARGET),
    and pm8001 returns SAS_PHY_DOWN (mapped to DID_NO_CONNECT). Both
    complete directly via scsi_done() without entering SCSI EH. This is
    identical in both the old and new ordering since lldd_dev_gone runs
    during suspend, before resume. The reorder only affects when the
    PHYE_RESUME_TIMEOUT handler runs (synchronized by sas_drain_work()
    vs. asynchronous after resume returns), not whether I/O can reach the
    device. aic94xx and mvsas do not register any PM ops and never reach
    this code path.
    
    Fixes: fbefe22811c3 ("scsi: libsas: Don't always drain event workqueue for HA resume")
    Signed-off-by: Xingui Yang <[email protected]>
    Reviewed-by: John Garry <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: scsi_debug: Fix REPORT ZONES alloc_len underflow OOB write [+ + +]
Author: Ibrahim Hashimov <[email protected]>
Date:   Sun Jul 12 20:37:39 2026 +0200

    scsi: scsi_debug: Fix REPORT ZONES alloc_len underflow OOB write
    
    commit 93dde0bf2f39a0f9f57fd610aa3201ce5b753433 upstream.
    
    resp_report_zones() sizes the reply buffer from the CDB allocation
    length. The v3 fix rounds alloc_len up with ALIGN() before deriving the
    descriptor count:
    
            rep_max_zones = (ALIGN((u64)alloc_len, RZONES_DESC_HD) -
                             RZONES_DESC_HD) >> ilog2(RZONES_DESC_HD);
            arr_len = (u64)RZONES_DESC_HD * (rep_max_zones + 1);
    
    For alloc_len in 0xFFFFFFC1..0xFFFFFFFF, ALIGN() rounds up to
    0x100000000, so arr_len is 4 GB. On 32-bit, kzalloc()'s size_t is 32-bit
    and truncates 0x100000000 to 0; kzalloc(0) returns ZERO_SIZE_PTR, which
    passes the !arr check, and desc = arr + 64 is then dereferenced in the
    loop -> out-of-bounds write / panic.
    
    Clamp rep_max_zones to devip->nr_zones. The loop already stops at
    sdebug_capacity (after nr_zones zones), so a report can never hold more
    than nr_zones descriptors; the clamp does not change the report, it only
    bounds arr_len to (nr_zones + 1) * RZONES_DESC_HD, a real device
    property that can never reach 0x100000000.
    
    Fixes: 7db0e0c8190a ("scsi: scsi_debug: Fix buffer size of REPORT ZONES command")
    Suggested-by: Damien Le Moal <[email protected]>
    Cc: [email protected]
    Signed-off-by: Ibrahim Hashimov <[email protected]>
    Assisted-by: AuditCode-AI:2026.07
    Reviewed-by: Damien Le Moal <[email protected]>
    Reviewed-by: Bart Van Assche <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

scsi: target: Clear cmd_cnt when initial counter enrollment fails [+ + +]
Author: Leon Romanovsky <[email protected]>
Date:   Wed Jul 22 09:30:10 2026 +0300

    scsi: target: Clear cmd_cnt when initial counter enrollment fails
    
    [ Upstream commit a8ddfd2425bbbafadae8700d63ed8a61a4109878 ]
    
    When target_get_sess_cmd() fails during session shutdown because
    percpu_ref_tryget_live() returns false, the command keeps the
    se_cmd->cmd_cnt pointer that __target_init_cmd() assigned earlier
    without owning a reference. Final release through
    target_release_cmd_kref() then issues an unmatched percpu_ref_put().
    
    Commit 8e288be8606a ("scsi: target: Pass in cmd counter to use during
    cmd setup") moved the cmd_cnt assignment ahead of the reference
    acquisition.  Clear se_cmd->cmd_cnt whenever the initial
    target_get_sess_cmd() fails in target_init_cmd() and
    target_submit_tmr(), so release performs exactly one matching put per
    acquired reference.
    
    Fixes: 8e288be8606a ("scsi: target: Pass in cmd counter to use during cmd setup")
    Signed-off-by: Leon Romanovsky <[email protected]>
    Reviewed-by: Mike Christie <[email protected]>
    Link: https://patch.msgid.link/20260722-reference-count-underflow-in-target-v1-1-63ab664f12fd@nvidia.com
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: target: iblock: Fix wrong PR ops NULL check for PREEMPT/RELEASE [+ + +]
Author: TanZheng <[email protected]>
Date:   Fri Jul 24 15:58:50 2026 +0800

    scsi: target: iblock: Fix wrong PR ops NULL check for PREEMPT/RELEASE
    
    [ Upstream commit 9c33222bd387312874fbe36ca8002e5c945b9653 ]
    
    In the iblock_execute_pr_out() function, PRO_PREEMPT,
    PRO_PREEMPT_AND_ABORT, and PRO_RELEASE all perform callback capability
    checks through ops->pr_clear. The error check allows unimplemented hooks
    to pass through the gate, resulting dereferencing a NULL function
    pointer.
    
    Check whether the hooks that need to be called are supported.
    
    Fixes: 394f81184882 ("scsi: target: Add block PR support to iblock")
    Signed-off-by: TanZheng <[email protected]>
    Reviewed-by: Mike Christie <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: ufs: core: Avoid IRQ thread wakeup during active UIC command [+ + +]
Author: Peter Wang <[email protected]>
Date:   Fri Mar 6 13:43:02 2026 +0800

    scsi: ufs: core: Avoid IRQ thread wakeup during active UIC command
    
    [ Upstream commit 6475cfb81fc4f6175b6d15d1c205a5168dc10b46 ]
    
    Only return IRQ_WAKE_THREAD when MCQ and ESI are not enabled and no UIC
    command is active. The default UIC command timeout is 500ms, Using threaded
    IRQs during an active UIC command increases the risk of timeout due to
    possible preemption by other system IRQs.
    
    Signed-off-by: Peter Wang <[email protected]>
    Reviewed-by: Bart Van Assche <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Martin K. Petersen <[email protected]>
    Stable-dep-of: 8a309036f557 ("scsi: ufs: core: Revert "Delegate the interrupt service routine to a threaded IRQ handler"")
    Signed-off-by: Sasha Levin <[email protected]>

scsi: ufs: core: Cancel RTC work in active-active suspend [+ + +]
Author: Guangshuo Li <[email protected]>
Date:   Wed Jul 15 01:27:26 2026 +0800

    scsi: ufs: core: Cancel RTC work in active-active suspend
    
    [ Upstream commit f71b4a30983b846b4075bf544e835121e70e6a43 ]
    
    UFS RTC support schedules ufs_rtc_update_work to periodically update the
    device RTC. The work can issue query commands and access the UFS host
    controller.
    
    A previous change moved the RTC work cancellation before the PRE_CHANGE
    vendor suspend callback to close a race in the common suspend path.
    However, the active-active path jumps directly to vops_suspend after
    flushing exception handling work and therefore bypasses the
    cancellation.
    
    If the RTC work runs while the vendor suspend callback is gating or
    otherwise changing hardware state, it can access the controller during
    suspend and trigger an SError.
    
    Cancel the RTC work before entering the vendor suspend callback in the
    active-active path. Since this path now cancels the work, move the RTC
    work scheduling outside the device and link state restoration block in
    the resume path. This restarts RTC updates after an active-active
    suspend and resume cycle.
    
    Fixes: b0bd84c39289 ("scsi: ufs: core: Fix SError in ufshcd_rtc_work() during UFS suspend")
    Signed-off-by: Guangshuo Li <[email protected]>
    Reviewed-by: Peter Wang <[email protected]>
    Reviewed-by: Bean Huo <[email protected]>
    Reviewed-by: Bart Van Assche <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: ufs: core: Revert "Delegate the interrupt service routine to a threaded IRQ handler" [+ + +]
Author: Bart Van Assche <[email protected]>
Date:   Wed Jul 15 10:12:28 2026 -0700

    scsi: ufs: core: Revert "Delegate the interrupt service routine to a threaded IRQ handler"
    
    [ Upstream commit 8a309036f557d3ff4efb2beea5132ba91172d934 ]
    
    There have been multiple reports of performance regressions caused by
    commit 3c7ac40d7322 ("scsi: ufs: core: Delegate the interrupt service
    routine to a threaded IRQ handler"). Hence this revert.
    
    This patch reverts most of the following commits:
    
     * 3c7ac40d7322 ("scsi: ufs: core: Delegate the interrupt service
       routine to a threaded IRQ handler")
    
     * 6475cfb81fc4 ("scsi: ufs: core: Avoid IRQ thread wakeup during active
       UIC command")
    
    This patch preserves the following commits:
    
     * 034d319c8899 ("scsi: ufs: core: Fix interrupt handling for MCQ Mode")
    
     * eabcac808ca3 ("scsi: ufs: core: Fix IRQ lock inversion for the SCSI
       host lock")
    
    Cc: Neil Armstrong <[email protected]>
    Cc: 孙魁 (Kui Sun) <[email protected]>
    Cc: André Draszik <[email protected]>
    Cc: Gregory CLEMENT <[email protected]>
    Cc: Sebastian Andrzej Siewior <[email protected]>
    Fixes: 3c7ac40d7322 ("scsi: ufs: core: Delegate the interrupt service routine to a threaded IRQ handler")
    Signed-off-by: Bart Van Assche <[email protected]>
    Reviewed-by: Sebastian Andrzej Siewior <[email protected]>
    Tested-by: André Draszik <[email protected]> # on Pixel 6
    Reviewed-by: André Draszik <[email protected]>
    Link: https://patch.msgid.link/b70eb60a01f971bed68c42c5b555929db5f835df.1784135511.git.bvanassche@acm.org
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: zfcp: Fix memory leak during adapter release by destroying gid_pn_req [+ + +]
Author: Benjamin Block <[email protected]>
Date:   Mon Jul 20 09:27:36 2026 +0200

    scsi: zfcp: Fix memory leak during adapter release by destroying gid_pn_req
    
    [ Upstream commit b601fa590e667bd9643feed8c869b6b3e418480d ]
    
    When releasing an adapter we don't free the mempool 'gid_pn_req' that is
    allocated during the enqueue. This leaks memory:
    
      unreferenced object 0xd8d29297de700 (size 256):
        comm "(udev-worker)", pid 2105, jiffies 4294945794
        hex dump (first 32 bytes):
          00 00 00 00 de ad 4e ad ff ff ff ff 00 00 00 00  ......N.........
          ff ff ff ff ff ff ff ff 00 0d c4 5f 67 9d 99 e0  ..........._g...
        backtrace (crc 4a5b5da2):
          [<000dc45f64da418c>] kmemleak_alloc+0x6c/0xa0
          [<000dc45f62b430aa>] __kmalloc_cache_node_noprof+0x36a/0x4d0
          [<000dc45f629a535a>] mempool_create_node_noprof+0xaa/0x150
          [<000dc45ee2c065e6>] zfcp_allocate_low_mem_buffers+0x96/0x370 [zfcp]
          [<000dc45ee2c070f8>] zfcp_adapter_enqueue+0x598/0xd40 [zfcp]
          [<000dc45ee2c08eb0>] zfcp_ccw_set_online+0x160/0x210 [zfcp]
          [<000dc45f643d4762>] ccw_device_set_online+0x232/0xd80
          [<000dc45f643d53d4>] online_store_recog_and_online+0x124/0x390
          [<000dc45f643d8238>] online_store+0x298/0x5b0
          [<000dc45f62eb0a04>] kernfs_fop_write_iter+0x2c4/0x480
          [<000dc45f62c81150>] new_sync_write+0x370/0x4b0
          [<000dc45f62c87abe>] vfs_write+0x43e/0x5b0
          [<000dc45f62c87ff4>] ksys_write+0x114/0x1f0
          [<000dc45f621c4a16>] do_syscall+0x2f6/0x430
          [<000dc45f64d9d5d8>] __do_syscall+0xc8/0x1c0
          [<000dc45f64dc2224>] system_call+0x74/0xa0
    
    Fix this by destroying the mempool during the adapter's release.
    
    Fixes: 799b76d09aee ("[SCSI] zfcp: Decouple gid_pn requests from erp")
    Signed-off-by: Benjamin Block <[email protected]>
    Tested-by: M Nikhil <[email protected]>
    Acked-by: M Nikhil <[email protected]>
    Reviewed-by: Chinmaya Kajagar <[email protected]>
    Reviewed-by: Nihar Panda <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
sctp: prevent peer transport count overflow [+ + +]
Author: Asim Viladi Oglu Manizada <[email protected]>
Date:   Sat Jul 25 03:21:06 2026 +0000

    sctp: prevent peer transport count overflow
    
    commit bd0e9289e2642f6a5c54faad304ce0f41e926d22 upstream.
    
    sctp_assoc_add_peer() increments the association's 16-bit transport_count
    for every new unique peer. Adding the 65,536th transport wraps the count to
    zero.
    
    SCTP sock_diag uses transport_count to reserve the INET_DIAG_PEERS payload,
    then copies one sockaddr_storage for every entry in transport_addr_list.
    After the wrap, a diagnostic dump reserves an empty payload and writes
    8 MiB of peer addresses past the skb tail.
    
    Reject a new unique peer when transport_count has reached U16_MAX. Perform
    the check after the existing-peer lookup so a duplicate address continues
    to return its existing transport at the limit.
    
    Fixes: 8f840e47f190 ("sctp: add the sctp_diag.c file")
    Cc: [email protected]
    Signed-off-by: Asim Viladi Oglu Manizada <[email protected]>
    Acked-by: Xin Long <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

sctp: reject stale cookies with mismatched verification tags [+ + +]
Author: Yuxiang Yang <[email protected]>
Date:   Thu Jul 23 22:56:23 2026 +0000

    sctp: reject stale cookies with mismatched verification tags
    
    commit 9d8da8e0a9bce4a340af60dd0446bc7eb8d07587 upstream.
    
    sctp_unpack_cookie() skips cookie expiration checks whenever an
    association already exists.  This is broader than the exception in
    RFC 9260 Section 5.2.4.
    
    For an existing association, Section 5.2.4 permits an expired State
    Cookie only when both Verification Tags in the cookie match the current
    association.  Otherwise, the packet SHOULD be discarded and a Stale
    Cookie ERROR MUST be sent.
    
    The broad check lets an expired Action A restart cookie reach
    sctp_sf_do_dupcook_a().  In a runtime test with the default 60 second
    cookie lifetime, replaying such a cookie after 65 seconds returned a
    COOKIE-ACK and restarted the association.
    
    Check cookie expiration unless both Verification Tags match.  This
    preserves the Action D exception for a lost COOKIE ACK while rejecting
    expired cookies in all other cases.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: [email protected]
    Signed-off-by: Yuxiang Yang <[email protected]>
    Acked-by: Xin Long <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

sctp: validate Adaptation Indication parameter length [+ + +]
Author: Charles Vosburgh <[email protected]>
Date:   Mon Jul 27 19:17:30 2026 -0400

    sctp: validate Adaptation Indication parameter length
    
    commit 74b21f52c5c5a71a05c0ff70e513f4f04ff28b17 upstream.
    
    The Adaptation Layer Indication parameter contains a fixed 32-bit
    Adaptation Code Point after its parameter header. However,
    sctp_verify_param() accepts a header-only parameter because the generic
    parameter walker only requires the header to be present.
    
    sctp_process_param() then reads adaptation_ind beyond the declared
    parameter. When the malformed parameter is last in an INIT, the read
    starts at the receive skb tail, and the value is copied into the state
    cookie returned in the INIT ACK. This may disclose four receive-buffer
    tail bytes.
    
    Require the declared parameter length to match the fixed structure size
    and abort the association through the existing invalid parameter length
    path otherwise.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: [email protected]
    Signed-off-by: Charles Vosburgh <[email protected]>
    Acked-by: Xin Long <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
selftest: af_unix: Create its own .gitignore. [+ + +]
Author: Kuniyuki Iwashima <[email protected]>
Date:   Mon Nov 24 21:26:39 2025 +0000

    selftest: af_unix: Create its own .gitignore.
    
    [ Upstream commit adb6b68c50604f3113d62758e839cc0186b94ce8 ]
    
    Somehow AF_UNIX tests have reused ../.gitignore,
    but now NIPA warns about it.
    
    Let's create .gitignore under af_unix/.
    
    Signed-off-by: Kuniyuki Iwashima <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Stable-dep-of: 7f57c650d08b ("selftests/net/af_unix: test listen() rejects wrong socket states")
    Signed-off-by: Sasha Levin <[email protected]>

selftest: fix headers in fclog.c [+ + +]
Author: Jori Koolstra <[email protected]>
Date:   Fri Jul 10 19:17:35 2026 +0200

    selftest: fix headers in fclog.c
    
    commit e3a0127eee04db8769e53c8102c4e76aa49be8c3 upstream.
    
    fclog.c does not compile because it is missing fcntl.h, needed for
    O_RDONLY etc.
    
    There are also some redundant includes that are also in
    kselftest_harness.h.
    
    Link: https://lore.kernel.org/[email protected]
    Signed-off-by: Jori Koolstra <[email protected]>
    Cc: Aleksa Sarai <[email protected]>
    Cc: Shuah Khan <[email protected]>
    Cc: Wei Yang <[email protected]>
    Cc: Christian Brauner <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
selftests/clone3: fix wild pointer access of getline due to missing init [+ + +]
Author: Chris Gellermann <[email protected]>
Date:   Wed Jul 22 15:02:45 2026 +0200

    selftests/clone3: fix wild pointer access of getline due to missing init
    
    commit 8f6f9fd93cd7a5dd607ad5cd910476dd68fff3ed upstream.
    
    Patch series "selftests: Add missing initalization of pointer passed to
    getline", v2.
    
    
    This patch (of 2):
    
    Clone3_set_tid uses getline(&line, ...) in a loop to read the child's
    process status.  The code expects that getline allocates the buffer for
    the line on the first loop iteration.  According to the Open Group
    Spec[1], char *line has to be null pointer for this:
    
    > ssize_t getline(char **restrict lineptr, ...);
    > If *lineptr is a null pointer or if the object pointed to by *lineptr
    > is of insufficient size, an object shall be allocated as if by
    malloc()
    > or the object shall be reallocated as if by realloc()[...].
    
    However, char *line is only declared, leading to an undefined value that
    is potentially non-null.  In an example run with Musl v1.2.6, the realloc
    call[2] of getdelim, which implements getline, triggers a segfault:
    
    ./run_kselftest.sh --test clone3:clone3_set_tid
    [ 1366.165898] kselftest: Running tests in clone3
    ...
    [ 1367.799244] clone3_set_tid[811]: unhandled signal 11 code 0x1 at
    0x0000000000000000 in libc.so[68184,3fbf69f000+4c000]
    [ 1367.802808] CPU: 0 UID: 0 PID: 811 Comm: clone3_set_tid Not tainted
    ..
    [ 1367.804188]  epc: 0x0000003fbf6b0184
    [ 1367.804188]  ra : 0x0000003fbf6d4664
    [ 1367.804188]  sp : 0x0000003fce5f2e40
    [ 1367.805314]  gp : 0x0000002aaab0dfb8
    [ 1367.805314]  tp : 0x0000003fbf6f14a8
    [ 1367.805314]  t0 : 0x0000003fbf63d000
    ...
    
    Looking at the realloc implementation, Musl mallocs for a null pointer
    memory.  But for a non-null pointer, it assumes it's passed a valid
    pointer to the heap and tries to access its meta-data.  This leads to the
    segfault we see:
    
    void *realloc(void *p, size_t n)
    {
            if (!p) return malloc(n);
            if (size_overflows(n)) return 0;
    
            struct meta *g = get_meta(p);
            ...
    }
    
    Fix this by properly initializing the line pointer to NULL.
    
    Link: https://lore.kernel.org/[email protected]
    Link: https://lore.kernel.org/[email protected]
    Link: https://pubs.opengroup.org/onlinepubs/9799919799/functions/getline.html [1]
    Link: https://git.musl-libc.org/cgit/musl/tree/src/stdio/getdelim.c#n38 [2]
    Fixes: 41585bbeeef9 ("selftests: add tests for clone3() with *set_tid")
    Signed-off-by: Chris Gellermann <[email protected]>
    Acked-by: David Hildenbrand (arm) <[email protected]>
    Reviewed-by: Lorenzo Stoakes <[email protected]>
    Cc: Christian Brauner <[email protected]>
    Cc: Liam R. Howlett <[email protected]>
    Cc: Lorenzo Stoakes <[email protected]>
    Cc: Michal Hocko <[email protected]>
    Cc: Mike Rapoport <[email protected]>
    Cc: Shuah Khan <[email protected]>
    Cc: Suren Baghdasaryan <[email protected]>
    Cc: Vlastimil Babka <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
selftests/lkdtm: rename STACKLEAK_ERASING to KSTACK_ERASE [+ + +]
Author: Haofeng Li <[email protected]>
Date:   Wed Jul 15 16:02:10 2026 +0800

    selftests/lkdtm: rename STACKLEAK_ERASING to KSTACK_ERASE
    
    [ Upstream commit b3a7aa9c0020ae549a0d4964867ff66d2bd61709 ]
    
    Commit 57fbad15c2ee ("stackleak: Rename STACKLEAK to KSTACK_ERASE")
    renamed the LKDTM crash type and selftest configuration but missed the
    entry in tests.txt.
    
    As a result, the selftest generates STACKLEAK_ERASING.sh, which run.sh
    skips because the LKDTM DIRECT trigger only exposes KSTACK_ERASE. Rename
    the test entry so the generated runner uses the registered crash type.
    
    Fixes: 57fbad15c2ee ("stackleak: Rename STACKLEAK to KSTACK_ERASE")
    Signed-off-by: Haofeng Li <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Kees Cook <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
selftests/mm: fix potential wild pointer access of getline due to missing init [+ + +]
Author: Chris Gellermann <[email protected]>
Date:   Wed Jul 22 15:02:46 2026 +0200

    selftests/mm: fix potential wild pointer access of getline due to missing init
    
    commit 9f1d75a4ce04095afdb63d8e540092ff8151dacf upstream.
    
    This is another occurrence of using getline where the code assumes that
    getline allocates memory to store the line, but the pointer passed to it
    is uninitialized and potentially a non-null pointer.  This violates the
    Open Group Spec[1] and caused a segfault in a similar situation in
    selftest/clone3/clone3_set_tid.  Fix it by initializing the line pointer
    to NULL.
    
    The issue has been found by simply grepping through the selftest code
    after running into the issue in clone3_set_tid.  Whether it segfaults in
    its current state is unknown to me.  But it's good to be addressed due to
    defensive reasons.
    
    Link: https://lore.kernel.org/[email protected]
    Link: https://pubs.opengroup.org/onlinepubs/9799919799/functions/getline.html [1]
    Fixes: 26b4224d9961 ("selftests: expanding more mlock selftest")
    Signed-off-by: Chris Gellermann <[email protected]>
    Acked-by: David Hildenbrand (arm) <[email protected]>
    Reviewed-by: Lorenzo Stoakes <[email protected]>
    Cc: Christian Brauner <[email protected]>
    Cc: Liam R. Howlett <[email protected]>
    Cc: Michal Hocko <[email protected]>
    Cc: Mike Rapoport <[email protected]>
    Cc: Shuah Khan <[email protected]>
    Cc: Suren Baghdasaryan <[email protected]>
    Cc: Vlastimil Babka <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
selftests/net/af_unix: test listen() rejects wrong socket states [+ + +]
Author: John Ericson <[email protected]>
Date:   Sat Jul 18 14:29:02 2026 -0400

    selftests/net/af_unix: test listen() rejects wrong socket states
    
    [ Upstream commit 7f57c650d08b8793bb551bdb33ad876535ef9fe8 ]
    
    Add a regression test for the unix_listen() state check. The key case is
    listen() on a bound socket that has already been connected: it is no
    longer in TCP_CLOSE or TCP_LISTEN, so it must fail with EINVAL. A
    prepare_peercred() call slipped in ahead of that check once left err at 0
    and made listen() silently succeed there instead; this guards against a
    repeat.
    
    The neighbouring outcomes are covered too so they cannot regress the same
    way: a bound socket in TCP_CLOSE listens fine, calling listen() again on a
    socket already in TCP_LISTEN is allowed, and an unbound socket fails with
    EINVAL.
    
    Each case runs for both listenable socket types (SOCK_STREAM and
    SOCK_SEQPACKET) and both pathname and abstract addresses.
    
    Fixes: fd0a109a0f6b ("net, pidfs: prepare for handing out pidfds for reaped sk->sk_peer_pid")
    Signed-off-by: John Ericson <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
selftests/seccomp: Fix pointer type mismatch build error [+ + +]
Author: Kuan-Ying Lee <[email protected]>
Date:   Wed Jul 15 13:35:52 2026 +0800

    selftests/seccomp: Fix pointer type mismatch build error
    
    [ Upstream commit 3421b9b056a6576d0ebac1030eafb48ad0544092 ]
    
    We hit the following build error while running the seccomp selftests in
    our testing.
    
    CC seccomp_bpf
    seccomp_bpf.c: In function ‘UPROBE_setup’:
    seccomp_bpf.c:5175:74: error: pointer type mismatch in conditional expression [-Wincompatible-pointer-types]
    5175 | offset = get_uprobe_offset(variant->uretprobe ? probed_uretprobe : probed_uprobe);
    | ^
    seccomp_bpf.c:5175:57: note: first expression has type ‘int (*)(void)’
    5175 | offset = get_uprobe_offset(variant->uretprobe ? probed_uretprobe : probed_uprobe);
    | ^~~~~~~~~~~~~~~~
    seccomp_bpf.c:5175:76: note: second expression has type ‘int (__attribute__((nocf_check)) *)(void)’
    5175 | offset = get_uprobe_offset(variant->uretprobe ? probed_uretprobe : probed_uprobe);
    | ^~~~~~~~~~~~~
    
    get_uprobe_offset() takes a 'const void *' argument, so cast both
    operands to 'void *'.
    
    Fixes: 9ffc7a635c35 ("selftests/seccomp: validate uprobe syscall passes through seccomp")
    Signed-off-by: Kuan-Ying Lee <[email protected]>
    Acked-by: Jiri Olsa <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Kees Cook <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
selftests: af_unix: Add tests for ECONNRESET and EOF semantics [+ + +]
Author: Sunday Adelodun <[email protected]>
Date:   Thu Nov 13 12:28:02 2025 +0100

    selftests: af_unix: Add tests for ECONNRESET and EOF semantics
    
    [ Upstream commit 45a1cd8346ca245a1ca475b26eb6ceb9d8b7c6f0 ]
    
    Add selftests to verify and document Linux’s intended behaviour for
    UNIX domain sockets (SOCK_STREAM and SOCK_DGRAM) when a peer closes.
    The tests verify that:
    
     1. SOCK_STREAM returns EOF when the peer closes normally.
     2. SOCK_STREAM returns ECONNRESET if the peer closes with unread data.
     3. SOCK_SEQPACKET returns EOF when the peer closes normally.
     4. SOCK_SEQPACKET returns ECONNRESET if the peer closes with unread data.
     5. SOCK_DGRAM does not return ECONNRESET when the peer closes.
    
    This follows up on review feedback suggesting a selftest to clarify
    Linux’s semantics.
    
    Suggested-by: Kuniyuki Iwashima <[email protected]>
    Signed-off-by: Sunday Adelodun <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Stable-dep-of: 7f57c650d08b ("selftests/net/af_unix: test listen() rejects wrong socket states")
    Signed-off-by: Sasha Levin <[email protected]>

 
smb: client: fix buffer leaks in SMB1 read and write [+ + +]
Author: Dawei Feng <[email protected]>
Date:   Sun Jun 28 14:59:09 2026 +0800

    smb: client: fix buffer leaks in SMB1 read and write
    
    [ Upstream commit 6a3e16d60e81a4aa3056ab15617036cfbea2e07d ]
    
    CIFSSMBRead(), CIFSSMBWrite() and CIFSSMBWrite2() allocate a request
    buffer before checking whether tcon->ses->server is NULL. If that
    defensive check ever fails, the helper returns -ECONNABORTED without
    releasing the request buffer.
    
    Fix these leaks by releasing the allocated request buffer before
    returning from these error paths. Use cifs_small_buf_release() for the
    buffers allocated by small_smb_init() and cifs_buf_release() for the
    buffer allocated by smb_init().
    
    The bug was first flagged by an experimental analysis tool we are
    developing for kernel memory-management bugs while analyzing
    v6.13-rc1. The tool is still under development and is not yet publicly
    available. Manual inspection confirms that the bug is still
    present in v7.1.1.
    
    An x86_64 allyesconfig build showed no new warnings.
    
    Runtime validation used a temporary fault-injection hook to force
    tcon->ses->server to NULL after request-buffer initialization. On the
    unfixed kernel, the harness observed two leaked small request buffers and
    one leaked large request buffer, with directed kmemleak dumps confirming
    the CIFS buffer allocation stacks. After the fix, no CIFS request-buffer
    deltas remained.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Dawei Feng <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
spi: qcom-qspi: Correct max DMA length to avoid 64K boundary failure [+ + +]
Author: Vijaya Krishna Nivarthi <[email protected]>
Date:   Wed Jul 22 14:53:58 2026 +0530

    spi: qcom-qspi: Correct max DMA length to avoid 64K boundary failure
    
    commit 90ef2f2961c2dc55957dafe2f53b3efdb4675efc upstream.
    
    The maximum size for a DMA data descriptor is 64KB-1 because the size
    field in HW is 16 bits wide. For this reason, transfers fail at 64KB
    and beyond.
    
    Lower max_dma_len to 60KB so larger transfers are split into multiple
    DMA blocks and do not hit the failing 64KB boundary. 60KB is chosen as
    a safe round number below the 64KB-1 hardware limit while satisfying
    alignment requirements.
    
    Tested on x1e80100 (Hamoa) with SPI-NOR flash (/dev/mtd0):
    
    Without patch:
      dd if=/dev/mtd0 of=/tmp/spi_dump.bin bs=32768 count=2  # works
      dd if=/dev/mtd0 of=/tmp/spi_dump.bin bs=65536 count=1  # fails
    
    With patch:
      dd if=/dev/mtd0 of=/tmp/spi_dump.bin bs=65536 count=1  # works
    
    Fixes: b5762d95607e ("spi: spi-qcom-qspi: Add DMA mode support")
    Cc: [email protected]
    Signed-off-by: Vijaya Krishna Nivarthi <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

spi: spi-cadence: enable SPI_CONTROLLER_MUST_TX [+ + +]
Author: Jun Guo <[email protected]>
Date:   Thu Jan 15 17:19:24 2026 +0800

    spi: spi-cadence: enable SPI_CONTROLLER_MUST_TX
    
    commit f6b625639e39bc384a7bddbf134a698d40258b3b upstream.
    
    During an SPI read operation, even if the xspi->txbuf passed to the
    cdns_spi_writerinterface is empty, it is still necessary to call
    cdns_spi_write(xspi, CDNS_SPI_TXD, txw); otherwise, the read operation
    will fail to obtain data correctly due to a lack of clocks.
    
    Fixes: 4e00135b2dd1 ("spi: spi-cadence: supports transmission with bits_per_word of 16 and 32")
    Reported-by: Rodrigo Alencar <[email protected]>
    Closes: https://lore.kernel.org/all/lbijvnnwsnddonmm5pveqzap6iibxhl4maneq43x4j6w64dev6@u75qhm5cwiob/
    Signed-off-by: Jun Guo <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

spi: spi-cadence: Move TX FIFO full busy-wait into FIFO [+ + +]
Author: Srikanth Boyapally <[email protected]>
Date:   Mon Jul 20 18:25:10 2026 +0530

    spi: spi-cadence: Move TX FIFO full busy-wait into FIFO
    
    [ Upstream commit d9eadfce2fac49445db40808fe4d8259f20a9d2b ]
    
    SPI host transfers could intermittently stall with spi_transfer timeouts.
    The TXFULL condition was checked only once in cdns_transfer_one() before
    cdns_spi_process_fifo(), so if the FIFO became full again during refill,
    writes could be dropped and the transfer would never complete.
    
    Move the TXFULL busy-wait into the TX path of cdns_spi_process_fifo() so
    the 10µs back-off is applied per FIFO entry during filling, ensuring
    forward progress and eliminating spurious timeouts.
    
    Restrict the delay to host mode using spi_controller_is_target(), the
    controller is passed into cdns_spi_process_fifo() so the check is made at
    the point of use. In target mode this delay must not run as it causes the
    target to miss its transfer window and corrupt data.
    
    Fixes: 49530e641178 ("spi: cadence: Add usleep_range() for cdns_spi_fill_tx_fifo()")
    Signed-off-by: Srikanth Boyapally <[email protected]>
    Reviewed-by: Radhey Shyam Pandey <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

spi: spi-cadence: supports transmission with bits_per_word of 16 and 32 [+ + +]
Author: Jun Guo <[email protected]>
Date:   Fri Oct 31 15:30:02 2025 +0800

    spi: spi-cadence: supports transmission with bits_per_word of 16 and 32
    
    [ Upstream commit 4e00135b2dd1d7924a58bffa551b6ceb3bd836f2 ]
    
    The default FIFO data width of the Cadence SPI IP is 8 bits, but
    the hardware supports configurations of 16 bits and 32 bits.
    This patch enhances the driver to support communication with both
    16-bits and 32-bits FIFO data widths.
    
    Signed-off-by: Jun Guo <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Stable-dep-of: d9eadfce2fac ("spi: spi-cadence: Move TX FIFO full busy-wait into FIFO")
    Signed-off-by: Sasha Levin <[email protected]>

spi: spi-nxp-fspi: add per-SoC SDR/DTR clock rate limits for all supported SoCs [+ + +]
Author: Haibo Chen <[email protected]>
Date:   Tue Jul 28 18:18:08 2026 +0800

    spi: spi-nxp-fspi: add per-SoC SDR/DTR clock rate limits for all supported SoCs
    
    [ Upstream commit 9c19d60fea9f46ed0c3394653ef4941f1a459968 ]
    
    The commit f43579ef3500 ("spi: spi-nxp-fspi: limit the clock rate for
    different sample clock source selection") introduced a global 166MHz
    cap for DTR mode (RXCLKSRC=3), based on the i.MX8MN datasheet timing
    specification (Section 3.9.9, page 65).
    
    After reviewing the FlexSPI timing parameters in the datasheets for all
    supported SoCs, the following corrections and additions are needed:
    
    1. SDR mode (RXCLKSRC=0) limits vary per SoC:
       - i.MX8MN/MM/MP/95: 66MHz  (IMX8MNCEC §3.9.9, IMX8MMCEC §3.9.10,
                                    IMX8MPCEC, IMX95CEC Rev.8 §4.11.7)
       - i.MX8QXP/QM/DXL/ULP: 60MHz (IMX8QXPCEC, IMX8QMCEC, IMX8DXLCEC,
                                       IMX8ULPCEC §7.3.1 ND mode)
       - LX2160A: 100MHz            (LX2160ACEC FlexSPI timing parameters)
    
    2. DTR mode (RXCLKSRC=3) limits vary per SoC:
       - i.MX8MN/MM/MP/ULP: 166MHz
       - i.MX8QXP/QM/DXL: 200MHz   (same FlexSPI IP across this family)
       - i.MX95: 200MHz             (IMX95CEC §4.11.7.3.2.3 Table 106)
       - LX2160A: DTR disabled      (FSPI_QUIRK_DISABLE_DTR)
    
    Update related platform data with correct speed limation according
    to datasheet.
    
    Fixes: f43579ef3500 ("spi: spi-nxp-fspi: limit the clock rate for different sample clock source selection")
    Signed-off-by: Haibo Chen <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

spi: spi-qpic-snand: write the feature value before executing SET_FEATURE [+ + +]
Author: Stanislaw Pal <[email protected]>
Date:   Mon Jul 27 18:32:16 2026 +0200

    spi: spi-qpic-snand: write the feature value before executing SET_FEATURE
    
    commit 8fd62901d6bf03f274a49dd0060793cc07dd51b0 upstream.
    
    qcom_spi_send_cmdaddr() programs NAND_FLASH_CMD/NAND_EXEC_CMD and submits
    the descriptors, which makes the controller execute the command
    immediately. For SPINAND_SET_FEATURE the value to be written is only
    placed into NAND_FLASH_FEATURES afterwards, by qcom_spi_io_op(), in a
    second submission - so the chip is programmed with whatever that register
    happened to hold from a previous operation, and the intended value is only
    applied by the *next* SET_FEATURE.
    
    Measured on a TP-Link Archer AX55 v1 (IPQ5018, ESMT F50L1G41LB): writing
    0x40 to the configuration register (0xb0) leaves the chip at 0x00, and the
    subsequent write of 0x00 leaves it at 0x40 - every write lands one
    operation late.
    
    This stayed unnoticed until v6.18 added SPI-NAND OTP support together
    with OTP entries for ESMT chips. spinand_otp_rw() enables OTP mode,
    reads, and disables it again, and mtd_otp_nvmem_add() does this during
    MTD registration. With the off-by-one, the "disable" write actually
    applies the previously requested value, so CFG_OTP_ENABLE ends up set:
    the chip stays in OTP mode, every subsequent array read returns the OTP
    area instead of the array (UBI reports an empty device) and all writes
    fail with -EIO because the OTP area is write protected. On this board
    that makes the whole flash unusable and the device unbootable.
    
    Write the feature value into NAND_FLASH_FEATURES as part of the same
    transaction, before NAND_EXEC_CMD. While at it, copy only the bytes the
    operation actually carries - the previous code dereferenced a 4-byte
    pointer on a one-byte buffer (spinand->scratchbuf).
    
    With this patch the flash contents read back bit-identical to a
    known-good dump of the same board taken under the vendor firmware
    (md5-verified across partitions), and writes work.
    
    Fixes: 7304d1909080 ("spi: spi-qpic: add driver for QCOM SPI NAND flash Interface")
    Cc: [email protected]
    Signed-off-by: Stanislaw Pal <[email protected]>
    Reviewed-by: Md Sadre Alam <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
thunderbolt: Prevent XDomain delayed work use-after-free on disconnect [+ + +]
Author: Michael Bommarito <[email protected]>
Date:   Wed May 27 07:46:04 2026 -0400

    thunderbolt: Prevent XDomain delayed work use-after-free on disconnect
    
    [ Upstream commit 2c5d2d3c3f70cde2565d7b279b544893a2035842 ]
    
    tb_xdp_handle_request() runs on system_wq and queues
    xd->state_work via queue_delayed_work() in three request handlers:
    PROPERTIES_CHANGED_REQUEST, UUID_REQUEST (via start_handshake),
    and LINK_STATE_CHANGE_REQUEST.  Similarly, update_xdomain() queues
    xd->properties_changed_work when local properties change.
    
    Concurrently, tb_xdomain_remove() calls stop_handshake() which does
    cancel_delayed_work_sync() on both delayed works.  Later,
    tb_xdomain_unregister() calls device_unregister() which eventually
    frees the xdomain.  Since commit 559c1e1e0134 ("thunderbolt: Run
    tb_xdp_handle_request() in system workqueue") moved the request
    handler off tb->wq, the handler and the remove path are no longer
    serialized.  If queue_delayed_work() executes after
    cancel_delayed_work_sync() but before the xdomain is freed, the
    delayed work fires on a freed object.
    
    Add xd->removing that tb_xdomain_remove() sets under xd->lock
    before calling stop_handshake().  Each external queue site holds
    the same lock and checks removing before calling
    queue_delayed_work().  This provides the mutual exclusion needed:
    either the queue site acquires the lock first and queues work that
    the subsequent cancel will see, or the remove path acquires the
    lock first and the queue site observes removing == true and skips
    the queue.
    
    Fixes: 559c1e1e0134 ("thunderbolt: Run tb_xdp_handle_request() in system workqueue")
    Cc: [email protected]
    Assisted-by: Claude:claude-opus-4-7
    Signed-off-by: Michael Bommarito <[email protected]>
    Signed-off-by: Mika Westerberg <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
tipc: avoid use-after-free in poll trace queue dumps [+ + +]
Author: Zihan Xi <[email protected]>
Date:   Fri Jul 24 00:38:41 2026 +0800

    tipc: avoid use-after-free in poll trace queue dumps
    
    commit b4f1719dfea023220e0e6bd892b087d76b2a6a49 upstream.
    
    TIPC socket tracepoints dump queue state through tipc_sk_dump(). Most
    queue-dump callsites already serialize that walk under the socket lock or
    sk->sk_lock.slock, but tipc_poll() calls trace_tipc_sk_poll(...,
    TIPC_DUMP_ALL, ...) without holding either lock.
    
    That lets the poll trace path reach tipc_list_dump() and backlog head/tail
    dumping while another context dequeues and frees an skb, leaving the trace
    helper dereferencing a stale queue entry.
    
    Stop the unlocked poll trace site from requesting queue dumps. Other queue
    dump trace callsites keep their existing output under the locking they
    already provide, while poll still emits the event itself without walking
    live queue members from an unlocked context.
    
    Fixes: b4b9771bcbbd ("tipc: enable tracepoints in tipc")
    Cc: [email protected]
    Reported-by: Vega <[email protected]>
    Signed-off-by: Zihan Xi <[email protected]>
    Signed-off-by: Ren Wei <[email protected]>
    Reviewed-by: Tung Nguyen <[email protected]>
    Link: https://patch.msgid.link/f8119abd5e5ecc400597de667ae9d39656de56d0.1784794294.git.zihanx@nebusec.ai
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
tracing/filters: Fix false positive match in regex_match_full() [+ + +]
Author: Masami Hiramatsu (Google) <[email protected]>
Date:   Wed Jul 29 09:28:07 2026 +0900

    tracing/filters: Fix false positive match in regex_match_full()
    
    commit c22c7b735f9810ad276014f788f9aa5c879ec238 upstream.
    
    regex_match_full() calls strncmp(str, r->pattern, len) where len is the
    target field buffer size. When len is smaller than r->len (the filter
    pattern length), strncmp() checks only len bytes of r->pattern against
    str. If those len bytes match, strncmp() returns 0, resulting in a
    false-positive match where a shorter string in a fixed-size field
    matches a longer filter pattern.
    
    For example, a 4-byte static string field containing "abcd" matched the
    filter pattern "abcdefgh" because strncmp("abcd", "abcdefgh", 4)
    returned 0. In this case, @len does NOT include '\0' because it is
    fixed-size array.
    
    Fix this by returning 0 (no match) early when len < r->len.
    
    Fixes: 1889d20922d1 ("tracing/filters: Provide basic regex support")
    Cc: [email protected]
    Link: https://patch.msgid.link/178528488779.124250.5571741156199253769.stgit@devnote2
    Assisted-by: Antigravity:gemini-3.5-flash
    Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
    Signed-off-by: Steven Rostedt <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
tracing/fprobe: Roll back on enable_trace_fprobe() failure [+ + +]
Author: Raushan Patel <[email protected]>
Date:   Fri Jul 24 12:12:08 2026 +0530

    tracing/fprobe: Roll back on enable_trace_fprobe() failure
    
    commit aca0cd1bf16574327ef64f3178e5f5e37a61ef0b upstream.
    
    enable_trace_fprobe() sets the file link or the TP_FLAG_PROFILE flag and
    then registers each trace_fprobe in the probe list. If
    __register_trace_fprobe() fails partway through, the function returns
    immediately without unregistering the trace_fprobes it already registered
    or undoing the file link / flag it set, leaving the event half-enabled and
    leaking the registered fprobe(s).
    
    enable_trace_kprobe() already handles this with a rollback path. Do the
    same for fprobe: on failure, unregister all probes and clear the file link
    or profile flag.
    
    Link: https://lore.kernel.org/all/[email protected]/
    
    Fixes: 334e5519c375 ("tracing/probes: Add fprobe events for tracing function entry and exit.")
    Cc: [email protected]
    Signed-off-by: Raushan Patel <[email protected]>
    Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
tracing/mmiotrace: Add NULL check for mmio_trace_array in logging functions [+ + +]
Author: Masami Hiramatsu (Google) <[email protected]>
Date:   Tue Jul 28 21:50:00 2026 +0900

    tracing/mmiotrace: Add NULL check for mmio_trace_array in logging functions
    
    [ Upstream commit 12b80cdbc54cf615b4717a4e8180063408091ea2 ]
    
    mmio_trace_rw() and mmio_trace_mapping() retrieve mmio_trace_array into
    tr and pass it to __trace_mmiotrace_rw() and __trace_mmiotrace_map().
    If these functions are invoked while mmio_trace_array is NULL (e.g. before
    initialization or after disabled), accessing tr->array_buffer.buffer will
    result in a NULL pointer dereference crash.
    
    Fix this by adding an explicit NULL check for tr at the beginning of
    __trace_mmiotrace_rw() and __trace_mmiotrace_map().
    
    Link: https://patch.msgid.link/178524300062.56416.8362487250709962380.stgit@devnote2
    Fixes: f984b51e0779 ("ftrace: add mmiotrace plugin")
    Assisted-by: Antigravity:gemini-3.6-flash
    Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
    Signed-off-by: Steven Rostedt <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

tracing/mmiotrace: Reset dropped_count in mmio_reset_data() [+ + +]
Author: Masami Hiramatsu (Google) <[email protected]>
Date:   Tue Jul 28 21:49:51 2026 +0900

    tracing/mmiotrace: Reset dropped_count in mmio_reset_data()
    
    [ Upstream commit c786d2bdf1f3964deee192ad942dee2a741c1e2c ]
    
    mmio_reset_data() is called during tracer initialization, reset, and
    start. While it resets overrun_detected and prev_overruns, it neglects
    to reset dropped_count. Consequently, dropped event counts from prior
    tracing sessions persist in dropped_count and corrupt overrun reports
    in subsequent runs.
    
    Fix this by explicitly calling atomic_set(&dropped_count, 0) in
    mmio_reset_data().
    
    Link: https://patch.msgid.link/178524299122.56416.16277704230639425172.stgit@devnote2
    Fixes: 173ed24ee2d6 ("mmiotrace: count events lost due to not recording")
    Assisted-by: Antigravity:gemini-3.6-flash
    Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
    Signed-off-by: Steven Rostedt <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
tracing/probes: Reject $arg0 in meta argument expansion [+ + +]
Author: Raushan Patel <[email protected]>
Date:   Fri Jul 24 11:14:35 2026 +0530

    tracing/probes: Reject $arg0 in meta argument expansion
    
    commit 00a8ce2a2a9fa17674e1feec4d9105c1a5d6a419 upstream.
    
    traceprobe_expand_meta_args() parses $argN with simple_strtoul() and
    calls sprint_nth_btf_arg(n - 1, ...). For $arg0, n is 0 so the index is
    -1. Because ctx->nr_params is signed, the "idx >= nr_params" guard in
    sprint_nth_btf_arg() does not catch the negative index, and
    ctx->params[-1].name_off is read out of bounds.
    
    The normal per-argument path (parse_probe_vars()) already rejects
    $arg0 via its argument-number check, but meta-argument expansion runs
    before per-argument parsing and substitutes the value first, bypassing
    that check.
    
    Reject $arg0 explicitly during expansion.
    
    Link: https://lore.kernel.org/all/[email protected]/
    
    Fixes: 18b1e870a496 ("tracing/probes: Add $arg* meta argument for all function args")
    Cc: [email protected]
    Signed-off-by: Raushan Patel <[email protected]>
    Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
tracing: Check return value of __register_event() in trace_module_add_events() [+ + +]
Author: Masami Hiramatsu (Google) <[email protected]>
Date:   Wed Jul 29 09:27:58 2026 +0900

    tracing: Check return value of __register_event() in trace_module_add_events()
    
    commit ac8719969e6c3c54e939834df812bc41f25453cf upstream.
    
    trace_module_add_events() ignores the return value of __register_event()
    and unconditionally calls __add_event_to_tracers() for each event.
    
    If __register_event() fails (for example, if event_init() fails), the
    trace_event_call is not added to ftrace_events list, but
    __add_event_to_tracers() still creates a trace_event_file pointing to it.
    If module loading subsequently fails and module memory is freed, tracing
    state retains a stale trace_event_call pointer in trace_event_file,
    leading to a use-after-free when tracefs or tracing subsystem operations
    are later executed.
    
    Fix this by checking the return value of __register_event() and only
    calling __add_event_to_tracers() if event registration succeeded.
    
    Fixes: ae63b31e4d0e ("tracing: Separate out trace events from global variables")
    Cc: [email protected]
    Link: https://patch.msgid.link/178528487878.124250.14170824576025743236.stgit@devnote2
    Assisted-by: Antigravity:gemini-3.5-flash
    Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
    Signed-off-by: Steven Rostedt <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ublk: reset kernel-owned dev_info fields in ublk_ctrl_add_dev() [+ + +]
Author: Ming Lei <[email protected]>
Date:   Sun Jul 26 09:50:25 2026 -0500

    ublk: reset kernel-owned dev_info fields in ublk_ctrl_add_dev()
    
    commit e65848e4ce352bac9e3465099354c8b8f845391f upstream.
    
    ublk_ctrl_add_dev() memcpy()s the userspace ublksrv_ctrl_dev_info into
    ub->dev_info and then fixes up the fields the driver owns, but misses
    ->state and ->ublksrv_pid.
    
    A device added with ->state = UBLK_S_DEV_LIVE passes the
    "->state != UBLK_S_DEV_DEAD" test that ublk_stop_dev_unlocked() uses as its
    proxy for "a disk is attached", while ->ub_disk is still NULL, so DEL_DEV
    right after ADD_DEV oopses in del_gendisk().  UBLK_S_DEV_QUIESCED plus
    UBLK_F_USER_RECOVERY dies one step earlier, in ublk_force_abort_dev().  A
    poisoned ->state also gets START_USER_RECOVERY and the char device
    read/write path onto a device that was never started, and wedges START_DEV
    at -EEXIST.  A poisoned ->ublksrv_pid just makes GET_DEV_INFO report an
    unrelated task as the ublk server.
    
    Reset both after the memcpy(), as ublk_detach_disk() does.  Userspace only
    ever reads these back, so correcting them silently breaks nothing.
    
    ADD_DEV has copied ->state in unsanitized since ublk was merged, but back
    then it was harmless: the gendisk was allocated during ADD_DEV, and both
    teardown and the START_DEV -EEXIST check keyed off disk_live() rather than
    ->state.  The oops became reachable once the disk allocation moved to
    START_DEV and those checks switched to ->state.
    
    Fixes: 6d9e6dfdf3b2 ("ublk: defer disk allocation")
    Cc: [email protected]
    Signed-off-by: Ming Lei <[email protected]>
    Reviewed-by: Caleb Sander Mateos <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
um: vector: fix use-after-free in vector_mmsg_rx() [+ + +]
Author: Michael Bommarito <[email protected]>
Date:   Mon Jun 22 08:47:22 2026 -0400

    um: vector: fix use-after-free in vector_mmsg_rx()
    
    commit af421e9aed3920c7ac88c24daa48606c7112feca upstream.
    
    When vector_mmsg_rx() discards a packet whose overlay header fails
    verify_header(), it frees the skb and continues the loop:
    
            if (header_check < 0) {
                    dev_kfree_skb_irq(skb);
                    vp->estats.rx_encaps_errors++;
                    continue;
            }
    
    The normal and short-packet paths fall through to the bottom of the
    loop body, which clears the consumed slot and advances the cursors:
    
            (*skbuff_vector) = NULL;
            mmsg_vector++;
            skbuff_vector++;
    
    The verify_header() < 0 path skips that via continue, so the freed skb
    is left in skbuff_vector[] and the cursors do not advance. The next
    iteration reads the same slot, gets the freed skb, and frees it again,
    producing a refcount underflow / use-after-free in the RX path.
    
    Discard the slot the same way the other paths do before continuing.
    
    Only transports whose verify_header() can return negative are affected:
    GRE and L2TPv3 do so on a cookie/session-id mismatch (raw/tap do not),
    so any peer on such a transport can trigger it without authentication.
    
    Fixes: 49da7e64f33e ("High Performance UML Vector Network Driver")
    Cc: [email protected]
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: Michael Bommarito <[email protected]>
    Signed-off-by: Richard Weinberger <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
uprobes: Fix NULL pointer dereference in hprobe_expire() [+ + +]
Author: Breno Leitao <[email protected]>
Date:   Wed Jul 29 07:44:40 2026 -0700

    uprobes: Fix NULL pointer dereference in hprobe_expire()
    
    commit cc679d7a6303e84d769f2afcde1fc51c51f127cd upstream.
    
    Forking a task that has a pending uretprobe can oops the kernel with a
    NULL pointer dereference in the clone() path:
    
      BUG: kernel NULL pointer dereference, address: 0000000000000018
      Oops: 0002 [#1] SMP NOPTI
      RIP: 0010:hprobe_expire
      CR2: 0000000000000018
      Call Trace:
       uprobe_copy_process
       copy_process
       kernel_clone
       __x64_sys_clone
       do_syscall_64
       entry_SYSCALL_64_after_hwframe
    
    This was found on real hosts on Meta fleet.
    
    I've got the impression that this is what is happening:
    
      CPU 1                          CPU 2 (traced task)
      -----                          -------------------
                                     hit uprobe, prepare_uretprobe():
                                       hprobe LEASED, refcount >= 1
      uprobe_unregister()
        put_uprobe(): refcount -> 0
                                     fork() -> dup_utask()
                                       hprobe_expire(hprobe, true)
                                         try_get_uprobe() -> NULL
                                         get_uprobe(NULL)   <-- Oops
    
    Only take the extra reference when the uprobe is non-NULL; a NULL means
    it is gone and is the correct value to return.
    
    Fixes: dd1a7567784e ("uprobes: SRCU-protect uretprobe lifetime (with timeout)")
    Signed-off-by: Breno Leitao <[email protected]>
    Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
    Acked-by: Oleg Nesterov <[email protected]>
    Acked-by: Andrii Nakryiko <[email protected]>
    Cc: [email protected]
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
usb: typec: ucsi: Correct teardown ordering in ucsi_init() error path [+ + +]
Author: Andrei Kuchynski <[email protected]>
Date:   Fri Jul 17 10:46:14 2026 +0000

    usb: typec: ucsi: Correct teardown ordering in ucsi_init() error path
    
    commit fb0bf289f5d529336ef490c8273e88a8a8b29f69 upstream.
    
    The commit 7aa7d4bf9d3f ("usb: typec: ucsi: Fix race condition and
    ordering in port unregistration") consolidated port teardown into the
    ucsi_unregister_port() helper. However, it introduced an ordering problem
    in the ucsi_init() error path.
    
    Fix this by ensuring ucsi_unregister_port() is called before we unregister
    their corresponding lockdep keys.
    
    Cc: [email protected]
    Fixes: 7aa7d4bf9d3f ("usb: typec: ucsi: Fix race condition and ordering in port unregistration")
    Reported-by: "Borah, Chaitanya Kumar" <[email protected]>
    Closes: https://lore.kernel.org/all/[email protected]/
    Signed-off-by: Andrei Kuchynski <[email protected]>
    Tested-by: Chaitanya Kumar Borah <[email protected]>
    Reviewed-by: Heikki Krogerus <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: typec: ucsi: Fix race condition and ordering in port unregistration [+ + +]
Author: Andrei Kuchynski <[email protected]>
Date:   Thu Jul 30 15:29:52 2026 -0400

    usb: typec: ucsi: Fix race condition and ordering in port unregistration
    
    [ Upstream commit 7aa7d4bf9d3fa9a6a47b640ad103ab433b7ff261 ]
    
    A synchronization issue exists during port unregistration where pending
    partner work items can race against workqueue destruction, leading to
    use-after-free conditions:
    
      cros_ec_ucsi cros_ec_ucsi.3.auto: error -ETIMEDOUT: PPM init failed
      BUG: kernel NULL pointer dereference, address: 0000000000000000
      RIP: 0010:__queue_work+0x83/0x4a0
      Call Trace:
        <IRQ>
        __cfi_delayed_work_timer_fn+0x10/0x10
        run_timer_softirq+0x3b6/0xbd0
        sched_clock_cpu+0xc/0x110
        irq_exit_rcu+0x18d/0x330
        fred_sysvec_apic_timer_interrupt+0x5e/0x80
    
    Fix this by ensuring strict ordering and proper serialization during
    teardown:
    
    1. Move ucsi_unregister_partner() to the beginning of the teardown
    sequence and protect it under the connector mutex lock.
    2. Ensure all pending partner tasks are explicitly flushed and finished
    before the workqueue is destroyed.
    3. Switch from mod_delayed_work() to a cancel_delayed_work() and
    queue_delayed_work() sequence. This guarantees that items currently marked
    as pending won't be scheduled an additional time, preventing a double
    release of resources which leads to the following crash:
    
      Oops: general protection fault, probably for non-canonical address
        0xdead000000000122: 0000 [#1] SMP NOPTI
      Workqueue: cros_ec_ucsi.3.auto-con2 ucsi_poll_worker
      RIP: 0010:ucsi_poll_worker+0x65/0x1e0
      Call Trace:
      <TASK>
        process_scheduled_works+0x218/0x6d0
        worker_thread+0x188/0x3f0
        __cfi_worker_thread+0x10/0x10
        kthread+0x226/0x2a0
    
    To ensure these rules are applied identically across both the normal
    teardown and the ucsi_init() error paths, consolidate the cleanup logic
    into a new helper, ucsi_unregister_port().
    
    Cc: stable <[email protected]>
    Fixes: b9aa02ca39a4 ("usb: typec: ucsi: Add polling mechanism for partner tasks like alt mode checking")
    Fixes: b13abcb7ddd8 ("usb: typec: ucsi: Fix NULL pointer access")
    Fixes: fac4b8633fd6 ("usb: ucsi: Ensure connector delayed work items are flushed")
    Signed-off-by: Andrei Kuchynski <[email protected]>
    Reviewed-by: Benson Leung <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: typec: ucsi: split connector lock classes [+ + +]
Author: Sergey Senozhatsky <[email protected]>
Date:   Thu Jul 30 15:29:51 2026 -0400

    usb: typec: ucsi: split connector lock classes
    
    [ Upstream commit 8c22256bbafad3dc5fdbe9f684d045b67ff06a68 ]
    
    Lockdep detects a possible recursive locking scenario during
    ucsi init:
    
    [    5.418616] ============================================
    [    5.418634] WARNING: possible recursive locking detected
    [    5.418706] --------------------------------------------
    [    5.418725] kworker/4:1/82 is trying to acquire lock:
    [    5.418759] ffff888119a34648 (&con->lock){+.+.}-{3:3}, at: ucsi_init_work+0x1a78/0x2eb0 [typec_ucsi]
    [    5.418801]
                   but task is already holding lock:
    [    5.418835] ffff888119a34080 (&con->lock){+.+.}-{3:3}, at: ucsi_init_work+0x1a78/0x2eb0 [typec_ucsi]
    [    5.418884]
                   other info that might help us debug this:
    [    5.418904]  Possible unsafe locking scenario:
    
    [    5.418937]        CPU0
    [    5.418956]        ----
    [    5.418991]   lock(&con->lock);
    [    5.419013]   lock(&con->lock);
    [    5.419033]
                    *** DEADLOCK ***
    
    [    5.419387] Call Trace:
    [    5.419406]  <TASK>
    [    5.419425]  dump_stack_lvl+0x61/0xa0
    [    5.419448]  print_deadlock_bug+0x4a6/0x650
    [    5.419483]  __lock_acquire+0x62b6/0x7f50
    [    5.419507]  lock_acquire+0x11b/0x390
    [    5.419654]  __mutex_lock+0xbc/0xcd0
    [    5.419741]  ucsi_init_work+0x1a78/0x2eb0
    [    5.419785]  ? worker_thread+0xf53/0x2bc0
    [    5.419819]  worker_thread+0xff4/0x2bc0
    [    5.419842]  kthread+0x2a7/0x330
    [    5.419863]  ? __pfx_worker_thread+0x10/0x10
    [    5.419896]  ? __pfx_kthread+0x10/0x10
    [    5.419916]  ret_from_fork+0x38/0x70
    [    5.419936]  ? __pfx_kthread+0x10/0x10
    [    5.419969]  ret_from_fork_asm+0x1b/0x30
    [    5.419991]  </TASK>
    [    5.420009] ---[ end trace 0000000000000000 ]---
    
    The problem is that all connector locks belong to the same
    lockdep lock class, so the following loop:
    
            for (i = 0; i < ucsi->cap.num_connectors; i++)
                    ucsi_register_port(connector[i])
                            mutex_lock(&connector[i]->lock)
    
    looks like a recursive acquire of the same mutex.  Put each connector
    lock into a dedicated lock class so that lockdep doesn't see it as a
    possible recursion.
    
    Signed-off-by: Sergey Senozhatsky <[email protected]>
    Reviewed-by: Heikki Krogerus <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Stable-dep-of: 7aa7d4bf9d3f ("usb: typec: ucsi: Fix race condition and ordering in port unregistration")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
userfaultfd: prevent registration of special VMAs [+ + +]
Author: Mike Rapoport (Microsoft) <[email protected]>
Date:   Thu Aug 6 23:34:59 2026 -0400

    userfaultfd: prevent registration of special VMAs
    
    [ Upstream commit 3c58f641e813c3c71039f8fd4d4e2a3aab713288 ]
    
    Vova Tokarev says:
    
      userfaultfd allows registration on shadow stack VMAs.  With userfaultfd
      access, you can register on the shadow stack, discard a page ... and
      inject a page with chosen return addresses via UFFDIO_COPY.
    
    Update vma_can_userfault() to reject VM_SHADOW_STACK.
    
    While on it, also reject VM_SPECIAL so that if a driver would implement
    vm_uffd_ops, it wouldn't be possible to register special VMAs with
    userfaultfd.
    
    Since VM_SPECIAL includes VM_DONTEXPAND which is set but hugetlb, exclude
    hugetlb VMAs from the check for VM_SPECIAL.
    
    Link: https://lore.kernel.org/[email protected]
    Fixes: 54007f818206 ("mm: Introduce VM_SHADOW_STACK for shadow stack memory")
    Signed-off-by: Mike Rapoport (Microsoft) <[email protected]>
    Reported-by: vova tokarev <[email protected]>
    Acked-by: David Hildenbrand (Arm) <[email protected]>
    Reviewed-by: Lorenzo Stoakes <[email protected]>
    Cc: Al Viro <[email protected]>
    Cc: Christian Brauner <[email protected]>
    Cc: Jan Kara <[email protected]>
    Cc: Linus Torvalds <[email protected]>
    Cc: Mike Rapoport <[email protected]>
    Cc: Oleg Nesterov <[email protected]>
    Cc: Peter Xu <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
veth: convert frag_list skbs before running XDP [+ + +]
Author: Matt Fleming <[email protected]>
Date:   Wed Jul 22 20:19:25 2026 +0100

    veth: convert frag_list skbs before running XDP
    
    commit d0d6415963040c401e7a7e4e482a698ba52448cb upstream.
    
    A frag_list skb can reach veth with data_len set but nr_frags zero.
    veth_convert_skb_to_xdp_buff() only converts skbs that are shared,
    locked, have frags[], or do not have enough headroom. It later uses
    skb_is_nonlinear() to decide whether to set XDP_FLAGS_HAS_FRAGS and
    xdp_frags_size.
    
    That exposes frag_list data to XDP as if it were stored in frags[], but
    frags[] is empty. AF_XDP copy mode can then trust the bogus XDP fragment
    metadata, walk an empty fragment entry, and crash in memcpy() from
    __xsk_rcv().
    
    Route non-linear skbs through skb_pp_cow_data() before exposing them to
    XDP, and only advertise XDP frags when the resulting skb has frags[].
    skb_copy_bits() already handles frag_list input, and skb_pp_cow_data()
    builds frags[] output with skb_add_rx_frag(), which is the
    representation XDP multi-buffer expects.
    
    Fixes: 718a18a0c8a6 ("veth: Rework veth_xdp_rcv_skb in order to accept non-linear skb")
    Cc: [email protected]
    Signed-off-by: Matt Fleming <[email protected]>
    Reviewed-by: Toke Høiland-Jørgensen <[email protected]>
    Acked-by: Lorenzo Bianconi <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
vxlan: re-fetch eth header after route_shortcircuit() [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Thu Jul 23 14:42:45 2026 +0000

    vxlan: re-fetch eth header after route_shortcircuit()
    
    commit 1395a676ec15a0a02a2a6d86602324f2d5fd41d5 upstream.
    
    Before route_shortcircuit(), the eth header pointer is cached from eth_hdr(skb).
    
    Inside route_shortcircuit(), pskb_may_pull() can be called, which may
    reallocate skb->head.
    
    In this case, returning to vxlan_xmit() leaves the cached eth pointer pointing to
    freed memory, leading to a use-after-free when dereferencing eth->h_dest.
    
    Fix this by updating eth = eth_hdr(skb) after calling route_shortcircuit().
    
    Fixes: ae8840825605 ("VXLAN: Allow L2 redirection with L3 switching")
    Cc: [email protected]
    Signed-off-by: Eric Dumazet <[email protected]>
    Reviewed-by: Vadim Fedorenko <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

vxlan: unclone skb head before modifying eth header in route_shortcircuit() [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Thu Jul 23 14:42:46 2026 +0000

    vxlan: unclone skb head before modifying eth header in route_shortcircuit()
    
    commit 760d36e737f2b3867762f42af36c663f55babcc4 upstream.
    
    When route_shortcircuit() performs L3 short-circuit routing, it modifies
    the Ethernet header of the skb in-place:
        memcpy(eth_hdr(skb)->h_source, eth_hdr(skb)->h_dest, dev->addr_len);
        memcpy(eth_hdr(skb)->h_dest, n->ha, dev->addr_len);
    
    If the incoming skb is cloned (for example by packet sockets, tcpdump, or
    dev_queue_xmit), modifying the Ethernet header without uncloning can corrupt
    the packet header for other readers holding a reference to the cloned skb.
    
    Ensure the skb header is writable and unshared by calling skb_cow_head(skb, 0)
    prior to updating the Ethernet header. If skb_cow_head() fails, abort short-circuiting
    and return false to allow standard packet processing fallback.
    
    Fixes: e4f67addf158 ("add DOVE extensions for VXLAN")
    Cc: [email protected]
    Signed-off-by: Eric Dumazet <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

vxlan: use neigh_ha_snapshot() in route_shortcircuit() [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Thu Jul 23 14:42:47 2026 +0000

    vxlan: use neigh_ha_snapshot() in route_shortcircuit()
    
    commit 8eca411347e1d38964f9ed2c8d3b6ab0e7e4473d upstream.
    
    The neighbour hardware address n->ha can be updated asynchronously by the
    neighbour subsystem, protected by n->ha_lock seqlock. Reading n->ha without
    holding the seqlock loop can lead to torn reads or reading a partially updated
    MAC address.
    
    Use neigh_ha_snapshot() in route_shortcircuit() to safely copy n->ha under
    read_seqbegin()/read_seqretry() lock protection before using it.
    
    Note that arp_reduce() and neigh_reduce() seem to have the same issue
    left for future patches.
    
    Fixes: e4f67addf158 ("add DOVE extensions for VXLAN")
    Cc: [email protected]
    Signed-off-by: Eric Dumazet <[email protected]>
    Reviewed-by: Vadim Fedorenko <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

vxlan: use pskb_network_may_pull() for transmit path header pulls [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Thu Jul 23 14:42:49 2026 +0000

    vxlan: use pskb_network_may_pull() for transmit path header pulls
    
    commit b9553558b48db54ac9273e6b98d7263ef5c1a329 upstream.
    
    In vxlan_xmit(), arp_reduce(), and vxlan_mdb_entry_skb_get(), pskb_may_pull() was
    being called to verify the availability of network layer headers (ARP, IPv6/ND,
    IP/IPv6 MDB keys).
    
    However, during transmit skb->data points to the MAC header, so skb_network_offset(skb)
    is ETH_HLEN (14 bytes). Using pskb_may_pull(skb, len) only checks len bytes from skb->data
    rather than skb_network_offset(skb) + len, which can leave part of the network header
    in non-linear frags.
    
    Replace these remaining pskb_may_pull() calls with pskb_network_may_pull() to properly
    account for the MAC header offset.
    
    Fixes: e4f67addf158 ("add DOVE extensions for VXLAN")
    Fixes: f564f45c4518 ("vxlan: add ipv6 proxy support")
    Fixes: 0f83e69f44bf ("vxlan: Add MDB data path support")
    Signed-off-by: Eric Dumazet <[email protected]>
    Cc: [email protected]
    Reviewed-by: Vadim Fedorenko <[email protected]>
    Reviewed-by: Ido Schimmel <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

vxlan: use pskb_network_may_pull() in route_shortcircuit() [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Thu Jul 23 14:42:48 2026 +0000

    vxlan: use pskb_network_may_pull() in route_shortcircuit()
    
    commit 26bb2dd0a8839617e2c79ffbbe1923f8e4bab9fb upstream.
    
    route_shortcircuit() currently calls pskb_may_pull(skb, sizeof(struct iphdr))
    (or ipv6hdr), which checks if bytes are available starting from skb->data.
    
    However, in vxlan_xmit(), skb->data points to the MAC header, so
    skb_network_offset(skb) is ETH_HLEN (14 bytes). Using pskb_may_pull(skb, 20)
    only checks 20 bytes from skb->data (which is 14 bytes MAC header + 6 bytes of
    IP header), leaving the rest of the IP header potentially un-pulled in non-linear
    frags. Subsequent dereferences of ip_hdr(skb)->daddr can read beyond the pulled
    linear buffer length.
    
    Fix this by using pskb_network_may_pull(), which adds skb_network_offset(skb) to
    the length check to ensure the full network header is present in the linear buffer.
    
    Fixes: e4f67addf158 ("add DOVE extensions for VXLAN")
    Cc: [email protected]
    Signed-off-by: Eric Dumazet <[email protected]>
    Reviewed-by: Vadim Fedorenko <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
wifi: brcmfmac: drain bus_reset work on device removal [+ + +]
Author: Fan Wu <[email protected]>
Date:   Thu Aug 6 09:17:40 2026 -0400

    wifi: brcmfmac: drain bus_reset work on device removal
    
    [ Upstream commit 43b25879f004c98defa2776bedc6ca4763c51945 ]
    
    brcmf_fw_crashed() and the debugfs "reset" entry both schedule
    drvr->bus_reset, whose callback recovers drvr through container_of()
    and dereferences it.  The removal path frees drvr (brcmf_free ->
    wiphy_free) without draining the work, so a bus_reset callback pending
    or running during removal can outlive drvr.
    
    Cancellation cannot live in brcmf_detach() or brcmf_free(): the work
    callback reaches teardown through the bus .reset op (PCIe
    brcmf_pcie_reset -> brcmf_detach; SDIO brcmf_sdio_bus_reset ->
    brcmf_sdiod_remove -> brcmf_free), so cancelling there would wait for
    the running work and deadlock.
    
    Add a per-bus mutex (bus_reset_lock) and route all arming through
    brcmf_bus_schedule_reset(), which under the lock skips when the bus is
    marked removing.  Each bus remove entry calls
    brcmf_bus_cancel_reset_work(), which under the same lock sets removing
    and cancels the work.  Holding the mutex across cancel_work_sync() makes
    the set-removing + drain step atomic.  Every producer reaches the arming
    path from process context -- the PCIe firmware-halt notification runs in
    the threaded IRQ handler (brcmf_pcie_isr_thread) and the SDIO hostmail
    path runs from the data workqueue -- so the mutex is taken only in
    sleepable contexts.  Where applicable the remove entry first stops the
    firmware-crash producer: on PCIe mask the mailbox and synchronize_irq;
    on SDIO unregister the bus interrupt and cancel the data worker, which
    also reports firmware halts through brcmf_fw_crashed().  The mutex is
    initialized at bus allocation.  The SDIO suspend power-off path frees
    drvr through the same brcmf_sdiod_remove() and takes the same lock;
    resume re-allows the work only on a successful re-probe.
    
    Also guard brcmf_fw_crashed() against a NULL bus_if/drvr: it can fire
    before brcmf_attach() wires up drvr, and it dereferences drvr
    (bphy_err/brcmf_dev_coredump) before reaching the arming gate.
    
    The bus_reset work is shared across buses, so the drain is applied to
    every remove path: PCIe (the .reset op introduced by the Fixes commit),
    SDIO (arms the same work through brcmf_fw_crashed()), and USB (via the
    debugfs "reset" entry).  cancel_work_sync() drains a running or pending
    bus_reset work item before removal frees drvr, and patch 1/2 makes the
    scratch-buffer release safe when reset teardown has already released
    those DMA buffers.
    
    This patch fixes the lifetime of the bus_reset work item itself.  It does
    not attempt to address the separate, pre-existing lifetime of the
    asynchronous firmware completion started by the PCIe reset path.  That
    callback needs its own lifetime/ownership protocol and is being tracked
    separately.
    
    This issue was found by an in-house static analysis tool.
    
    Fixes: 4684997d9eea ("brcmfmac: reset PCIe bus on a firmware crash")
    Cc: [email protected]
    Signed-off-by: Fan Wu <[email protected]>
    Assisted-by: Codex:gpt-5.6
    Acked-by: Arend van Spriel <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

wifi: mac80211: validate individual TWT params before driver setup [+ + +]
Author: Zhao Li <[email protected]>
Date:   Thu Jul 23 09:09:28 2026 +0800

    wifi: mac80211: validate individual TWT params before driver setup
    
    [ Upstream commit 0502d5077e419427d80f4d46ba95d0067f5fb916 ]
    
    ieee80211_process_rx_twt_action() only partially validates a received
    S1G TWT setup frame before queueing it.
    
    An individual agreement can therefore reach ieee80211_s1g_rx_twt_setup()
    with twt->length too short for the full struct ieee80211_twt_params.
    
    The individual path passes twt to drv_add_twt_setup(). Both the tracepoint
    and the driver callback consume the complete parameters block, not merely
    req_type. Do not pass a short individual agreement to the driver.
    Broadcast agreements remain unchanged because they are rejected locally
    after accessing only req_type.
    
    Fixes: f5a4c24e689f ("mac80211: introduce individual TWT support in AP mode")
    Assisted-by: Codex:gpt-5
    Assisted-by: Claude:opus-4.8
    Signed-off-by: Zhao Li <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    [edit commit message to not overclaim lack of validation nor
     understate driver impact]
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

wifi: mwifiex: use the subframe length when parsing A-MSDU TDLS frames [+ + +]
Author: Zhao Li <[email protected]>
Date:   Tue Jul 28 19:53:25 2026 +0800

    wifi: mwifiex: use the subframe length when parsing A-MSDU TDLS frames
    
    commit 99a948382af8a225e2d5e54a7052158cd6281cc6 upstream.
    
    mwifiex_11n_dispatch_amsdu_pkt() splits an A-MSDU with
    ieee80211_amsdu_to_8023s() and walks the resulting subframes. For each
    subframe it passes the subframe data pointer to
    mwifiex_process_tdls_action_frame(), but pairs it with skb->len, the
    length of the A-MSDU parent, instead of rx_skb->len:
    
            rx_skb = __skb_dequeue(&list);
            rx_hdr = (struct rx_packet_hdr *)rx_skb->data;
            if (ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info) &&
                ntohs(rx_hdr->eth803_hdr.h_proto) == ETH_P_TDLS) {
                    mwifiex_process_tdls_action_frame(priv, (u8 *)rx_hdr,
                                                      skb->len);
            }
    
    The parent is not a valid description of that buffer, and may not be
    valid memory at all. ieee80211_amsdu_to_8023s() ends with
    
            if (!reuse_skb)
                    dev_kfree_skb(skb);
    
    and it only sets reuse_skb when the parent is linear, is not a
    head_frag, and is being consumed as the *last* subframe. So when the
    parent does not qualify for reuse it has already been freed, and the
    read of skb->len is a use-after-free. When it is reused, skb->len is
    the length of the last subframe, applied to every earlier subframe,
    which over-states the buffer whenever an earlier subframe is shorter.
    
    The callee cannot absorb a wrong length, because it derives its own
    ceiling from the value it is given. Each frame type computes
    
            ies_len = len - sizeof(struct ethhdr) - TDLS_*_FIX_LEN;
    
    and the element walk is then bounded entirely against that ceiling,
    
            for (end = pos + ies_len; pos + 1 < end; pos += 2 + pos[1]) {
                    u8 ie_len = pos[1];
    
                    if (pos + 2 + ie_len > end)
                            break;
    
    so a too-large len moves end past the end of the subframe and the walk
    reads and copies beyond it. The A-MSDU layout is chosen by the sender,
    which makes the difference between the last subframe and a shorter
    earlier one remotely selectable. Reaching this requires TDLS support in
    firmware and the TDLS ethertype on the subframe.
    
    The other caller, mwifiex_process_rx_packet(), is correct: it passes a
    pointer and a length that describe the same region of the RX buffer.
    
    Pass rx_skb->len, the length of the subframe actually being parsed.
    
    Fixes: 776f742040ca ("mwifiex: fix AMPDU not setup on TDLS link problem")
    Assisted-by: Codex:gpt-5.6-sol
    Assisted-by: Kimi:K3
    Cc: [email protected]
    Signed-off-by: Zhao Li <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
x86/boot: Add volatile, clobbers and zero-length test in memcmp() [+ + +]
Author: Mauricio Faria de Oliveira <[email protected]>
Date:   Thu Jul 23 20:08:04 2026 -0300

    x86/boot: Add volatile, clobbers and zero-length test in memcmp()
    
    [ Upstream commit a8c171c107c0b61a5e7e10cedab0fb72aeaf640d ]
    
    Add the volatile qualifier and clobbers parameter to prevent bugs with
    instruction reordering and optimization.
    
    Also add TEST for the zero-length case to set ZF, as, if the count register
    is zero, the REPE prefix does not run the CMPSB instruction, leaving the ZF
    flag undetermined.
    
      [ bp: Add a comment about the len==0 case. ]
    
    Fixes: 62bd0337d0c4 ("Top header file for new x86 setup code")
    Closes: https://sashiko.dev/#/patchset/20260701-pvh-kasan-inline-v6-0-ba99045dfa9f%40igalia.com
    Suggested-by: Borislav Petkov <[email protected]>
    Signed-off-by: Mauricio Faria de Oliveira <[email protected]>
    Signed-off-by: Borislav Petkov (AMD) <[email protected]>
    Link: https://lore.kernel.org/all/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
xsk: drain continuation descs after overflow in xsk_build_skb() [+ + +]
Author: Jason Xing <[email protected]>
Date:   Sun Jul 19 15:56:05 2026 +0200

    xsk: drain continuation descs after overflow in xsk_build_skb()
    
    [ Upstream commit bd44a6dcd4248883de90f5dad53ae80066e27096 ]
    
    Fix generic xmit path multi-buffer logic when packets are either too big
    (count of descriptors exceed MAX_SKB_FRAGS) or an invalid descriptor is
    included in fragmented packet. Introduce xdp_sock::drain_cont and act
    upon this flag - when it is set, keep on consuming descriptors from
    AF_XDP Tx ring and put them directly onto Cq. Previously these
    descriptors were silently lost and could never be reached again.
    
    Fixes: cf24f5a5feea ("xsk: add support for AF_XDP multi-buffer on Tx path")
    Closes: https://lore.kernel.org/all/[email protected]/
    Reviewed-by: Jason Xing <[email protected]>
    Co-developed-by: Maciej Fijalkowski <[email protected]> # wrapped cq addr submission onto routine
    Signed-off-by: Maciej Fijalkowski <[email protected]>
    Signed-off-by: Jason Xing <[email protected]>
    Acked-by: Stanislav Fomichev <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

xsk: fix buffer leak in xsk_drop_skb() for AF_XDP multi-buffer Tx [+ + +]
Author: Jason Xing <[email protected]>
Date:   Sun Jul 19 15:56:04 2026 +0200

    xsk: fix buffer leak in xsk_drop_skb() for AF_XDP multi-buffer Tx
    
    [ Upstream commit a3c8382ebce4780c6b3ace2c09bc342313ac0186 ]
    
    This patch is inspired by the check[1] from sashiko. It says when
    overflow happens, the address of cq to be published is invalid.
    Actually the severer thing is the whole process of publishing the
    address of cq in this particular case is not right: it should truely
    publish the address and advance the cached_prod in cq as long as it
    reads descriptors from txq.
    
    The following is the full analysis.
    xsk_drop_skb() is called in three places, which all discard a partially
    built multi-buffer skb:
    1) xsk_build_skb() -EOVERFLOW error path: packet exceeds MAX_SKB_FRAGS
    2) __xsk_generic_xmit() post-loop cleanup: an invalid descriptor in
       the TX ring prevents the partial packet from completing
    3) xsk_release(): socket close while xs->skb holds an incomplete packet
    
    In all three cases, the TX descriptors for the already-processed frags
    have been consumed from the TX ring (xskq_cons_release), and CQ slots
    have been reserved. However, xsk_drop_skb() calls xsk_consume_skb()
    which cancels the CQ reservations via xsk_cq_cancel_locked(). Since
    the buffer addresses never appear in the completion queue, userspace
    permanently loses track of these buffers.
    
    Fix this by letting consume_skb() trigger the existing xsk_destruct_skb
    destructor, which already submits buffer addresses to the CQ via
    xsk_cq_submit_addr_locked().
    
    Note that cancelling the descriptors back to the TX ring (via
    xskq_cons_cancel_n) is not a appropriate option because an oversized
    packet that always exceeds MAX_SKB_FRAGS would be retried indefinitely,
    which is an obviously deadlock bug in the TX path.
    
    Also move the desc->addr assignment in xsk_build_skb() above the
    overflow check so that the current descriptor's address is recorded
    before a potential -EOVERFLOW jump to free_err, consistent with the
    zerocopy path in xsk_build_skb_zerocopy().
    
    [1]: https://lore.kernel.org/all/[email protected]/
    
    Fixes: cf24f5a5feea ("xsk: add support for AF_XDP multi-buffer on Tx path")
    Acked-by: Maciej Fijalkowski <[email protected]>
    Signed-off-by: Jason Xing <[email protected]>
    Acked-by: Stanislav Fomichev <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

xsk: use a smaller new lock for shared pool case [+ + +]
Author: Jason Xing <[email protected]>
Date:   Thu Oct 30 08:06:46 2025 +0800

    xsk: use a smaller new lock for shared pool case
    
    [ Upstream commit 30ed05adca4a05c50594384cff18910858dd1d35 ]
    
    - Split cq_lock into two smaller locks: cq_prod_lock and
      cq_cached_prod_lock
    - Avoid disabling/enabling interrupts in the hot xmit path
    
    In either xsk_cq_cancel_locked() or xsk_cq_reserve_locked() function,
    the race condition is only between multiple xsks sharing the same
    pool. They are all in the process context rather than interrupt context,
    so now the small lock named cq_cached_prod_lock can be used without
    handling interrupts.
    
    While cq_cached_prod_lock ensures the exclusive modification of
    @cached_prod, cq_prod_lock in xsk_cq_submit_addr_locked() only cares
    about @producer and corresponding @desc. Both of them don't necessarily
    be consistent with @cached_prod protected by cq_cached_prod_lock.
    That's the reason why the previous big lock can be split into two
    smaller ones. Please note that SPSC rule is all about the global state
    of producer and consumer that can affect both layers instead of local
    or cached ones.
    
    Frequently disabling and enabling interrupt are very time consuming
    in some cases, especially in a per-descriptor granularity, which now
    can be avoided after this optimization, even when the pool is shared by
    multiple xsks.
    
    With this patch, the performance number[1] could go from 1,872,565 pps
    to 1,961,009 pps. It's a minor rise of around 5%.
    
    [1]: taskset -c 1 ./xdpsock -i enp2s0f1 -q 0 -t -S -s 64
    
    Signed-off-by: Jason Xing <[email protected]>
    Acked-by: Maciej Fijalkowski <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Stable-dep-of: bd44a6dcd424 ("xsk: drain continuation descs after overflow in xsk_build_skb()")
    Signed-off-by: Sasha Levin <[email protected]>