Changelog in Linux kernel 7.1.8

 
accel/qaic: use sizeof(*trans_hdr) for transaction length check [+ + +]
Author: Muhammad Bilal <meatuni001@gmail.com>
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 <meatuni001@gmail.com>
    Reviewed-by: Jeff Hugo <jeff.hugo@oss.qualcomm.com>
    Signed-off-by: Jeff Hugo <jeff.hugo@oss.qualcomm.com>
    Link: https://patch.msgid.link/20260617212520.59801-1-meatuni001@gmail.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ACPI: CPPC: Check all controls for fast switching [+ + +]
Author: Christian Loehle <christian.loehle@arm.com>
Date:   Wed Jul 22 10:38:24 2026 +0100

    ACPI: CPPC: Check all controls for fast switching
    
    commit 11055a46f398779b69aa36afb7c9f4124529a075 upstream.
    
    ACPI 6.2, Section 6.2.11.2 permits _CPC registers to use flexible
    address spaces. Linux advertises that capability through _OSC and parses
    the address space of each _CPC register independently. A directly
    accessible DESIRED_PERF combined with PCC-backed limits is therefore a
    valid configuration.
    
    cppc_allow_fast_switch() only checks DESIRED_PERF, although the fast-switch
    callback passes DESIRED_PERF, MIN_PERF and MAX_PERF to cppc_set_perf(). If
    a limit uses PCC, that function can sleep while called from scheduler
    context.
    
    Allow fast switching only when every supported control used by the
    callback has an address space already accepted for fast access. Check the
    complete policy domain, including initialized CPUs that are currently
    offline and may later become the policy's managing CPU.
    
    Fixes: 658fa7b1c47a ("ACPI: CPPC: Add cppc_get_perf() API to read performance controls")
    Cc: stable@vger.kernel.org
    Signed-off-by: Christian Loehle <christian.loehle@arm.com>
    Link: https://patch.msgid.link/20260722093825.1030594-2-christian.loehle@arm.com
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ACPI: CPPC: Skip writes to unsupported performance controls [+ + +]
Author: Christian Loehle <christian.loehle@arm.com>
Date:   Fri Jul 24 11:40:42 2026 +0100

    ACPI: CPPC: Skip writes to unsupported performance controls
    
    [ Upstream commit 47d4e945dff8139050473be4ab263a32e1da910c ]
    
    MIN_PERF and MAX_PERF are optional CPPC controls. DESIRED_PERF is also
    optional with CPPC2 when autonomous selection is supported.
    
    The cppc-cpufreq target callbacks populate both limits for every request
    without checking whether the controls are implemented. cppc_set_perf()
    consequently passes NULL register descriptors to cpc_write(). The writes
    fail width validation and their return values are ignored, so the failed
    access paths are repeated on every target request. An autonomous-only
    platform can take the same path for DESIRED_PERF.
    
    Check that each performance control is supported before calling
    cpc_write().
    
    Fixes: ea3db45ae476 ("cpufreq: cppc: Update MIN_PERF/MAX_PERF in target callbacks")
    Reviewed-by: Sumit Gupta <sumitg@nvidia.com>
    Signed-off-by: Christian Loehle <christian.loehle@arm.com>
    Reviewed-by: Lifeng Zheng <zhenglifeng1@huawei.com>
    Link: https://patch.msgid.link/20260724104042.1481804-1-christian.loehle@arm.com
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
af_unix: fix listen() succeeding on sockets in the wrong state [+ + +]
Author: John Ericson <mail@johnericson.me>
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 <mail@johnericson.me>
    Link: https://patch.msgid.link/20260718182903.2295560-1-John.Ericson@Obsidian.Systems
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
afs: Fix afs_fs_fetch_data() to set call->async [+ + +]
Author: David Howells <dhowells@redhat.com>
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 <dhowells@redhat.com>
    Link: https://patch.msgid.link/20260723113452.566619-2-dhowells@redhat.com
    cc: Marc Dionne <marc.dionne@auristor.com>
    cc: Jeffrey Altman <jaltman@auristor.com>
    cc: linux-afs@lists.infradead.org
    cc: stable@kernel.org
    Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

afs: Fix afs_fs_fetch_data() to subtract transferred from len [+ + +]
Author: David Howells <dhowells@redhat.com>
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 <dhowells@redhat.com>
    Link: https://patch.msgid.link/20260723113452.566619-3-dhowells@redhat.com
    cc: Marc Dionne <marc.dionne@auristor.com>
    cc: Jeffrey Altman <jaltman@auristor.com>
    cc: linux-afs@lists.infradead.org
    cc: stable@kernel.org
    Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

afs: Fix UAF when sending a message [+ + +]
Author: David Howells <dhowells@redhat.com>
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 <marc.dionne@auristor.com>
    Signed-off-by: David Howells <dhowells@redhat.com>
    Link: https://patch.msgid.link/20260723113452.566619-4-dhowells@redhat.com
    cc: Jeffrey Altman <jaltman@auristor.com>
    cc: linux-afs@lists.infradead.org
    cc: stable@kernel.org
    Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ALSA: 6fire: Fix UAF at error handling during probe [+ + +]
Author: Takashi Iwai <tiwai@suse.de>
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 <shuangpeng.kernel@gmail.com>
    Closes: https://lore.kernel.org/20260724030900.1984491-1-shuangpeng.kernel@gmail.com
    Cc: <stable@vger.kernel.org>
    Link: https://patch.msgid.link/20260726074821.2288158-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: hda/realtek: Add quirk for HP Dragonfly Folio G3 2-in-1 (103c:8a05) [+ + +]
Author: Michael Diesen <michael.diesen@posteo.de>
Date:   Mon Jul 27 09:19:21 2026 +0000

    ALSA: hda/realtek: Add quirk for HP Dragonfly Folio G3 2-in-1 (103c:8a05)
    
    [ Upstream commit bed0c8084044364f5ac3f3e89e1bbad423f6b0d4 ]
    
    The HP Dragonfly Folio G3 2-in-1 also ships with PCI SSID 103c:8a05.
    On this unit the ALC245 codec reports subsystem id 103c:8a06 - the SSID
    that is already covered by commit 0a10faad5ca5 ("ALSA: hda/realtek: add
    quirk for HP Dragonfly Folio G3 2-in-1") - while the PCI SSID that
    SND_PCI_QUIRK matches against is 103c:8a05:
    
      snd_hda_codec_alc269 ehdaudio0D0: ALC245: picked fixup for PCI SSID 103c:8a05
      cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: CS35L41 Bound - SSID: 103C8A06
    
    The existing entry therefore never applies here, the four CS35L41
    amplifiers on SPI are not registered and the internal speakers stay
    silent.
    
    Add the same fixup that the 8a06 entry uses: the four amplifiers bind
    and the speaker mute LED (codec GPIO 0x04) works.
    
    Signed-off-by: Michael Diesen <michael.diesen@posteo.de>
    Link: https://patch.msgid.link/20260727091920.4634-1-michael.diesen@posteo.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ALSA: hda/realtek: Add quirk for TongFang X6SP45xU [+ + +]
Author: Eckhart Mohr <e.mohr@tuxedocomputers.com>
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 <e.mohr@tuxedocomputers.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
    Link: https://patch.msgid.link/20260724190109.169889-1-wse@tuxedocomputers.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: lx6464es: fix period byte count for 16-bit streams [+ + +]
Author: Xu Rao <raoxu@uniontech.com>
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: stable@vger.kernel.org
    Signed-off-by: Xu Rao <raoxu@uniontech.com>
    Link: https://patch.msgid.link/8BB12E8D92A7CDBA+20260723085710.2567463-1-raoxu@uniontech.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: pcm: wake linked drain waiters on unlink [+ + +]
Author: Norbert Szetei <norbert@doyensec.com>
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: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-5
    Signed-off-by: Norbert Szetei <norbert@doyensec.com>
    Link: https://patch.msgid.link/A0705100-D10B-4286-9980-0142ABEEAD51@doyensec.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: seq: Fix division by zero in initialize_timer() [+ + +]
Author: Norbert Szetei <norbert@doyensec.com>
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: <stable@vger.kernel.org>
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: Norbert Szetei <norbert@doyensec.com>
    Link: https://patch.msgid.link/DF8A3844-AD5E-4B8A-9CFC-BD83C212BA38@doyensec.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: timer: Clear SNDRV_TIMER_IFLG_DEAD once the close completes [+ + +]
Author: Norbert Szetei <norbert@doyensec.com>
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: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-5
    Signed-off-by: Norbert Szetei <norbert@doyensec.com>
    Link: https://patch.msgid.link/CA41AA48-75BF-45E9-A36D-3A5D2F124F60@doyensec.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: ump: fix double free of out_cvts on rawmidi error [+ + +]
Author: Baul Lee <baul.lee@xbow.com>
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 <baul.lee@xbow.com>
    
    Fixes: 33cd7630782d ("ALSA: ump: Export MIDI1 / UMP conversion helpers")
    Reported-by: Federico Kirschbaum <federico.kirschbaum@xbow.com>
    Reported-by: Baul Lee <baul.lee@xbow.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Baul Lee <baul.lee@xbow.com>
    Link: https://patch.msgid.link/20260726051633.41206-1-baul.lee@xbow.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: usb-audio: Clamp frame size in implicit-feedback mode [+ + +]
Author: Sonali Pradhan <sonalipradhan@google.com>
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: stable@vger.kernel.org
    Assisted-by: Jetski:Gemini-3.6-Flash
    Signed-off-by: Sonali Pradhan <sonalipradhan@google.com>
    Link: https://patch.msgid.link/20260728202432.2354994-1-sonalipradhan@google.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: usb-audio: Fix DMA buffer out-of-bounds write when fill_max is set [+ + +]
Author: Sonali Pradhan <sonalipradhan@google.com>
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: stable@vger.kernel.org
    Assisted-by: Jetski:Gemini-3.6-Flash
    Signed-off-by: Sonali Pradhan <sonalipradhan@google.com>
    Link: https://patch.msgid.link/20260728201716.2347726-1-sonalipradhan@google.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: usb-audio: fix OOB write in snd_usbmidi_akai_output() [+ + +]
Author: Baul Lee <baul.lee@xbow.com>
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 <baul.lee@xbow.com>
    
    Fixes: 4434ade8c933 ("ALSA: usb-audio: add support for Akai MPD16")
    Suggested-by: Takashi Iwai <tiwai@suse.de>
    Reported-by: Federico Kirschbaum <federico.kirschbaum@xbow.com>
    Reported-by: Baul Lee <baul.lee@xbow.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Baul Lee <baul.lee@xbow.com>
    Link: https://patch.msgid.link/20260726074500.50145-1-baul.lee@xbow.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: usb-audio: fix stack info leak in RME Digiface status [+ + +]
Author: Baul Lee <baul.lee@xbow.com>
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 <baul.lee@xbow.com>
    
    Fixes: 611a96f6acf2 ("ALSA: usb-audio: Add mixer quirk for RME Digiface USB")
    Reported-by: Federico Kirschbaum <federico.kirschbaum@xbow.com>
    Reported-by: Baul Lee <baul.lee@xbow.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Baul Lee <baul.lee@xbow.com>
    Link: https://patch.msgid.link/20260726065020.46070-1-baul.lee@xbow.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: usb-audio: fix use-after-free in ump_to_endpoint() [+ + +]
Author: Baul Lee <baul.lee@xbow.com>
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 <baul.lee@xbow.com>
    
    Fixes: ff49d1df79ae ("ALSA: usb-audio: USB MIDI 2.0 UMP support")
    Reported-by: Federico Kirschbaum <federico.kirschbaum@xbow.com>
    Reported-by: Baul Lee <baul.lee@xbow.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Baul Lee <baul.lee@xbow.com>
    Link: https://patch.msgid.link/20260726051337.41124-1-baul.lee@xbow.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ASoC: fsl_asrc: fix m2m_init error path to use goto instead of bare return [+ + +]
Author: Shengjiu Wang <shengjiu.wang@nxp.com>
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: stable@vger.kernel.org
    Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
    Link: https://patch.msgid.link/20260715024758.1252801-2-shengjiu.wang@oss.nxp.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ASoC: fsl_easrc: fix m2m_init error path to use goto instead of bare return [+ + +]
Author: Shengjiu Wang <shengjiu.wang@nxp.com>
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: stable@vger.kernel.org
    Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
    Link: https://patch.msgid.link/20260715024758.1252801-3-shengjiu.wang@oss.nxp.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ASoC: max98090: fix missing IS_ERR() before PTR_ERR() on mclk lookup [+ + +]
Author: Uday Khare <udaykhare77@gmail.com>
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 <udaykhare77@gmail.com>
    Link: https://patch.msgid.link/20260720104254.14948-1-udaykhare77@gmail.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: max98095: fix missing IS_ERR() before PTR_ERR() on mclk lookup [+ + +]
Author: Uday Khare <udaykhare77@gmail.com>
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 <udaykhare77@gmail.com>
    Link: https://patch.msgid.link/20260720103950.14474-1-udaykhare77@gmail.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: SDCA: Always free firmware in FDL path [+ + +]
Author: Charles Keepax <ckeepax@opensource.cirrus.com>
Date:   Wed Jul 22 11:34:58 2026 +0100

    ASoC: SDCA: Always free firmware in FDL path
    
    [ Upstream commit 7f64ccc374b2fe1f6a169182e95ab8e104cae406 ]
    
    In the case a disk firmware exists but is invalid and no SWFT firmware
    exists fdl_load_file() will return without calling release_firmware().
    Update the code to call this to ensure the firmware is released on the
    error path.
    
    Fixes: 71f7990a34cd ("ASoC: SDCA: Add FDL library for XU entities")
    Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
    Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
    Link: https://patch.msgid.link/20260722103500.872714-3-ckeepax@opensource.cirrus.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: SDCA: Correct pointer passed to devm_acpi_table_put [+ + +]
Author: Charles Keepax <ckeepax@opensource.cirrus.com>
Date:   Wed Jul 22 11:34:57 2026 +0100

    ASoC: SDCA: Correct pointer passed to devm_acpi_table_put
    
    [ Upstream commit 6a50332e194f58b562d396ab772c34e8c9890c0f ]
    
    devm_acpi_table_put() takes a struct acpi_table_header * but the value
    passed in is struct acpi_table_header ** so the value passed to
    acpi_put_table() is actually the pointer not the table itself.
    
    Remove the extra reference to correct the passed value.
    
    Fixes: c4d096c3ca42 ("ASoC: SDCA: Add SDCA FDL data parsing")
    Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
    Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
    Link: https://patch.msgid.link/20260722103500.872714-2-ckeepax@opensource.cirrus.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: SDCA: Ensure that Control Range is large enough for header [+ + +]
Author: Charles Keepax <ckeepax@opensource.cirrus.com>
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 <ckeepax@opensource.cirrus.com>
    Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
    Link: https://patch.msgid.link/20260722103500.872714-5-ckeepax@opensource.cirrus.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: SDCA: Make UMP message size check more robust [+ + +]
Author: Charles Keepax <ckeepax@opensource.cirrus.com>
Date:   Wed Jul 22 11:34:59 2026 +0100

    ASoC: SDCA: Make UMP message size check more robust
    
    [ Upstream commit 556d872e7c2a0b570c5b0974813847ef0d0cd637 ]
    
    If message offset was larger than the buffer length the size
    check will pass incorrectly. Refactor the check such that it is
    more robust to invalid sizes.
    
    Fixes: daab108504be ("ASoC: SDCA: Add UMP buffer helper functions")
    Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
    Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
    Link: https://patch.msgid.link/20260722103500.872714-4-ckeepax@opensource.cirrus.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: sophgo: return 1 on volume change in cv1800b_adc_volume_set() [+ + +]
Author: Surendra Singh Chouhan <kr494167@gmail.com>
Date:   Mon Jul 27 11:08:04 2026 +0530

    ASoC: sophgo: return 1 on volume change in cv1800b_adc_volume_set()
    
    [ Upstream commit f47064c970d3e920a27435454c02df310695f6e1 ]
    
    cv1800b_adc_volume_set() serves as the .put callback for the "Internal
    I2S Capture Volume" control.
    
    ALSA mixer control callbacks must return 1 when the register value is
    modified, 0 if unchanged, or a negative error code on failure. Returning
    0 unconditionally causes ALSA core to assume the value was unchanged,
    suppressing SNDRV_CTL_EVENT_MASK_VALUE change notifications to userspace
    sound servers (e.g. PipeWire/PulseAudio).
    
    Fix this by comparing the new register value with the existing register
    value. If unchanged, return 0; otherwise, write the updated value and
    return 1.
    
    Fixes: 4cf8752a03e6 ("ASoC: sophgo: add CV1800B internal ADC codec driver")
    Signed-off-by: Surendra Singh Chouhan <kr494167@gmail.com>
    Link: https://patch.msgid.link/20260727053804.25599-1-kr494167@gmail.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: tas2562: fix broken entries in the volume lookup table [+ + +]
Author: Haidar Lee <haidar.lee@adlinktech.com>
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: stable@vger.kernel.org
    Signed-off-by: Haidar Lee <haidar.lee@adlinktech.com>
    Link: https://patch.msgid.link/20260715-tas2562-dvc-fix-v1-2-072b13901b20@adlinktech.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ASoC: tas2562: fix DVC coefficient write order [+ + +]
Author: Haidar Lee <haidar.lee@adlinktech.com>
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: stable@vger.kernel.org
    Signed-off-by: Haidar Lee <haidar.lee@adlinktech.com>
    Link: https://patch.msgid.link/20260715-tas2562-dvc-fix-v1-1-072b13901b20@adlinktech.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ASoC: tas2781: Use correct calibration data for SINEGAIN2 register [+ + +]
Author: wangdicheng <wangdicheng@kylinos.cn>
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 <wangdicheng@kylinos.cn>
    Link: https://patch.msgid.link/20260720081616.631413-1-wangdich9700@163.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
assoc_array: trim the final shortcut word using the current chunk end [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
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 <michael.bommarito@gmail.com>
    Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
    Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
    Link: https://lore.kernel.org/r/20260719161505.2423935-4-michael.bommarito@gmail.com
    Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ata: ahci_ceva: fix error paths in ceva_ahci_platform_enable_resources() [+ + +]
Author: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
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 <radhey.shyam.pandey@amd.com>
    Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ata: libata-eh: Increase STANDBY IMMEDIATE timeout [+ + +]
Author: Matt Vollrath <tactii@gmail.com>
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: stable@vger.kernel.org
    Signed-off-by: Matt Vollrath <tactii@gmail.com>
    Assisted-by: Claude:claude-5-fable
    Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ata: libata-sata: fix ata_scsi_lpm_supported() iteration [+ + +]
Author: Niklas Cassel <cassel@kernel.org>
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: stable@vger.kernel.org
    Fixes: 0060beec0bfa ("ata: libata-sata: Add link_power_management_supported sysfs attribute")
    Reported-by: Sashiko <sashiko-bot@kernel.org>
    Link: https://lore.kernel.org/linux-ide/20260728112200.B99F21F000E9@smtp.kernel.org/
    Signed-off-by: Niklas Cassel <cassel@kernel.org>
    Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ata: libata-scsi: schedule deferred atapi command [+ + +]
Author: Damien Le Moal <dlemoal@kernel.org>
Date:   Thu Jul 23 07:42:26 2026 +0900

    ata: libata-scsi: schedule deferred atapi command
    
    commit e7468b3f9b404ac7c1329ef07c146c3356dfbd01 upstream.
    
    Modify atapi_qc_complete() to call ata_scsi_schedule_deferred_qc() to
    ensure that any deferred queued command can execute. This is similar to
    ata_scsi_qc_complete() function for regular ATA devices.
    
    Fixes: 0ea84089dbf6 ("ata: libata-scsi: avoid Non-NCQ command starvation")
    Cc: stable@vger.kernel.org
    Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ata: libata-scsi: terminate deferred commands on time out [+ + +]
Author: Damien Le Moal <dlemoal@kernel.org>
Date:   Thu Jul 9 10:01:33 2026 +0900

    ata: libata-scsi: terminate deferred commands on time out
    
    commit 2e1d2e65e773d67dab163127f11a47dab0fbca9f upstream.
    
    If a command times out while we have deferred non-NCQ commands waiting to
    be issued, the SCSI EH task is not immediately woken up as the waiting
    deferred commands are never issued nor completed, thus leaving the SCSI
    host in a busy state (shost->host_failed != scsi_host_busy(shost)) which
    prevents the SCSI EH task from being woken up. Eventually, when the
    deferred commands also time out, the SCSI EH task is woken up and the
    timeout processing occurs.
    
    Avoid this unnecessary SCSI EH task wake-up additional time by scheduling
    a retry of all waiting deferred QCs, using the eh_timed_out SCSI host
    template operation. The function ata_scsi_eh_timed_out() is introduced to
    implement this operation.
    
    However, terminating deferred commands with DID_REQUEUE to force a retry
    by calling the function ata_scsi_requeue_deferred_qc() may still keep the
    SCSI host in a busy state because the block layer may immediately re-issue
    these commands. The solution to this is to schedule libata EH for the
    port which suffered the command timeout to prevent accepting any new
    command. ata_scsi_requeue_deferred_qc() is modified to add a call to
    ata_port_schedule_eh() for this purpose.
    
    In addition to this change, ata_scsi_requeue_deferred_qc() is also
    modified to take a new timedout_scmd scsi command argument which indicates
    the SCSI command that timed out. With this additional argument,
    ata_scsi_requeue_deferred_qc() can now also terminate with DID_TIME_OUT
    any timed out deferred qc, which simplifies ata_scsi_cmd_error_handler().
    In this case, ata_scsi_requeue_deferred_qc() returns SCSI_EH_DONE, with
    this return value propagated back to the ata_scsi_eh_timed_out() operation
    to indicate to scsi_timeout() that the timed out command was handled and
    no further processing is needed.
    
    For non-timed out deferred qc that need to be retried,
    ata_scsi_requeue_deferred_qc() returns SCSI_EH_NOT_HANDLED, thus
    indicating to scsi_timeout() that the timed out command needs to go
    through the SCSI EH (and libata EH) processing by adding it to the EH work
    queue with scsi_eh_scmd_add().
    
    One side effect of these changes is that the function atapi_qc_complete()
    needs to be modified to ensure that a deferred ATAPI command that needs
    to be retried is completed with DID_REQUEUE instead of the default
    SAM_STAT_GOOD status, and a command that timed out is completed with
    DID_TIME_OUT instead of SAM_STAT_CHECK_CONDITION.
    
    Fixes: 0ea84089dbf6 ("ata: libata-scsi: avoid Non-NCQ command starvation")
    Cc: stable@vger.kernel.org
    Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
    Reviewed-by: Igor Pylypiv <ipylypiv@google.com>
    Tested-by: Igor Pylypiv <ipylypiv@google.com>
    Reviewed-by: Niklas Cassel <cassel@kernel.org>
    Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ata: sata_mv: accept 1 or 2 resources in platform probe [+ + +]
Author: Rosen Penev <rosenp@gmail.com>
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 <rosenp@gmail.com>
    Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
audit: fix potential integer overflow in audit_log_n_string() [+ + +]
Author: Zhan Xusheng <zhanxusheng1024@gmail.com>
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: stable@vger.kernel.org
    Fixes: 168b7173959f ("AUDIT: Clean up logging of untrusted strings")
    Signed-off-by: Zhan Xusheng <zhanxusheng@xiaomi.com>
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

audit: fix potential use-after-free in audit_del_rule() [+ + +]
Author: Luxiao Xu <rakukuip@gmail.com>
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: stable@vger.kernel.org
    Fixes: 34d99af52ad4 ("audit: implement audit by executable")
    Reported-by: Vega <vega@nebusec.ai>
    Assisted-by: Codex:gpt-5.4
    Signed-off-by: Luxiao Xu <rakukuip@gmail.com>
    Signed-off-by: Ren Wei <enjou1224z@gmail.com>
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
binfmt_misc: don't leak the user namespace when the mount fails [+ + +]
Author: Christian Brauner <brauner@kernel.org>
Date:   Tue Jul 28 15:48:10 2026 +0200

    binfmt_misc: don't leak the user namespace when the mount fails
    
    commit b8206f516fe7cbe785cf44bf09c17c438d7c3cad upstream.
    
    bm_get_tree() takes a reference to the user namespace and hands it to
    get_tree_keyed() as the sget key. sget_fc() moves that reference into
    sb->s_fs_info and clears fc->s_fs_info, so from that point on the
    superblock owns it and bm_free() doesn't see it anymore.
    
    The superblock drops it in ->put_super(). But generic_shutdown_super()
    only calls ->put_super() from inside the if (sb->s_root) branch, so
    nothing releases it when bm_fill_super() fails:
    
    - The kzalloc_obj() failure leaves s_root NULL and the whole branch is
      skipped.
    
    - A simple_fill_super() failure in the file loop leaves s_root set, but
      s_op still points at simple_super_operations, which has no
      ->put_super(). bm_fill_super() installs s_ops only once
      simple_fill_super() returned success, and installing it earlier
      wouldn't help either because simple_fill_super() overwrites s_op.
    
    Either way vfs_get_super() calls deactivate_locked_super() and the
    reference is gone for good. binfmt_misc mounts are available in a user
    namespace and both the inode and the dentry cache are SLAB_ACCOUNT, so
    an unprivileged caller under a tight memory cgroup can fail
    simple_fill_super() on demand and leak one user namespace per attempt.
    
    Drop the reference in ->kill_sb() instead, which runs unconditionally,
    the same way nfsd and rpc_pipefs release their keyed s_fs_info.
    
    That also stops ->put_super() from clearing s_fs_info while the
    superblock is still on @fs_supers. generic_shutdown_super() leaves it
    there on purpose so that sget_fc() keeps finding it until kill_sb() has
    run, but a NULL s_fs_info makes test_keyed_super() miss it, so a
    concurrent mount for the same user namespace skips the grab_super()
    wait and creates a second superblock for a namespace that is still
    being torn down.
    
    Link: https://patch.msgid.link/20260728-work-binfmt_misc-usernsleak-v1-1-dbd8d5e626e7@kernel.org
    Fixes: 21ca59b365c0 ("binfmt_misc: enable sandboxed mounts")
    Cc: stable@vger.kernel.org
    Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

binfmt_misc: don't let an 'F' entry pin its own instance [+ + +]
Author: Christian Brauner <brauner@kernel.org>
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/20260728-work-binfmt_misc-selfpin-v1-1-74df5daeca5b@kernel.org
    Fixes: 948b701a607f ("binfmt_misc: add persistent opened binary handler for containers")
    Fixes: 21ca59b365c0 ("binfmt_misc: enable sandboxed mounts")
    Cc: stable@vger.kernel.org # v6.7+
    Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

binfmt_misc: reject a flag character as the field delimiter [+ + +]
Author: Christian Brauner <brauner@kernel.org>
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/20260710-work-binfmt_misc-locking-v3-3-a162f7cb58d6@kernel.org
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable@vger.kernel.org
    Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

binfmt_misc: restore write access when removing an entry [+ + +]
Author: Christian Brauner <brauner@kernel.org>
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/20260710-work-binfmt_misc-locking-v3-1-a162f7cb58d6@kernel.org
    Fixes: 948b701a607f ("binfmt_misc: add persistent opened binary handler for containers")
    Cc: stable@vger.kernel.org
    Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

binfmt_misc: use exe_file_deny_write_access() for the interpreter clone [+ + +]
Author: Christian Brauner <brauner@kernel.org>
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/20260710-work-binfmt_misc-locking-v3-2-a162f7cb58d6@kernel.org
    Fixes: 0357ef03c94e ("fs: don't block write during exec on pre-content watched files")
    Cc: stable@vger.kernel.org
    Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Bluetooth: btintel: Validate length before parsing diagnostics TLV [+ + +]
Author: Zijun Hu <zijun.hu@oss.qualcomm.com>
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 <zijun.hu@oss.qualcomm.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: btmtk: Fix short read errors in btmtk_usb_reg_read() [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Mon Jul 27 17:57:33 2026 +0200

    Bluetooth: btmtk: Fix short read errors in btmtk_usb_reg_read()
    
    commit 0cc4b5649ae83deb8222100dba31aa0f100a19cd upstream.
    
    If btmtk_usb_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_reg_read() is called (it's really just
    btmtk_usb_id_get() that calls btmtk_usb_reg_read(), so fix up those
    return sites.
    
    Cc: stable <stable@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: btmtk: Fix short read errors in btmtk_usb_uhw_reg_read() [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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 <stable@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: btusb: Fix short read errors in btusb_qca_send_vendor_req() [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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 <stable@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: hci_conn: hold conn reference in abort_conn_sync() [+ + +]
Author: Pauli Virtanen <pav@iki.fi>
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 <pav@iki.fi>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: hci_sync: Fix advertising data UAFs [+ + +]
Author: Chengfeng Ye <nicoyip.dev@gmail.com>
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: stable@vger.kernel.org
    Suggested-by: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
    Signed-off-by: Chengfeng Ye <nicoyip.dev@gmail.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: hci_sync: fix hci_conn_del() use in hci_le_create_conn_sync [+ + +]
Author: Pauli Virtanen <pav@iki.fi>
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 <pav@iki.fi>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: hci_sync: hold conn in hci_connect_acl/le_sync() callbacks [+ + +]
Author: Pauli Virtanen <pav@iki.fi>
Date:   Sat Jul 25 12:59:18 2026 +0300

    Bluetooth: hci_sync: hold conn in hci_connect_acl/le_sync() callbacks
    
    [ Upstream commit 2f5d635ad5906b0235bc0c870e8beba3116e1e98 ]
    
    There is theoretical UAF if the conn is freed while the hci_sync task
    is running.
    
    Hold refcount to avoid that.
    
    Fixes: 881559af5f5c ("Bluetooth: hci_sync: Attempt to dequeue connection attempt")
    Signed-off-by: Pauli Virtanen <pav@iki.fi>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: hci_sync: hold conn in hci_connect_big_sync() callback [+ + +]
Author: Pauli Virtanen <pav@iki.fi>
Date:   Sat Jul 25 12:59:19 2026 +0300

    Bluetooth: hci_sync: hold conn in hci_connect_big_sync() callback
    
    [ Upstream commit 56e78b670356caab0b607e8aad4cf819a1909d07 ]
    
    There is theoretical UAF if the conn is freed while the hci_sync task is
    running.
    
    Hold refcount to avoid that. Handle NULL hcon, return 0 + do nothing to
    match the previous behavior.
    
    Fixes: 024421cf3992 ("Bluetooth: hci_conn: Fix not setting timeout for BIG Create Sync")
    Signed-off-by: Pauli Virtanen <pav@iki.fi>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: hci_sync: hold conn in hci_connect_pa_sync() callback [+ + +]
Author: Pauli Virtanen <pav@iki.fi>
Date:   Sat Jul 25 12:59:20 2026 +0300

    Bluetooth: hci_sync: hold conn in hci_connect_pa_sync() callback
    
    [ Upstream commit 44fc74069d8988f2825246f9401218e29de2c0ab ]
    
    There is theoretical UAF if the conn is freed while the hci_sync task is
    running.
    
    Hold refcount to avoid that.
    
    Fixes: 6d0417e4e1cf ("Bluetooth: hci_conn: Fix not setting conn_timeout for Broadcast Receiver")
    Signed-off-by: Pauli Virtanen <pav@iki.fi>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: hci_sync: hold conn in hci_past_sync() callback [+ + +]
Author: Pauli Virtanen <pav@iki.fi>
Date:   Sat Jul 25 12:59:21 2026 +0300

    Bluetooth: hci_sync: hold conn in hci_past_sync() callback
    
    [ Upstream commit abf9753edf3f88282c44a605f3945d8d4f8dd86c ]
    
    Avoids giving freed pointers to hci_conn_valid(), which kmalloc may have
    reused.
    
    Hold refcount to avoid that.
    
    Fixes: d3413703d5f8 ("Bluetooth: ISO: Add support to bind to trigger PAST")
    Signed-off-by: Pauli Virtanen <pav@iki.fi>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: hci_sync: remove unnecessary hci_conn_get in create_conn_sync [+ + +]
Author: Pauli Virtanen <pav@iki.fi>
Date:   Sat Jul 25 12:59:23 2026 +0300

    Bluetooth: hci_sync: remove unnecessary hci_conn_get in create_conn_sync
    
    [ Upstream commit c0a9dcd2be398eee505d4b254ec3a845aa8ab189 ]
    
    hci_conn_get() without already held reference is data race against
    concurrent deletion.
    
    In previous patches, the refcount has been changed to be taken before
    starting the hci_sync task, so remove these extra get() + put() as they
    are not needed.
    
    Fixes: 12917f591cea ("Bluetooth: hci_conn: Fix null ptr deref in hci_abort_conn()")
    Signed-off-by: Pauli Virtanen <pav@iki.fi>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: HIDP: reject frames without a transaction header [+ + +]
Author: Sangho Lee <kudo3228@gmail.com>
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: stable@vger.kernel.org
    Signed-off-by: Sangho Lee <kudo3228@gmail.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: HIDP: validate numbered report payloads [+ + +]
Author: Sangho Lee <kudo3228@gmail.com>
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: stable@vger.kernel.org
    Signed-off-by: Sangho Lee <kudo3228@gmail.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: ISO: avoid deadlocks in iso_sock_timeout [+ + +]
Author: Pauli Virtanen <pav@iki.fi>
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 <pav@iki.fi>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: ISO: clear iso_data always when detaching conn from hcon [+ + +]
Author: Pauli Virtanen <pav@iki.fi>
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 <pav@iki.fi>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: ISO: ensure no dangling hcon references in iso_conn [+ + +]
Author: Pauli Virtanen <pav@iki.fi>
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 <pav@iki.fi>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Stable-dep-of: fdfde532ab1c ("Bluetooth: ISO: fix refcounting of iso_conn")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: ISO: fix CONNECTED -> CLOSED transition on shutdown/release [+ + +]
Author: Pauli Virtanen <pav@iki.fi>
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 <pav@iki.fi>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: ISO: fix leaking sk after socket release [+ + +]
Author: Pauli Virtanen <pav@iki.fi>
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 <pav@iki.fi>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: ISO: fix race of kfree vs kref_get_unless_zero [+ + +]
Author: Pauli Virtanen <pav@iki.fi>
Date:   Fri Jul 24 23:20:34 2026 +0300

    Bluetooth: ISO: fix race of kfree vs kref_get_unless_zero
    
    [ Upstream commit af24e338bf5dafb80f42baa9a0b9e9b57b1c5d9c ]
    
    hci_conn::iso_data is accessed and modified without lock or RCU.
    This leads to a race
    
        [Task hdev->workqueue]                      [Task 2]
        iso_recv                                    iso_conn_put(conn)
          conn = LOAD hcon->iso_data                  iso_conn_free(conn)
          iso_conn_hold_unless_zero(conn)               hcon->iso_data = NULL
                                                        kfree(conn)
            kref_get_unless_zero(&conn->ref) /* UAF */
    
    and also to races in iso_conn_add() vs. iso_conn_free().
    
    Fix by adding spinlock hci_conn::proto_lock and using it to guard
    hci_conn::iso_data.
    
    Fixes: dc26097bdb86 ("Bluetooth: ISO: Use kref to track lifetime of iso_conn")
    Signed-off-by: Pauli Virtanen <pav@iki.fi>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: ISO: fix refcounting of iso_conn [+ + +]
Author: Pauli Virtanen <pav@iki.fi>
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 <pav@iki.fi>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: ISO: fix timeout vs sync_timeout typo in check_bcast_qos [+ + +]
Author: Pauli Virtanen <pav@iki.fi>
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 <pav@iki.fi>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: ISO: hold sk properly in iso_conn_ready [+ + +]
Author: Pauli Virtanen <pav@iki.fi>
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 <pav@iki.fi>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: ISO: lock sk in iso_connect_ind [+ + +]
Author: Pauli Virtanen <pav@iki.fi>
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 <pav@iki.fi>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: ISO: lock sk in iso_sock_getname [+ + +]
Author: Pauli Virtanen <pav@iki.fi>
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 <pav@iki.fi>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: ISO: validate sockaddr_iso first in iso_sock_rebind_bis() [+ + +]
Author: Pauli Virtanen <pav@iki.fi>
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 <pav@iki.fi>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: L2CAP: fix UAF in l2cap_le_connect_rsp [+ + +]
Author: Jiale Yao <yaojiale02@163.com>
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 <yaojiale02@163.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

Bluetooth: mgmt: fix pending command UAF in EIR updates [+ + +]
Author: Zihan Xi <zihanx@nebusec.ai>
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: stable@vger.kernel.org
    Reported-by: Vega <vega@nebusec.ai>
    Assisted-by: Codex:gpt-5.4
    Signed-off-by: Zihan Xi <zihanx@nebusec.ai>
    Signed-off-by: Ren Wei <enjou1224z@gmail.com>
    Reported-by: Vega <vega@nebusec.ai>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: mgmt: fix UAF in pair command cancellation [+ + +]
Author: Zihan Xi <xizh2024@lzu.edu.cn>
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: stable@vger.kernel.org
    Reported-by: Vega <vega@nebusec.ai>
    Assisted-by: Codex:gpt-5.4
    Signed-off-by: Zihan Xi <xizh2024@lzu.edu.cn>
    Reviewed-by: Ren Wei <enjou1224z@gmail.com>
    Reported-by: Vega <vega@nebusec.ai>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: SCO: give the socket its own sco_conn reference [+ + +]
Author: Aldo Ariel Panzardo <qwe.aldo@gmail.com>
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: stable@vger.kernel.org
    Suggested-by: Pauli Virtanen <pav@iki.fi>
    Signed-off-by: Aldo Ariel Panzardo <qwe.aldo@gmail.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
bpf: lwt: Fix dst reference leak on reroute failure [+ + +]
Author: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
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: stable@vger.kernel.org
    Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
    Link: https://patch.msgid.link/20260723060445.21926-1-xuanqiang.luo@linux.dev
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
btrfs: fix leaking BTRFS_FS_STATE_REMOUNTING flag [+ + +]
Author: Qu Wenruo <wqu@suse.com>
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 <johannes.thumshirn@wdc.com>
    Signed-off-by: Qu Wenruo <wqu@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

btrfs: raid56: fix an incorrect csum skip during scrub [+ + +]
Author: Qu Wenruo <wqu@suse.com>
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 <neelx@suse.com>
    Signed-off-by: Qu Wenruo <wqu@suse.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

btrfs: raid56: fix scrub read assembly submitting no reads [+ + +]
Author: Mykola Lysenko <nickolay.lysenko@gmail.com>
Date:   Sat Jul 18 16:37:10 2026 -0700

    btrfs: raid56: fix scrub read assembly submitting no reads
    
    commit c4c0673e4cb15b0c127e6d00732a2427bdd12c11 upstream.
    
    Commit 5387bd958180 ("btrfs: raid56: remove sector_ptr structure")
    converted the bio-list membership checks from sector pointers to
    physical addresses. The two conversions in rmw_assemble_write_bios()
    kept their polarity (skip the sector when it is NOT in the bio list,
    i.e. when there is nothing to write), but scrub_assemble_read_bios()
    has the opposite polarity -- skip the sector when it IS in the bio
    list, because then there is nothing to read -- and the conversion
    flipped it:
    
            -       sector = sector_in_rbio(rbio, stripe, sectornr, 1);
            -       if (sector)
            +       paddr = sector_paddr_in_rbio(rbio, stripe, sectornr, 1);
            +       if (paddr == INVALID_PADDR)
                    continue;
    
    Since a parity-scrub rbio's bio list only holds the empty completion
    bio, the result is that scrub_assemble_read_bios() submits no reads at
    all. finish_parity_scrub() then compares the parity it computes from
    the (cached, correct) data stripes against whatever happens to be in
    the freshly allocated, uninitialized stripe pages:
    
      - if the garbage differs from the computed parity, the sector is
        "repaired" and written back -- accidentally producing the correct
        on-disk result;
    
      - if a recycled page happens to still hold the old (correct) parity
        content, the sector is deemed clean, dropped from dbitmap, and the
        actually-corrupt on-disk parity is left in place. (Scrub reports
        no errors either way: there is no counter for P/Q corruption by
        design, so the bug here is purely the failure to read and repair.)
    
    The second case is intermittent because it depends on page-allocator
    recycling. Observed with fstests btrfs/297 (raid5, 2 devices): the
    corrupted P stripe intermittently stays corrupt after a scrub --
    roughly 1/10 runs on x86-64 KVM and up to 7/8 on a UML build whose
    timing favors page reuse.
    
    Since the bio-list check can never be true for a parity-scrub rbio --
    raid56_parity_alloc_scrub_rbio() adds a single empty completion bio
    (asserting bi_size == 0), bio_paddrs[] is only populated by
    index_rbio_pages() which is never called for BTRFS_RBIO_PARITY_SCRUB,
    and rbio_can_merge() refuses to merge rbios of different operations --
    remove the dead check entirely and assert the invariant instead, as
    suggested by Qu Wenruo.
    
    After this fix the injected corruption is read, detected and repaired
    in every run (8/8 UML, 10/10 KVM), and the new assertion never fires
    across the full fstests raid group.
    
    Fixes: 5387bd958180 ("btrfs: raid56: remove sector_ptr structure")
    CC: stable@vger.kernel.org # 7.1+
    Suggested-by: Qu Wenruo <quwenruo.btrfs@gmx.com>
    Assisted-by: Claude:claude-fable-5
    Reviewed-by: Qu Wenruo <wqu@suse.com>
    Signed-off-by: Mykola Lysenko <nickolay.lysenko@gmail.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

btrfs: skip global block reserve accounting for rescue mounts [+ + +]
Author: Dongjiang Zhu <zhudongjiang@fnnas.com>
Date:   Mon Jul 13 16:50:08 2026 +0800

    btrfs: skip global block reserve accounting for rescue mounts
    
    [ Upstream commit 51a0e8399858621442807a26057bcd1cd3ced046 ]
    
    [BUG]
    Mounting with rescue=ibadroots after corrupting the block group tree
    root triggers a NULL pointer dereference:
    
      BUG: kernel NULL pointer dereference, address: 0000000000000100
      RIP: 0010:btrfs_update_global_block_rsv+0x9d/0x1c0 [btrfs]
      Call Trace:
       fill_dummy_bgs+0xd4/0x120 [btrfs]
       open_ctree+0xc6e/0x1ca0 [btrfs]
       btrfs_get_tree+0x50d/0xa40 [btrfs]
    
    The same crash occurs with a corrupted raid stripe tree root, via
    btrfs_read_block_groups() instead of fill_dummy_bgs().
    
    [CAUSE]
    With rescue=ibadroots, btrfs_read_roots() allows the mount to continue
    when either root cannot be read, leaving the corresponding root pointer
    NULL while its on-disk feature bit remains set.
    
    btrfs_update_global_block_rsv() then dereferences the missing root based
    on the feature bit alone.
    
    [FIX]
    Rescue mounts are fully read-only and cannot start transactions, so the
    global reserve is never consumed. Under btrfs_is_full_ro(), mark the
    reserve as full and return before performing the accounting.
    
    And since we need to check if the fs is mount fully RO, export
    fs_is_full_ro() as btrfs_is_full_ro(), and move it to fs.h.
    
    Fixes: 8dbfc14fc736 ("btrfs: account block group tree when calculating global reserve size")
    Fixes: 515020900d44 ("btrfs: read raid stripe tree from disk")
    Suggested-by: Qu Wenruo <wqu@suse.com>
    Signed-off-by: Dongjiang Zhu <zhudongjiang@fnnas.com>
    [ Squash the fs_is_full_ro() export commit into this one. ]
    Reviewed-by: Qu Wenruo <wqu@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

btrfs: warn about extent buffer that can not be released [+ + +]
Author: Qu Wenruo <wqu@suse.com>
Date:   Thu Apr 30 10:37:23 2026 +0930

    btrfs: warn about extent buffer that can not be released
    
    [ Upstream commit 83f7e52b7ed1c3e03b79123e20b6f6adf8d886bb ]
    
    When we unmount the fs or during mount failures, btrfs will call
    invalidate_inode_pages() to release all btree inode folios.
    
    However that function can return -EBUSY if any folios can not be
    invalidated.
    This can be caused by:
    
    - Some extent buffers are still held by btrfs
      This is a logic error, as we should release all tree root nodes
      during unmount and mount failure handling.
    
    - Some extent buffers are under readahead and haven't yet finished
      These are much rarer but valid cases.
      In that case we should wait for those extent buffers.
    
    Introduce a new helper invalidate_and_check_btree_folios() which will:
    
    - Call invalidate_inode_pages2() and catch its return value
      If it returned 0 as expected, that's great and we can call it a day.
    
    - Otherwise go through each extent buffer in buffer_tree
      Increase the ref by one first for the eb we're checking.
      This is to ensure the eb won't be freed after the readahead is
      finished.
    
      For ebs that still have EXTENT_BUFFER_READING flag, wait for them to
      finish first.
    
      After waiting for the readahead, check the refs of the eb and if it's
      still dirty.
    
      If the eb ref count is greater than 2 (one for the buffer tree, one
      held by us), it means we are still holding the extent buffer somewhere
      else, which is a code bug.
    
      If the eb is still dirty, it means a bug in transaction handling, e.g.
      the bug fixed by patch "btrfs: only release the dirty pages io tree
      after successful writes".
    
      For either case, show a warning message about the eb, including its
      bytenr, owner, refs and flags.
      And if it's a debug build, also trigger WARN_ON_ONCE() so that fstests
      can properly catch such situation.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=221270
    Reported-by: AHN SEOK-YOUNG <iamsyahn@gmail.com>
    CC: Teng Liu <27rabbitlt@gmail.com>
    Tested-by: Teng Liu <27rabbitlt@gmail.com>
    Reviewed-by: Filipe Manana <fdmanana@suse.com>
    Signed-off-by: Qu Wenruo <wqu@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Stable-dep-of: 51a0e8399858 ("btrfs: skip global block reserve accounting for rescue mounts")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

btrfs: zoned: fix deadlock between metadata writeback and transaction commit [+ + +]
Author: Johannes Thumshirn <johannes.thumshirn@wdc.com>
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 <naohiro.aota@wdc.com>
    Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

btrfs: zoned: fix missing chunk metadata reservation [+ + +]
Author: Guanghui Yang <3497809730@qq.com>
Date:   Tue Jul 14 17:55:43 2026 +0800

    btrfs: zoned: fix missing chunk metadata reservation
    
    commit 8bc4d7209611e8aa9d5409b6a4a86a9eb91b69a3 upstream.
    
    reserve_chunk_space() stores the return value of
    btrfs_zoned_activate_one_bg() in ret. The helper can return 1 after
    successfully activating a block group, but ret is later used to decide
    whether to reserve metadata for chunk tree updates.
    
    As a result, successful activation skips btrfs_block_rsv_add() and leaves
    trans->chunk_bytes_reserved unchanged. Use a separate variable for the
    activation result so positive success does not affect the later
    reservation. Keep activation failures in ret instead of returning early so
    the function uses the common tail path.
    
    Fixes: b6a98021e401 ("btrfs: zoned: activate necessary block group")
    CC: stable@vger.kernel.org
    Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
    Signed-off-by: Guanghui Yang <3497809730@qq.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

btrfs: zoned: reset meta_write_pointer on zone reset [+ + +]
Author: Johannes Thumshirn <johannes.thumshirn@wdc.com>
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 <naohiro.aota@wdc.com>
    Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

btrfs: zoned: skip fully truncated ordered extents at zone finish [+ + +]
Author: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Date:   Thu Jul 16 10:23:12 2026 +0200

    btrfs: zoned: skip fully truncated ordered extents at zone finish
    
    [ Upstream commit ab602da96a915d42dcb1b0b322e8daea0f71b51f ]
    
    A fully truncated ordered extent (truncated_len == 0) wrote no data, so its
    ->csum_list is empty and btrfs_finish_ordered_zoned() trips:
    
      assertion failed: !list_empty(&ordered->csum_list), in fs/btrfs/zoned.c:2141
    
    Since commit 66ff4d366e7e a short or cancelled direct IO write finishes the
    unsubmitted ordered extent as truncated with uptodate = true instead of
    setting BTRFS_ORDERED_IOERR, so it now reaches btrfs_finish_ordered_zoned()
    rather than being skipped by the IOERR check in btrfs_finish_ordered_io().
    generic/208 hits this on a zoned filesystem.
    
    Return early for these, like the BTRFS_ORDERED_PREALLOC case; there is no
    zone append result to record and btrfs_finish_one_ordered() skips them too.
    
    Fixes: 66ff4d366e7e ("btrfs: fix false IO failure after falling back to buffered write")
    Reviewed-by: Qu Wenruo <wqu@suse.com>
    Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
can: c_can: c_can_chip_config(): keep controller in init mode until bittiming is configured [+ + +]
Author: Lucas Martins Alves <lucas.alves@lumal21.com.br>
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 <lucas.alves@lumal21.com.br>
    Link: https://patch.msgid.link/20260714164839.771123-1-lucas.alves@lumal21.com.br
    Fixes: 881ff67ad450 ("can: c_can: Added support for Bosch C_CAN controller")
    Cc: stable@kernel.org
    [mkl: remove space before close parenthesis]
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

can: ctucanfd: add missing MODULE_DEVICE_TABLE() [+ + +]
Author: Pengpeng Hou <pengpeng@iscas.ac.cn>
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 <pengpeng@iscas.ac.cn>
    Acked-by: Pavel Pisa <pisa@fel.cvut.cz>
    Link: https://patch.msgid.link/20260704151957.48194-1-pengpeng@iscas.ac.cn
    Fixes: 792a5b678e81 ("can: ctucanfd: CTU CAN FD open-source IP core - PCI bus support.")
    Cc: stable@kernel.org
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

can: ctucanfd: handle bus error interrupts [+ + +]
Author: Avi Weiss <thnkslprpt@gmail.com>
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 <thnkslprpt@gmail.com>
    Acked-by: Pavel Pisa <pisa@fel.cvut.cz>
    Link: https://patch.msgid.link/20260723074403.131575-1-thnkslprpt@gmail.com
    Cc: stable@kernel.org
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

can: ctucanfd: mark error-active controller status valid [+ + +]
Author: Avi Weiss <thnkslprpt@gmail.com>
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 <thnkslprpt@gmail.com>
    Link: https://patch.msgid.link/20260723155543.318414-1-thnkslprpt@gmail.com
    Cc: stable@kernel.org
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

can: ctucanfd: unmap BAR0 using base address [+ + +]
Author: Avi Weiss <thnkslprpt@gmail.com>
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 <thnkslprpt@gmail.com>
    Acked-by: Pavel Pisa <pisa@fel.cvut.cz>
    Link: https://patch.msgid.link/20260723095934.181042-1-thnkslprpt@gmail.com
    Cc: stable@kernel.org
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

can: ctucanfd: use self-test mode for PRESUME_ACK [+ + +]
Author: Avi Weiss <thnkslprpt@gmail.com>
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 <thnkslprpt@gmail.com>
    Acked-by: Pavel Pisa <pisa@fel.cvut.cz>
    Link: https://patch.msgid.link/20260722192726.230729-1-thnkslprpt@gmail.com
    Cc: stable@kernel.org
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

can: ems_usb: validate CPC message lengths [+ + +]
Author: Pengpeng Hou <pengpeng@iscas.ac.cn>
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 <pengpeng@iscas.ac.cn>
    Link: https://patch.msgid.link/20260706092752.79600-1-pengpeng@iscas.ac.cn
    Fixes: 702171adeed3 ("ems_usb: Added support for EMS CPC-USB/ARM7 CAN/USB interface")
    Cc: stable@vger.kernel.org
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

can: etas_es58x: es58x_read_bulk_callback(): fix RX buffer leak on URB resubmit failure [+ + +]
Author: Guangshuo Li <lgs201920130244@gmail.com>
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 <lgs201920130244@gmail.com>
    Reviewed-by: Vincent Mailhol <mailhol@kernel.org>
    Link: https://patch.msgid.link/20260706014601.415445-1-lgs201920130244@gmail.com
    Cc: stable@kernel.org
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

can: gs_usb: gs_usb_receive_bulk_callback(): resubmit URB on skb allocation failure [+ + +]
Author: Marc Kleine-Budde <mkl@pengutronix.de>
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/20260709-gs_usb-resubmit-urb-v1-1-4dd40030cc84@pengutronix.de
    Cc: stable@kernel.org
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

can: isotp: check register_netdevice_notifier() error in module init [+ + +]
Author: Minhong He <heminhong@kylinos.cn>
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 <heminhong@kylinos.cn>
    Link: https://patch.msgid.link/20260729085656.134523-1-heminhong@kylinos.cn
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

can: isotp: fix timer drain order, wakeup handling and tx_gen ordering [+ + +]
Author: Oliver Hartkopp <socketcan@hartkopp.net>
Date:   Fri Jul 24 20:15:25 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 <socketcan@hartkopp.net>
    Link: https://patch.msgid.link/20260724181525.43556-1-socketcan@hartkopp.net
    Cc: stable@kernel.org
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

can: j1939: transport: j1939_session_fresh_new(): initialize receive buffer [+ + +]
Author: Oleksij Rempel <o.rempel@pengutronix.de>
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 <eilaimemedsnaimel@gmail.com>
    Message-ID: <CAPAUci5dykCLjoijqkUtFqJFesgncrD7+S6y_V=gjbFkY2Tifg@mail.gmail.com>
    Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
    Link: https://patch.msgid.link/20260728055835.1151785-3-o.rempel@pengutronix.de
    Cc: stable@kernel.org
    [mkl: add Message-ID]
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

can: j1939: use netdevice_tracker for j1939_{priv,session,ecu} tracking [+ + +]
Author: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
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 <penguin-kernel@I-love.SAKURA.ne.jp>
    Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
    Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
    Link: https://patch.msgid.link/20260728055835.1151785-2-o.rempel@pengutronix.de
    Cc: stable@kernel.org
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

can: kvaser_usb: kvaser_usb_hydra_get_busparams(): fix memory leak in kvaser_usb_hydra_get_busparams() [+ + +]
Author: Abdun Nihaal <nihaal@cse.iitm.ac.in>
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: stable@vger.kernel.org
    Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
    Link: https://patch.msgid.link/20260722103906.108571-1-nihaal@cse.iitm.ac.in
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

can: kvaser_usb_leaf: kvaser_usb_leaf_wait_cmd(): validate received command extents [+ + +]
Author: Pengpeng Hou <pengpeng@iscas.ac.cn>
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 <pengpeng@iscas.ac.cn>
    Link: https://patch.msgid.link/20260722042221.44066-1-pengpeng@iscas.ac.cn
    Cc: stable@kernel.org
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

can: peak_usb: add bounds check for USB channel index [+ + +]
Author: James Gao <jamesgao5@outlook.com>
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 <jamesgao5@outlook.com>
    Reviewed-by: Vincent Mailhol <mailhol@kernel.org>
    Link: https://patch.msgid.link/TYWPR01MB8559DBAAAA6A7F410400329CF0012@TYWPR01MB8559.jpnprd01.prod.outlook.com
    Cc: stable@kernel.org
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

can: peak_usb: peak_usb_start(): fix double free of transfer buffer on URB submit error [+ + +]
Author: Maoyi Xie <maoyixie.tju@gmail.com>
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/178159320216.2154888.16953451793788581739@maoyixie.com/T/#u
    Cc: stable@vger.kernel.org
    Signed-off-by: Maoyi Xie <maoyixie.tju@gmail.com>
    Reviewed-by: Vincent Mailhol <mailhol@kernel.org>
    Link: https://patch.msgid.link/178163373110.2507866.216458825145756798@maoyixie.com
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

can: peak_usb: validate uCAN receive record lengths [+ + +]
Author: Pengpeng Hou <pengpeng@iscas.ac.cn>
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 <pengpeng@iscas.ac.cn>
    Link: https://patch.msgid.link/20260706092836.79754-1-pengpeng@iscas.ac.cn
    Fixes: 0a25e1f4f185 ("can: peak_usb: add support for PEAK new CANFD USB adapters")
    Cc: stable@vger.kernel.org
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

can: rcar_canfd: change the initializing flow for clocks and resets [+ + +]
Author: Tu Nguyen <tu.nguyen.xg@renesas.com>
Date:   Thu Jun 25 14:51:51 2026 +0100

    can: rcar_canfd: change the initializing flow for clocks and resets
    
    commit bef9004c5b91debfceaea2841855a4ebe81ff2b3 upstream.
    
    Testing CANFD on RZ/G3E shows that many registers do not reset to their
    initial values with the current flow of deasserting resets first and then
    enabling clocks.
    
    Based on the HW manual, clocks should be supplied first and the
    resets deasserted afterward.
    
     section 7.4.3 Procedure for Activating Modules: RZ/G2L
     section 4.4.9.3 Procedure for Starting up Units: RZ/G3E
    
    So, update the order of the initializing flow for resets and clocks
    to match the hardware manual, resetting all CANFD registers to their
    initial values. Also update rcar_canfd_global_deinit() to assert
    resets before disabling clocks, so the teardown path mirrors the new
    init ordering.
    
    Fixes: 76e9353a80e9 ("can: rcar_canfd: Add support for RZ/G2L family")
    Signed-off-by: Tu Nguyen <tu.nguyen.xg@renesas.com>
    Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
    Tested-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
    Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Reviewed-by: Vincent Mailhol <mailhol@kernel.org>
    Link: https://patch.msgid.link/20260625135216.130450-1-biju.das.jz@bp.renesas.com
    Cc: stable@kernel.org
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

can: softing: fw_parse(): validate firmware record spans [+ + +]
Author: Pengpeng Hou <pengpeng@iscas.ac.cn>
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 <pengpeng@iscas.ac.cn>
    Link: https://patch.msgid.link/20260722044347.2708-1-pengpeng@iscas.ac.cn
    Cc: stable@kernel.org
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
cifs: add fscache_resize_cookie() to cifs_setsize() [+ + +]
Author: Frank Sorenson <sorenson@redhat.com>
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: stable@vger.kernel.org
    Cc: David Howells <dhowells@redhat.com>
    Cc: Paulo Alcantara <pc@manguebit.org>
    Cc: Huiwen He <hehuiwen@kylinos.cn>
    Signed-off-by: Frank Sorenson <sorenson@redhat.com>
    Reviewed-by: Paulo Alcantara <pc@manguebit.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
cpufreq: cppc: Sanitize lockless policy limit snapshots [+ + +]
Author: Christian Loehle <christian.loehle@arm.com>
Date:   Wed Jul 22 10:38:25 2026 +0100

    cpufreq: cppc: Sanitize lockless policy limit snapshots
    
    commit 9753c0ab89b7516aba4884dc3cc725ca33c2e3da upstream.
    
    cppc_cpufreq_update_perf_limits() reads policy->min and policy->max
    without holding the policy lock. The cpufreq core updates those fields
    with separate stores, so a reader can observe the old minimum together
    with the new maximum and construct MIN_PERF greater than MAX_PERF.
    
    Read both fields once and, if the lockless snapshot is inconsistent,
    reduce the minimum to the observed maximum. This matches the conservative
    correction used by cpufreq_driver_resolve_freq() and ensures that CPPC
    never receives an inverted limit pair.
    
    Fixes: ea3db45ae476 ("cpufreq: cppc: Update MIN_PERF/MAX_PERF in target callbacks")
    Cc: stable@vger.kernel.org
    Signed-off-by: Christian Loehle <christian.loehle@arm.com>
    Link: https://patch.msgid.link/20260722093825.1030594-3-christian.loehle@arm.com
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

cpufreq: powernow-k8: Fix possible memory leak in powernowk8_cpu_init() [+ + +]
Author: Abdun Nihaal <nihaal@cse.iitm.ac.in>
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: stable@vger.kernel.org
    Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
    Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
    Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
    Link: https://patch.msgid.link/20260727093553.98246-1-nihaal@cse.iitm.ac.in
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

cpufreq: schedutil: Publish util hooks only after all sg_cpu are initialized [+ + +]
Author: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
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: stable@vger.kernel.org
    Signed-off-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
    Reviewed-by: Christian Loehle <christian.loehle@arm.com>
    Link: https://patch.msgid.link/20260716115159.848403-1-zhongqiu.han@oss.qualcomm.com
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
dibs: fix use-after-free of dmb_node in loopback attach/detach/unregister [+ + +]
Author: Hidayath Khan <hidayath@linux.ibm.com>
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: stable@vger.kernel.org
    Fixes: c3a910f2380f ("net/smc: implement DMB-merged operations of loopback-ism")
    Reported-by: Rahul Chandelkar <rc@rexion.ai>
    Signed-off-by: Hidayath Khan <hidayath@linux.ibm.com>
    Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
    Link: https://patch.msgid.link/20260727093530.968834-1-hidayath@linux.ibm.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
dmaengine: idxd: fix double free of wq, engine, and group structs [+ + +]
Author: Yuho Choi <dbgh9129@gmail.com>
Date:   Wed Apr 15 16:54:52 2026 -0400

    dmaengine: idxd: fix double free of wq, engine, and group structs
    
    [ Upstream commit ec2d428b2e32dd157de8f86a86dd85c5b2c8f45c ]
    
    The release callbacks for wq, engine, and group devices
    (idxd_conf_wq_release, idxd_conf_engine_release,
    idxd_conf_group_release) each call kfree() on the enclosing struct.
    The setup error paths and cleanup functions also call kfree()
    explicitly after put_device(), producing a double free whenever
    put_device() drops the reference count to zero and fires the release.
    
    In the setup functions, device_initialize() is called before
    device_add(), so the reference count is exactly 1 at the error sites.
    put_device() unconditionally fires the release, which frees the struct;
    the subsequent explicit kfree() then operates on freed memory.
    
    For idxd_setup_wqs(), the wq release callback also owns opcap_bmap
    and wqcfg. The error unwind additionally freed those fields explicitly
    before calling put_device(), causing further double frees on both.
    
    Remove the redundant explicit kfree() calls from all setup error paths
    and cleanup functions for wq, engine, and group structs, delegating
    sole ownership of those allocations to the release callbacks.
    
    Fixes: 7c5dd23e57c1 ("dmaengine: idxd: fix wq conf_dev 'struct device' lifetime")
    Fixes: 75b911309060 ("dmaengine: idxd: fix engine conf_dev lifetime")
    Fixes: defe49f96012 ("dmaengine: idxd: fix group conf_dev lifetime")
    Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
    Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Link: https://patch.msgid.link/20260415205452.67155-1-dbgh9129@gmail.com
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

dmaengine: idxd: fix fdev setup failure cleanup in idxd_cdev_open() [+ + +]
Author: Yuho Choi <dbgh9129@gmail.com>
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 <dbgh9129@gmail.com>
    Reviewed-by: Dave Jiang <dave.jiang@intel.com>
    Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
    Link: https://patch.msgid.link/20260525141550.1385581-1-dbgh9129@gmail.com
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

dmaengine: qcom: bam_dma: Fix command element mask field for BAM v1.6.0+ [+ + +]
Author: Md Sadre Alam <md.alam@oss.qualcomm.com>
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 <lakshmi.d@oss.qualcomm.com>
    Signed-off-by: Md Sadre Alam <md.alam@oss.qualcomm.com>
    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Varadarajan Narayanan <varadarajan.narayanan@oss.qualcomm.com>
    Link: https://patch.msgid.link/20260615060908.1263171-1-varadarajan.narayanan@oss.qualcomm.com
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

dmaengine: sun6i-dma: Fix reclaim descriptors while terminating DMA [+ + +]
Author: Hongling Zeng <zenghongling@kylinos.cn>
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 <zenghongling@kylinos.cn>
    Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
    Suggested-by: Frank Li <Frank.li@oss.nxp.com>
    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Link: https://patch.msgid.link/20260701045733.33654-1-zenghongling@kylinos.cn
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

dmaengine: switchtec-dma: fix FIELD_GET misuse when programming SE threshold [+ + +]
Author: David Carlier <devnexen@gmail.com>
Date:   Tue Mar 17 08:32:52 2026 +0000

    dmaengine: switchtec-dma: fix FIELD_GET misuse when programming SE threshold
    
    [ Upstream commit 9d12eb98582fec2578d17e025b13740dcfb57d8e ]
    
    FIELD_GET(SE_THRESH_MASK, thresh) extracts bits [31:23] from thresh and
    right-shifts them, which is the inverse of the intended operation. Since
    thresh is derived from se_buf_len / 2 (at most 255), bits [31:23] are
    always zero, so the SE threshold is never actually programmed into the
    register.
    
    Use FIELD_PREP() instead to correctly left-shift thresh into bits [31:23]
    of the valid_en_se register, consistent with the FIELD_PREP usage for
    the perf tuner config just above.
    
    Fixes: 30eba9df76ad ("dmaengine: switchtec-dma: Implement hardware initialization and cleanup")
    Signed-off-by: David Carlier <devnexen@gmail.com>
    Review-by: Logan Gunthorpe <logang@deltatee.com>
    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Link: https://patch.msgid.link/20260317083252.13224-1-devnexen@gmail.com
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
Drivers: hv: vmbus: Replace lockdep_hardirq_threaded() with lockdep annotation [+ + +]
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
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 <bigeasy@linutronix.de>
    Reviewed-by: Michael Kelley <mhklinux@outlook.com>
    Signed-off-by: Wei Liu <wei.liu@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/amd/display: check GRPH_FLIP status before sending event [+ + +]
Author: Leo Li <sunpeng.li@amd.com>
Date:   Wed Jul 29 13:37:43 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) <superm1@kernel.org>
    Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
    Signed-off-by: Leo Li <sunpeng.li@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit f64a9be5653689ff43e148cd8a6483077488c8e5)
    Cc: stable@vger.kernel.org # 8382cd234981: drm/amd/display: consolidate DCN vblank/flip handling onto vupdate_no_lock
    Cc: stable@vger.kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/amd/display: check if dml21_add_phantom_plane() is successful [+ + +]
Author: Alex Deucher <alexander.deucher@amd.com>
Date:   Mon Feb 16 09:32:53 2026 -0500

    drm/amd/display: check if dml21_add_phantom_plane() is successful
    
    commit 000acb4ce7fb9feba3072ce468ad681f6585cd5d upstream.
    
    Verify that the phantom plane was allocated to avoid a later
    segfault.
    
    Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4970
    Fixes: 70839da63605 ("drm/amd/display: Add new DCN401 sources")
    Reviewed-by: Dillon Varone <dillon.varone@amd.com>
    Signed-off-by: Fangzhi Zuo <jerry.zuo@amd.com>
    Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 5adb54abe5a8e82cbff7f8806db30a5f4924329f)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amd/display: Exit idle optimizations before programming [+ + +]
Author: Leo Li <sunpeng.li@amd.com>
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: stable@vger.kernel.org
    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 <weber.aulendorf@gmail.com>
    Signed-off-by: Leo Li <sunpeng.li@amd.com>
    Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 05984e29520a28c27f5a2388742c957a6a87ee7a)
    (cherry picked from commit 8419331e64d92a8de5fc4feef0e305f201fb8b33)
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/amd/display: Fix divide-by-zero in calculate_mcache_setting on zero viewport [+ + +]
Author: George Zhang <george.zhang@amd.com>
Date:   Thu Jul 16 17:00:01 2026 -0400

    drm/amd/display: Fix divide-by-zero in calculate_mcache_setting on zero viewport
    
    commit f327e389c07cfc3a2f6ff54f6214e1a52d457edc upstream.
    
    If a plane reaches calculate_mcache_setting with a zero-area viewport,
    calculate_mcache_setting exits early with num_mcaches == 0 and
    mvmpg_width/height == 0. This will cause a divide-by-zero panic and can
    also cause an underflow on num_mcaches.
    
    Fix this by changing calculate_mcache_setting to bool and adding guards
    after each calculate_mcache_row_bytes call. If num_mcaches or
    mvmpg_width/height is zero, return a false. Callers will propagate the
    failure as a rejected mode, which prevents the panic.
    
    Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/5302
    Reviewed-by: Sun peng (Leo) Li <sunpeng.li@amd.com>
    Reviewed-by: Dillon Varone <dillon.varone@amd.com>
    Signed-off-by: George Zhang <george.zhang@amd.com>
    Signed-off-by: Fangzhi Zuo <jerry.zuo@amd.com>
    Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 29c0f7c655f47bcbd575ff75e58480df6ec3c9da)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amd/display: Increase HDMI AV mute wait from 2 to 3 frames [+ + +]
Author: Ray Wu <ray.wu@amd.com>
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 <wayne.lin@amd.com>
    Signed-off-by: Ray Wu <ray.wu@amd.com>
    Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 0c0d5174b09640d8b560764aa5a177630e076e93)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amd/display: Silence link_dpms I2C retimer failures [+ + +]
Author: Alan Swanson <reiver@improbability.net>
Date:   Mon Jul 27 17:01:26 2026 +0100

    drm/amd/display: Silence link_dpms I2C retimer failures
    
    commit 8ccb87b1c9be594fc2c36b0a4006a66f08dee1c8 upstream.
    
    Commit a4f01bf729b2 ("drm/amd/display: Refactor and fix link_dpms I2C")
    had also changed the "Set retimer failed" messages from DC_LOG_DEBUG()
    to DC_LOG_ERROR(). This unfortunately can create log spam.
    
    Change those back to DC_LOG_DEBUG() only.
    
    Fixes: a4f01bf729b2 ("drm/amd/display: Refactor and fix link_dpms I2C")
    Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/5520
    Signed-off-by: Alan Swanson <reiver@improbability.net>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit da8609eef18b0a3490d0e1fa9440659fadc8194d)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amd/display: use proper context for logging [+ + +]
Author: Jiri Slaby (SUSE) <jirislaby@kernel.org>
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/a9ee54e6-2413-4156-9bde-d528ae3c63a3@kernel.org/
    Fixes: 1296423bf23c ("drm/amd/display: define DC_LOGGER for logger")
    Reviewed-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com>
    Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
    Cc: Lakha, Bhawanpreet <Bhawanpreet.Lakha@amd.com>
    Cc: Harry Wentland <harry.wentland@amd.com>
    Cc: Leo Li <sunpeng.li@amd.com>
    Cc: Rodrigo Siqueira <siqueira@igalia.com>
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: "Christian König" <christian.koenig@amd.com>
    Cc: David Airlie <airlied@gmail.com>
    Cc: Simona Vetter <simona@ffwll.ch>
    Cc: amd-gfx@lists.freedesktop.org
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 6f16fcbb0c46a87e3d9685407e906573d60104b0)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/amd/pm: fix pptable use-after-free [+ + +]
Author: Yang Wang <kevinyang.wang@amd.com>
Date:   Fri Jul 24 07:41:29 2026 +0800

    drm/amd/pm: fix pptable use-after-free
    
    commit bb493058c35c8676e48269ab6732688ea733d23c upstream.
    
    amdgpu_dpm_get_pp_table() returns a pointer to a driver-owned power table
    after dropping adev->pm.mutex. The sysfs path then copies from that pointer.
    A concurrent pp_table write can replace and free the allocation during the
    copy, causing a use-after-free.
    
    Change the DPM interface to copy into caller-provided storage while the mutex
    is held. Keep the size-only query for attribute discovery without exposing
    the driver-owned pointer.
    
    Fixes: 1684d3ba4885 ("drm/amd/amdgpu: change pptable output format from ASCII to binary")
    Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
    Reviewed-by: Kenneth Feng <kenneth.feng@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit f6eed7acfd30099ef7baeb6ba45bb59daad80631)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amd/pm: fix torn gpu metrics reads [+ + +]
Author: Yang Wang <kevinyang.wang@amd.com>
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 <kevinyang.wang@amd.com>
    Reviewed-by: Kenneth Feng <kenneth.feng@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 862333bb48693ecafcae25af0c9d9ec31015ac77)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amd/pm: hide pp_table sysfs on APUs [+ + +]
Author: Yang Wang <kevinyang.wang@amd.com>
Date:   Wed Jul 29 15:56:46 2026 +0800

    drm/amd/pm: hide pp_table sysfs on APUs
    
    commit a65f5179d3f0c93da31b450aeb416eaa22f1912b upstream.
    
    APUs use firmware-owned DPM tables and do not support replacement through
    pp_table. Generic callbacks can nevertheless expose the sysfs file and
    accept an upload before resetting the power management stack.
    
    Treat pp_table as unsupported on APUs. Use the same platform check in the
    get and set paths to hide the file and reject uploads.
    
    Fixes: 289921b03fe5 ("drm/amd/powerplay: implement sysfs of pp_table for smu11 (v2)")
    Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
    Reviewed-by: Kenneth Feng <kenneth.feng@amd.com>
    Reviewed-by: Asad Kamal <asad.kamal@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 74f28db2db69777cd2f059d50fe34e365ddd5add)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amd/pm: use milliwatts for GPU power sensors [+ + +]
Author: Yang Wang <kevinyang.wang@amd.com>
Date:   Mon Jul 27 12:23:17 2026 +0800

    drm/amd/pm: use milliwatts for GPU power sensors
    
    commit 1849a64165ccc23d3e5fc22b8be19227c21c1871 upstream.
    
    GPU average and input power backends report a mix of whole watts,
    milliwatts, Q24.8 watts and decimal-packed fractions. Q24.8 is inherited
    from the legacy PowerPlay sensor format. Milliwatts are a more natural unit
    for the hwmon and pm_info consumers in amdgpu_pm.c. A common decoder cannot
    distinguish these formats, and converting native milliwatts through Q24.8
    also loses precision.
    
    Use milliwatts as the internal unit across all PPT and PowerPlay backends.
    Decode Q24.8 only at the legacy smu7 input boundary and encode it only for
    the raw amdgpu_sensors debugfs interface. This gives hwmon, pm_info and the
    sensor ioctl one unambiguous unit while preserving the format used by UMR.
    
    Fixes: 5b79d0482f3c ("drm/amd/pp: Remove struct pp_gpu_power")
    Fixes: 01992b121fb6 ("drm/amd/pm: fix amdgpu_pm_info power display units")
    Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
    Reviewed-by: Kenneth Feng <kenneth.feng@amd.com>
    Reported-by: Lars Nieradzik <l.nieradzik@gmail.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 757ba0790bafec47a507e9662bf380f2e027d420)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/amdgpu: cap GTT size to physical RAM on APUs [+ + +]
Author: Harkirat Gill <harkirat.gill@amd.com>
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 <harkirat.gill@amd.com>
    Reviewed-by: David Francis <David.Francis@amd.com>
    Assisted-by: Claude:claude-opus-4
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 5dafdd649280c7dc6c22c8f877da3f54fcc441e1)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amdgpu: move debug_vm handling to amdgpu_cs_parser_fini [+ + +]
Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
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 <pierre-eric.pelloux-prayer@amd.com>
    Reviewed-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 8c990ee9daa295462df24982ce6878db997a380a)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amdgpu: restore UMD profile pstate after runtime resume [+ + +]
Author: Candice Li <candice.li@amd.com>
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 <candice.li@amd.com>
    Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
    Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 138531c8850cc247aa12b104bb29ea387bcdcbb1)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/amdkfd: Fix missing authorization check in KFD_IOC_DBG_TRAP_DISABLE [+ + +]
Author: Gang Ba <Gang.Ba@amd.com>
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 <Gang.Ba@amd.com>
    Reviewed-by: Kent Russell <kent.russell@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 4db4c5ffd5585b72622ecf6ffedf2da258ee23f5)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amdkfd: fix QID bit leak in pqm_create_queue() [+ + +]
Author: Vladimir Marioukhine <Vladimir.Marioukhine@amd.com>
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 <alexander.deucher@amd.com>
    Signed-off-by: Vladimir Marioukhine <Vladimir.Marioukhine@amd.com>
    Reviewed-by: Kent Russell <kent.russell@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit a107f74c38edbb80d6ab64dcaeeb292c14e9779f)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amdkfd: fix uint32_t overflow in EOP ring buffer size alignment [+ + +]
Author: William Palacek <William.Palacek@amd.com>
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 <William.Palacek@amd.com>
    Reviewed-by: Alysa Liu <Alysa.Liu@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit ae443117b742c357bfef3a7bddabf76fcf86e9ef)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amdkfd: Handle invalid event type in CRIU event restore [+ + +]
Author: David Francis <David.Francis@amd.com>
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 <David.Francis@amd.com>
    Reviewed-by: Kent Russell <kent.russell@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 2e8e9963cd5c41aa14fd5316bf9ec92e7a0e3097)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amdkfd: hold event_mutex while checkpointing CRIU events [+ + +]
Author: William Palacek <William.Palacek@amd.com>
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 <William.Palacek@amd.com>
    Reviewed-by: Alysa Liu <Alysa.Liu@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit ff57e223ab105795b05d3ef3f3c35a5a441bcbaa)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/bridge: display-connector: Fix I2C adapter resource leak [+ + +]
Author: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
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: stable@vger.kernel.org
    Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
    Reviewed-by: Johan Hovold <johan@kernel.org>
    Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
    Link: https://patch.msgid.link/20260717184836.2017386-1-laurent.pinchart+renesas@ideasonboard.com
    Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/dp: Read the PCON max FRL bandwidth only for HDMI DFPs [+ + +]
Author: Alexander Kaplan <alexander.kaplan@sms-medipool.de>
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 <ankit.k.nautiyal@intel.com>
    Cc: Uma Shankar <uma.shankar@intel.com> (v2)
    Cc: Jani Nikula <jani.nikula@intel.com>
    Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
    Cc: dri-devel@lists.freedesktop.org
    Cc: <stable@vger.kernel.org> # v5.12+
    Signed-off-by: Alexander Kaplan <alexander.kaplan@sms-medipool.de>
    Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
    Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
    Link: https://patch.msgid.link/20260610193825.2933-1-alexander.kaplan@sms-medipool.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/exec: Remove the index parameter from drm_exec_for_each_locked_obj[_reverse] [+ + +]
Author: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Date:   Sat Aug 1 10:04:07 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 <thomas.hellstrom@linux.intel.com>
    Reviewed-by: Christian König <christian.koenig@amd.com>
    Link: https://patch.msgid.link/20260520101616.41284-2-thomas.hellstrom@linux.intel.com
    Stable-dep-of: af80e2bfde93 ("drm/xe: Wait on external BO kernel fences in exec IOCTL")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/i915/dp: Ignore the sink's DSC max FRL rate without a PCON DSC encoder [+ + +]
Author: Alexander Kaplan <alexander.kaplan@sms-medipool.de>
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 <ankit.k.nautiyal@intel.com>
    Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
    Signed-off-by: Alexander Kaplan <alexander.kaplan@sms-medipool.de>
    Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
    Link: https://patch.msgid.link/20260718105207.5565-3-alexander.kaplan@sms-medipool.de
    (cherry picked from commit 71b57dd92f94569dca4bdf883fbd8ca5d4ed4bae)
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/i915/hdmi: Poll for 200 msec for TMDS_Scrambler_Status [+ + +]
Author: Jerome Tollet <jerome.tollet@gmail.com>
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 <jtollet@cisco.com>
    Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/6868
    Link: https://lore.kernel.org/dri-devel/20251230091037.5603-1-jerome.tollet@gmail.com/
    Signed-off-by: Jerome Tollet <jerome.tollet@gmail.com>
    Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
    Reviewed-by: Arun R Murthy <arun.r.murthy@intel.com>
    Link: https://patch.msgid.link/20260520022544.3097252-1-ankit.k.nautiyal@intel.com
    (cherry picked from commit b7d51d65e4f12a48392d260613108ec262bc7774)
    Fixes: 15953637886d ("drm/i915: enable scrambling")
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/mediatek: Check CRTC state before freeing [+ + +]
Author: Ruoyu Wang <ruoyuw560@gmail.com>
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 <ruoyuw560@gmail.com>
    Reviewed-by: CK Hu <ck.hu@mediatek.com>
    Link: https://patchwork.kernel.org/project/linux-mediatek/patch/20260707150528.2270739-1-ruoyuw560@gmail.com/
    Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/mediatek: mtk_hdmi: Fix DDC adapter double put in v2 [+ + +]
Author: Guangshuo Li <lgs201920130244@gmail.com>
Date:   Mon Jul 13 19:29:57 2026 +0800

    drm/mediatek: mtk_hdmi: Fix DDC adapter double put in v2
    
    commit d19d8542808c3be5f4af849da6509e877b74d811 upstream.
    
    mtk_hdmi_common_probe() gets the DDC adapter with
    of_find_i2c_adapter_by_node() and registers a devm action to release the
    adapter device reference with put_device().
    
    The HDMI v2 remove callback also calls i2c_put_adapter() on the same DDC
    adapter. This is not paired with of_find_i2c_adapter_by_node(): it drops
    the adapter device reference before the devm action drops it again, and
    it also puts a module reference that was never taken.
    
    Remove the extra i2c_put_adapter() call and drop the now-empty HDMI v2
    remove callback. The common devm action releases the adapter device
    reference.
    
    Fixes: 8d0f79886273 ("drm/mediatek: Introduce HDMI/DDC v2 for MT8195/MT8188")
    Cc: stable@vger.kernel.org
    Reviewed-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
    Reviewed-by: CK Hu <ck.hu@mediatek.com>
    Link: https://patchwork.kernel.org/project/linux-mediatek/patch/20260713112957.884640-1-lgs201920130244@gmail.com/
    Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/mediatek: ovl_adaptor: balance component registrations [+ + +]
Author: Myeonghun Pak <mhun512@gmail.com>
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: stable@vger.kernel.org # 6.4+
    Co-developed-by: Ijae Kim <ae878000@gmail.com>
    Signed-off-by: Ijae Kim <ae878000@gmail.com>
    Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
    Reviewed-by: CK Hu <ck.hu@mediatek.com>
    Link: https://patchwork.kernel.org/project/linux-mediatek/patch/20260721152242.47138-1-mhun512@gmail.com/
    Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/panthor: reject firmware sections with oversized data [+ + +]
Author: Osama Abdelkader <osama.abdelkader@gmail.com>
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: stable@vger.kernel.org
    Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
    Reviewed-by: Steven Price <steven.price@arm.com>
    Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
    Link: https://patch.msgid.link/20260716143939.21903-1-osama.abdelkader@gmail.com
    Signed-off-by: Steven Price <steven.price@arm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/panthor: validate firmware interface structure sizes [+ + +]
Author: Osama Abdelkader <osama.abdelkader@gmail.com>
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: stable@vger.kernel.org
    Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
    Reviewed-by: Steven Price <steven.price@arm.com>
    Signed-off-by: Steven Price <steven.price@arm.com>
    Link: https://patch.msgid.link/20260720114918.15973-1-osama.abdelkader@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/vc4: Supply the overflow slot size in BPOS, not the whole bin BO size [+ + +]
Author: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
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: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4.8
    Signed-off-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
    Reviewed-by: Maíra Canal <mcanal@igalia.com>
    Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
    Link: https://patch.msgid.link/20260727-vc4-bin-oom-fixes-v2-1-0d8a5eddc7c9@igalia.com
    Signed-off-by: Maíra Canal <mcanal@igalia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/vc4: Zero the tile state data array before each BIN job [+ + +]
Author: Maíra Canal <mcanal@igalia.com>
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: stable@vger.kernel.org
    Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
    Link: https://patch.msgid.link/20260727-vc4-bin-oom-fixes-v2-2-0d8a5eddc7c9@igalia.com
    Signed-off-by: Maíra Canal <mcanal@igalia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/vmwgfx: avoid destroy_workqueue(NULL) on vkms init failure [+ + +]
Author: Zack Rusin <zack.rusin@broadcom.com>
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: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4.7
    Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
    Reviewed-by: Ian Forbes <ian.forbes@broadcom.com>
    Link: https://patch.msgid.link/20260505222728.519626-9-zack.rusin@broadcom.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/vmwgfx: bound DMA command body size against suffix pointer [+ + +]
Author: Zack Rusin <zack.rusin@broadcom.com>
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: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4.7
    Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
    Reviewed-by: Ian Forbes <ian.forbes@broadcom.com>
    Link: https://patch.msgid.link/20260505222728.519626-8-zack.rusin@broadcom.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/vmwgfx: clamp dirty-page range with min, not max [+ + +]
Author: Zack Rusin <zack.rusin@broadcom.com>
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: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4.7
    Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
    Reviewed-by: Ian Forbes <ian.forbes@broadcom.com>
    Link: https://patch.msgid.link/20260505222728.519626-4-zack.rusin@broadcom.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/vmwgfx: drop dma_buf reference on foreign-fd prime import [+ + +]
Author: Zack Rusin <zack.rusin@broadcom.com>
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: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4.7
    Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
    Reviewed-by: Ian Forbes <ian.forbes@broadcom.com>
    Link: https://patch.msgid.link/20260505222728.519626-6-zack.rusin@broadcom.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/vmwgfx: enforce cursor size limits for MOB cursors [+ + +]
Author: Zack Rusin <zack.rusin@broadcom.com>
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: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4.7
    Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
    Reviewed-by: Ian Forbes <ian.forbes@broadcom.com>
    Link: https://patch.msgid.link/20260505222728.519626-10-zack.rusin@broadcom.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/vmwgfx: fix guest_memory_dirty bitfield clobbered as size [+ + +]
Author: Zack Rusin <zack.rusin@broadcom.com>
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: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4.7
    Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
    Reviewed-by: Ian Forbes <ian.forbes@broadcom.com>
    Link: https://patch.msgid.link/20260505222728.519626-2-zack.rusin@broadcom.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/vmwgfx: reject DX_BIND_QUERY without a DX context [+ + +]
Author: Zack Rusin <zack.rusin@broadcom.com>
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: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4.7
    Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
    Reviewed-by: Ian Forbes <ian.forbes@broadcom.com>
    Link: https://patch.msgid.link/20260505222728.519626-3-zack.rusin@broadcom.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/vmwgfx: take fman->lock around fence list mutation in fifo_down [+ + +]
Author: Zack Rusin <zack.rusin@broadcom.com>
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: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4.7
    Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
    Reviewed-by: Ian Forbes <ian.forbes@broadcom.com>
    Link: https://patch.msgid.link/20260505222728.519626-5-zack.rusin@broadcom.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/vmwgfx: use check_add_overflow for shader size+offset bound [+ + +]
Author: Zack Rusin <zack.rusin@broadcom.com>
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: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4.7
    Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
    Reviewed-by: Ian Forbes <ian.forbes@broadcom.com>
    Link: https://patch.msgid.link/20260505222728.519626-12-zack.rusin@broadcom.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/vmwgfx: validate DRAW_PRIMITIVES header size before division [+ + +]
Author: Zack Rusin <zack.rusin@broadcom.com>
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: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4.7
    Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
    Reviewed-by: Ian Forbes <ian.forbes@broadcom.com>
    Link: https://patch.msgid.link/20260505222728.519626-7-zack.rusin@broadcom.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/vmwgfx: validate external BO copy bounds for both stride paths [+ + +]
Author: Zack Rusin <zack.rusin@broadcom.com>
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: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4.7
    Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
    Reviewed-by: Ian Forbes <ian.forbes@broadcom.com>
    Link: https://patch.msgid.link/20260505222728.519626-13-zack.rusin@broadcom.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
drm/xe/oa: (De-)whitelist OA registers on OA stream open/release [+ + +]
Author: Ashutosh Dixit <ashutosh.dixit@intel.com>
Date:   Tue Aug 4 19:42:59 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: stable@vger.kernel.org # v6.12+
    Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
    Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
    Link: https://patch.msgid.link/20260615224227.34880-9-ashutosh.dixit@intel.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/xe/pt: check no-DMA huge-pte cases before DMA segment test [+ + +]
Author: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Date:   Tue Jul 28 11:29:17 2026 +0530

    drm/xe/pt: check no-DMA huge-pte cases before DMA segment test
    
    [ Upstream commit d94f82d57e7a86def6946f22b34eb53f96628f8a ]
    
    On a non-range clear, curs.size is never set, so the segment test
    (next - va_curs_start > curs->size) returns false for every level > 0
    before the clear_pt short-circuit is reached. The clear then descends to
    level 0 instead of forming a huge zero-leaf, wasting page tables and
    risking -ENOMEM on unbind.
    
    Move the null-VMA, purged-BO and clear_pt short-circuits above the
    curs->size test. The bind path always sets curs.size, so it is unaffected.
    
    v2
    - Also set curs.size on the clear path so the cursor stays meaningful
    during the walk. clear_pt is only reached with range == NULL, so assert
    that invariant. (Matthew Brost)
    
    Cc: Matthew Brost <matthew.brost@intel.com>
    Fixes: 5b658b7e89c3 ("drm/xe: Clear scratch page on vm_bind")
    Reported-by: Sashiko <sashiko-bot@kernel.org>
    Reviewed-by: Matthew Brost <matthew.brost@intel.com>
    Link: https://patch.msgid.link/20260728055916.593707-2-himal.prasad.ghimiray@intel.com
    Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
    (cherry picked from commit 04eeeb45cb61b8a3e9d785003457e550c920ba49)
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/xe/rtp: (De-)whitelist OA registers for all hwe's for a gt [+ + +]
Author: Ashutosh Dixit <ashutosh.dixit@intel.com>
Date:   Tue Aug 4 19:42:58 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: stable@vger.kernel.org # v6.12+
    Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
    Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
    Link: https://patch.msgid.link/20260615224227.34880-8-ashutosh.dixit@intel.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/xe/rtp: Ensure locking/ref counting for OA whitelists [+ + +]
Author: Ashutosh Dixit <ashutosh.dixit@intel.com>
Date:   Tue Aug 4 19:43:00 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: stable@vger.kernel.org # v6.12+
    Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
    Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
    Link: https://patch.msgid.link/20260615224227.34880-10-ashutosh.dixit@intel.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/xe/rtp: Generalize whitelist_apply_to_hwe [+ + +]
Author: Ashutosh Dixit <ashutosh.dixit@intel.com>
Date:   Tue Aug 4 19:42:55 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: stable@vger.kernel.org # v6.12+
    Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
    Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
    Link: https://patch.msgid.link/20260615224227.34880-5-ashutosh.dixit@intel.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/xe/rtp: Keep track of non-OA nonpriv slots [+ + +]
Author: Ashutosh Dixit <ashutosh.dixit@intel.com>
Date:   Tue Aug 4 19:42:54 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: stable@vger.kernel.org # v6.12+
    Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
    Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
    Link: https://patch.msgid.link/20260615224227.34880-4-ashutosh.dixit@intel.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/xe/rtp: Maintain OA whitelists separately [+ + +]
Author: Ashutosh Dixit <ashutosh.dixit@intel.com>
Date:   Tue Aug 4 19:42:53 2026 -0700

    drm/xe/rtp: Maintain OA whitelists separately
    
    [ Upstream commit 31e2437561621b4867c08efc890bf629d017df03 ]
    
    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.
    
    (cherry picked from commit c478244a9e2d14b3f1f92e8bd293919e554622a5)
    [ adapted RTP table from struct wrapper macro `XE_RTP_TABLE_SR()` back to plain `struct xe_rtp_entry_sr[]` array and restored the 5-arg `xe_rtp_process_to_sr()` call with `ARRAY_SIZE()` ]
    
    Fixes: 828a8eaf37c3 ("drm/xe/oa: Add MMIO trigger support")
    Cc: stable@vger.kernel.org # v6.12+
    Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
    Link: https://patch.msgid.link/20260615224227.34880-3-ashutosh.dixit@intel.com
    Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/xe/rtp: Save OA nonpriv registers to register save/restore lists [+ + +]
Author: Ashutosh Dixit <ashutosh.dixit@intel.com>
Date:   Tue Aug 4 19:42:56 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: stable@vger.kernel.org # v6.12+
    Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
    Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
    Link: https://patch.msgid.link/20260615224227.34880-6-ashutosh.dixit@intel.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

drm/xe/rtp: Toggle 'deny' bit to (de-)whitelist OA regs [+ + +]
Author: Ashutosh Dixit <ashutosh.dixit@intel.com>
Date:   Tue Aug 4 19:42:57 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: stable@vger.kernel.org # v6.12+
    Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
    Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
    Link: https://patch.msgid.link/20260615224227.34880-7-ashutosh.dixit@intel.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
drm/xe: Drop unused param from xe_device_create() [+ + +]
Author: Michal Wajdeczko <michal.wajdeczko@intel.com>
Date:   Fri Jul 31 12:56:54 2026 -0400

    drm/xe: Drop unused param from xe_device_create()
    
    [ Upstream commit 8a09097b11ca4d436691f64c3cc0958006f36e33 ]
    
    We never used or need anything from the struct pci_device_id there.
    And while around, add simple kernel-doc for this function.
    
    Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
    Reviewed-by: Raag Jadav <raag.jadav@intel.com>
    Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
    Link: https://patch.msgid.link/20260526195452.20545-3-michal.wajdeczko@intel.com
    Stable-dep-of: ba7fd1634228 ("drm/xe: Set TTM device beneficial_order to 9 (2M)")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/xe: Move xe->info.devid|revid initialization [+ + +]
Author: Michal Wajdeczko <michal.wajdeczko@intel.com>
Date:   Fri Jul 31 12:56:56 2026 -0400

    drm/xe: Move xe->info.devid|revid initialization
    
    [ Upstream commit c03d9fbe77ec5002a2345b9be464683e0b157709 ]
    
    The xe_info_init_early() is a place where we initialize those of
    the xe->info fields that do not require any additional hardware
    probes. Move the initialization of the devid/revid also there, but
    to avoid breaking the kunit helper, which also calls this function,
    keep their initialization separate in sub-function so we can easily
    stub it when running the kunit test.
    
    Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
    Cc: Gustavo Sousa <gustavo.sousa@intel.com>
    Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
    Link: https://patch.msgid.link/20260526195452.20545-5-michal.wajdeczko@intel.com
    Stable-dep-of: ba7fd1634228 ("drm/xe: Set TTM device beneficial_order to 9 (2M)")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/xe: Move xe->info.force_execlist initialization [+ + +]
Author: Michal Wajdeczko <michal.wajdeczko@intel.com>
Date:   Fri Jul 31 12:56:55 2026 -0400

    drm/xe: Move xe->info.force_execlist initialization
    
    [ Upstream commit f1d581bb50ed54b71a8121d3d46fe2627fddd147 ]
    
    The xe_info_init_early() is a place where we initialize those of
    the xe->info fields that do not require any additional hardware
    probes. Move the initialization of the force_execlist flag there.
    
    Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
    Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
    Link: https://patch.msgid.link/20260526195452.20545-4-michal.wajdeczko@intel.com
    Stable-dep-of: ba7fd1634228 ("drm/xe: Set TTM device beneficial_order to 9 (2M)")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/xe: Separate early xe_device initialization [+ + +]
Author: Michal Wajdeczko <michal.wajdeczko@intel.com>
Date:   Fri Jul 31 12:56:57 2026 -0400

    drm/xe: Separate early xe_device initialization
    
    [ Upstream commit 2841cea001b983db79dc1fdf160e65318dfda3cd ]
    
    We would like to initialize more of the xe_device struct also from
    the kunit code, as it should be safe to use most of the generic drm
    or xe components without doing any additional tweaks. Separate early
    xe initialization code to a new function, so it can be reused.
    
    Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
    Reviewed-by: Raag Jadav <raag.jadav@intel.com>
    Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
    Link: https://patch.msgid.link/20260526195452.20545-6-michal.wajdeczko@intel.com
    Stable-dep-of: ba7fd1634228 ("drm/xe: Set TTM device beneficial_order to 9 (2M)")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/xe: Set TTM device beneficial_order to 9 (2M) [+ + +]
Author: Matthew Brost <matthew.brost@intel.com>
Date:   Fri Jul 31 12:56:58 2026 -0400

    drm/xe: Set TTM device beneficial_order to 9 (2M)
    
    [ Upstream commit ba7fd163422877ad5a5cf31306a38c07d3932b0c ]
    
    Set the TTM device beneficial_order to 9 (2M), which is the sweet
    spot for Xe when attempting reclaim on system memory BOs, as it matches
    the large GPU page size. This ensures reclaim is attempted at the most
    effective order for the driver.
    
    This fixes an issue where an order-10 (4M) allocation cannot be found
    despite an abundance of memory. The 4M allocation triggers reclaim,
    unnecessarily evicting the working set and hurting performance. Since
    the TTM infrastructure was introduced recently, we are tagging the TTM
    patch as the Fixes target, even though this resolves an Xe-side problem.
    
    Fixes: 7e9c548d3709 ("drm/ttm: Allow drivers to specify maximum beneficial TTM pool size")
    Cc: stable@vger.kernel.org
    Signed-off-by: Matthew Brost <matthew.brost@intel.com>
    Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
    Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
    Link: https://patch.msgid.link/20260611235844.3725147-1-matthew.brost@intel.com
    (cherry picked from commit 0d81db90d364cb3d733410829118759f28957c5a)
    Signed-off-by: Matthew Brost <matthew.brost@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/xe: Wait on external BO kernel fences in exec IOCTL [+ + +]
Author: Matthew Brost <matthew.brost@intel.com>
Date:   Sat Aug 1 10:04:08 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: stable@vger.kernel.org
    Assisted-by: GitHub_Copilot:claude-opus-4.8
    Signed-off-by: Matthew Brost <matthew.brost@intel.com>
    Reviewed-by: Matthew Auld <matthew.auld@intel.com>
    Link: https://patch.msgid.link/20260702215805.4011228-1-matthew.brost@intel.com
    (cherry picked from commit a6b842acf3ddd1efc53a56de9260cfa718fb35e7)
    Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
    Signed-off-by: Sasha Levin <sashal@nvidia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
e1000: fix memory leak in e1000_probe() [+ + +]
Author: Dawei Feng <dawei.feng@seu.edu.cn>
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: stable@vger.kernel.org
    Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
    Signed-off-by: Dawei Feng <dawei.feng@seu.edu.cn>
    Reviewed-by: Dima Ruinskiy <dima.ruinskiy@intel.com>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
erofs: cap LZMA stream pool size [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
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: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
    Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
    Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

erofs: clean up erofs_ishare_fill_inode() [+ + +]
Author: Gao Xiang <xiang@kernel.org>
Date:   Mon Jun 8 01:21:32 2026 +0800

    erofs: clean up erofs_ishare_fill_inode()
    
    [ Upstream commit 1ccc75909ca7c3b52163b408a3e1eb5453db013f ]
    
     - Use the shorthand `si` to replace the overly long `sharedinode`;
    
     - Introduce erofs_warn() and get rid of barely-used _erofs_printk();
    
     - Get rid of the variable `hash`;
    
     - Simplify error paths.
    
    Reviewed-by: Hongbo Li <lihongbo22@huawei.com>
    Reviewed-by: Chao Yu <chao@kernel.org>
    Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
    Stable-dep-of: 96b2dbbe58a1 ("erofs: ensure valid f_path for page cache sharing")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

erofs: ensure valid f_path for page cache sharing [+ + +]
Author: Gao Xiang <xiang@kernel.org>
Date:   Mon Jul 27 12:27:39 2026 +0800

    erofs: ensure valid f_path for page cache sharing
    
    [ Upstream commit 96b2dbbe58a1ea5df8d29c2fe24b5f04715f4443 ]
    
    Previously, backing files for page cache sharing were set up with
    f_path left as NULL (only f_inode was valid).  It worked, but a recent
    mincore fix relies on f_path.mnt and crashes (found by "erofs/028" on
    7.2-rc4):
    
     BUG: kernel NULL pointer dereference, address: 0000000000000018
     #PF: supervisor read access in kernel mode
     #PF: error_code(0x0000) - not-present page
     PGD 0 P4D 0
     Oops: Oops: 0000 [#1] SMP PTI
     CPU: 3 UID: 0 PID: 675528 Comm: fincore Not tainted 7.2.0-rc4-00002-g[]-dirty #1 PREEMPT(lazy)
     Hardware name: Red Hat KVM, BIOS 1.16.0-4.al8 04/01/2014
     RIP: 0010:__do_sys_mincore+0xc0/0x2c0
     ...
    
    Specify valid paths using valid disconnected dentries together with
    erofs_ishare_mnt instead of leaving f_path empty, so they are more
    like real backing files in a pseudo filesystem and standard
    backing_file_open() can be used directly.
    
    Fixes: e187bc02f8fa ("mm: do file ownership checks with the proper mount idmap")
    Acked-by: Hongbo Li <hongbohbli@tencent.com>
    Signed-off-by: Gao Xiang <xiang@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

erofs: remove fscache backend entirely [+ + +]
Author: Gao Xiang <xiang@kernel.org>
Date:   Mon Jun 22 09:36:22 2026 +0800

    erofs: remove fscache backend entirely
    
    [ Upstream commit c37460cd9b2fcb61ec66b7eb4fde737e65ec2a56 ]
    
    EROFS over fscache was introduced to provide image lazy pulling
    functionality. After the feature landed, the fscache subsystem made
    netfs a new hard dependency, which is unexpected for a local filesystem
    and has an kernel-defined caching hierarchy which could be inflexible
    compared to the fanotify pre-content hooks. Therefore, this feature has
    been deprecated for almost two years.
    
    As EROFS file-backed mounts and fanotify pre-content hooks both upstream
    for a while and already providing equivalent functionality (erofs-utils
    has supported fanotify pre-content hooks), let's remove the fscache
    backend now.
    
    The main application of this feature is Nydus [1], and they plan to move
    to use fanotify pre-content hooks in the near future too.
    
    I hope this patch can be merged into Linux 7.2, which is also motivated
    by newly found implementation issues [2][3] that are not worth
    investigating given the deprecation and limited development resources.
    The associated fscache/cachefiles cleanup patch will follow separately
    through the vfs tree (netfs) later: it seems fine since the codebase is
    isolated by CONFIG_CACHEFILES_ONDEMAND.
    
    [1] https://github.com/dragonflyoss/nydus/blob/v2.1.0/docs/nydus-fscache.md
    [2] https://github.com/dragonflyoss/nydus/pull/1824
    [3] https://lore.kernel.org/r/20260619135800.1594811-1-michael.bommarito@gmail.com
    
    Acked-by: Jingbo Xu <jefflexu@linux.alibaba.com>
    Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
    Stable-dep-of: 96b2dbbe58a1 ("erofs: ensure valid f_path for page cache sharing")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ethtool: Embed FEC hist ranges as buffer in struct [+ + +]
Author: Eric Joyner <eric.joyner@amd.com>
Date:   Wed Jul 22 21:13:42 2026 -0700

    ethtool: Embed FEC hist ranges as buffer in struct
    
    [ Upstream commit 97ac08560d236ca17f6606d9e671118e5eae5721 ]
    
    When a driver's .get_fec_stats() handler is called and the driver
    supports FEC histogram stats, the driver supplies the histogram bin
    ranges via a pointer.  This pointer is assigned while under the netdev
    ops lock in fec_prepare_data(), but the actual data is only read after
    the lock is released; so this allows the driver to change the ranges
    (e.g. from another .get_fec_stats() call) while the current call chain
    is reading them in fec_fill_reply().
    
    Fix this by adding an ethtool core-owned buffer, ranges_buf, to struct
    ethtool_fec_hist. Drivers whose ranges are built dynamically (currently
    just mlx5) fill ranges_buf and then point the existing ranges pointer at
    it, giving ethtool a consistent copy that stays valid after the netdev
    ops lock is dropped and later in fec_fill_reply(). Drivers whose ranges
    are compile-time constants (bnxt, netdevsim) are unaffected by the
    potential race and keep setting the existing ranges pointer to their
    constant array, without making copies.
    
    Fixes: cc2f08129925 ("ethtool: add FEC bins histogram report")
    Signed-off-by: Eric Joyner <eric.joyner@amd.com>
    Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
    Link: https://patch.msgid.link/20260723041342.39238-1-eric.joyner@amd.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
forcedeth: fix UAF of txrx_stats in nv_remove [+ + +]
Author: Chenguang Zhao <zhaochenguang@kylinos.cn>
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 <zhaochenguang@kylinos.cn>
    Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
    Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev>
    Link: https://patch.msgid.link/20260723092637.2135095-1-chenguang.zhao@linux.dev
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
fortify: Disable -Wstringop-overread in tests [+ + +]
Author: Nathan Chancellor <nathan@kernel.org>
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: stable@vger.kernel.org
    Closes: https://github.com/ClangBuiltLinux/linux/issues/2168
    Link: https://github.com/llvm/llvm-project/commit/86f2e71cb8d165b59ad31a442b2391e23826133e [1]
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Link: https://patch.msgid.link/20260623-fix-test_fortify-for-clang-stringop-overread-v1-1-15ee8342a953@kernel.org
    Signed-off-by: Kees Cook <kees@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
fou: Fix use-after-free in fou_create() [+ + +]
Author: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
Date:   Wed Jul 22 16:38:58 2026 +0800

    fou: Fix use-after-free in fou_create()
    
    commit b14361aca6350ff7907b0e9903c7b94dc7d5d4a0 upstream.
    
    fou_create() publishes struct fou through sk_user_data before adding the
    new FOU port to the per-netns list.  If fou_add_to_port_list() fails,
    the error path frees fou while it is still reachable through
    sk_user_data.  A concurrent receive can then dereference the freed
    object in fou_from_sock().
    
    This ordering issue was previously noted in the linked discussion.
    
    The failure is reachable when local port 0 is requested.  Each socket
    binds to a different ephemeral port, but fou_cfg_cmp() compares the
    requested port 0 and reports -EALREADY once an entry already exists.
    
    Release the tunnel socket before freeing fou so sk_user_data is cleared
    first, and defer reclamation with kfree_rcu() to protect concurrent RCU
    readers.  This matches the lifetime handling in fou_release().
    
    Fixes: 23461551c006 ("fou: Support for foo-over-udp RX path")
    Suggested-by: Kuniyuki Iwashima <kuniyu@google.com>
    Link: https://lore.kernel.org/netdev/20260502031401.3557229-12-kuniyu@google.com/
    Cc: stable@vger.kernel.org
    Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
    Link: https://patch.msgid.link/20260722083858.182506-1-xuanqiang.luo@linux.dev
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
fprobe: Fix module reference count leak on error in register_fprobe() [+ + +]
Author: Masami Hiramatsu (Google) <mhiramat@kernel.org>
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) <mhiramat@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
fs/proc/task_mmu: fix PAGEMAP_SCAN written state for PMD holes [+ + +]
Author: Kiryl Shutsemau (Meta) <kas@kernel.org>
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/20260715144234.442721-2-kirill@shutemov.name
    Fixes: 2bad466cc9d9 ("mm/uffd: UFFD_FEATURE_WP_UNPOPULATED")
    Signed-off-by: Kiryl Shutsemau <kas@kernel.org>
    Reported-by: Sashiko AI review <sashiko-bot@kernel.org>
    Closes: https://sashiko.dev/#/patchset/20260707151349.92143-1-kirill@shutemov.name
    Tested-by: Muhammad Usama Anjum <usama.anjum@arm.com>
    Acked-by: David Hildenbrand (Arm) <david@kernel.org>
    Cc: Peter Xu <peterx@redhat.com>
    Cc: Jann Horn <jannh@google.com>
    Cc: Liam R. Howlett <liam@infradead.org>
    Cc: Lorenzo Stoakes <ljs@kernel.org>
    Cc: Michal Hocko <mhocko@suse.com>
    Cc: Mike Rapoport <rppt@kernel.org>
    Cc: Pedro Falcato <pfalcato@suse.de>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Suren Baghdasaryan <surenb@google.com>
    Cc: Vlastimil Babka <vbabka@kernel.org>
    Cc: Zenghui Yu <zenghui.yu@linux.dev>
    Assisted-by: Claude:claude-fable-5
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

fs/proc/task_mmu: fix PAGEMAP_SCAN written state for unpopulated ptes [+ + +]
Author: Kiryl Shutsemau (Meta) <kas@kernel.org>
Date:   Tue Jul 7 16:13:49 2026 +0100

    fs/proc/task_mmu: fix PAGEMAP_SCAN written state for unpopulated ptes
    
    commit 07b4377bdbe74a3ec0c8da5849d014f70e003384 upstream.
    
    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/20260707151349.92143-1-kirill@shutemov.name
    Fixes: 12f6b01a0bcb ("fs/proc/task_mmu: add fast paths to get/clear PAGE_IS_WRITTEN flag")
    Signed-off-by: Kiryl Shutsemau <kas@kernel.org>
    Cc: Muhammad Usama Anjum <usama.anjum@collabora.com>
    Cc: David Hildenbrand <david@kernel.org>
    Cc: Jann Horn <jannh@google.com>
    Cc: Liam R. Howlett <liam@infradead.org>
    Cc: Lorenzo Stoakes <ljs@kernel.org>
    Cc: Michal Hocko <mhocko@suse.com>
    Cc: Mike Rapoport <rppt@kernel.org>
    Cc: Pedro Falcato <pfalcato@suse.de>
    Cc: Peter Xu <peterx@redhat.com>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Suren Baghdasaryan <surenb@google.com>
    Cc: Vlastimil Babka <vbabka@kernel.org>
    Assisted-by: Claude:claude-fable-5
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
gpio: gpio-by-pinctrl: Apply initial value in direction output wrapper [+ + +]
Author: Alex Tran <alex.tran@oss.qualcomm.com>
Date:   Fri Jul 24 09:42:28 2026 -0700

    gpio: gpio-by-pinctrl: Apply initial value in direction output wrapper
    
    [ Upstream commit 67ff4bf723c8bd1f1b10450fa3e8f55762418104 ]
    
    After successfully configuring gpio pin as output, set the
    requested initial output value via the existing gpio set
    wrapper, so that the pin is not left at its previous level.
    
    Fixes: 7671f4949a6c ("gpio: gpio-by-pinctrl: add pinctrl based generic GPIO driver")
    Signed-off-by: Alex Tran <alex.tran@oss.qualcomm.com>
    Reviewed-by: Linus Walleij <linusw@kernel.org>
    Link: https://patch.msgid.link/20260724-gpio-pinctrl-output-set-val-v2-1-cad55d025636@oss.qualcomm.com
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

gpio: pca953x: fix cache_only and IRQ state on restore_context() failure [+ + +]
Author: bui duc phuc <phucduc.bui@gmail.com>
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: stable@vger.kernel.org
    Reviewed-by: Linus Walleij <linusw@kernel.org>
    Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
    Link: https://patch.msgid.link/20260727080205.16353-1-phucduc.bui@gmail.com
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

gpio: pch: use raw_spinlock_t for the register lock [+ + +]
Author: Junjie Cao <junjie.cao@intel.com>
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: stable@vger.kernel.org
    Signed-off-by: Junjie Cao <junjie.cao@intel.com>
    Reviewed-by: Linus Walleij <linusw@kernel.org>
    Link: https://patch.msgid.link/20260723014129.1129730-1-junjie.cao@intel.com
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

gpio: sloppy-logic-analyzer: Fix memory leak in gpio_la_poll_probe() [+ + +]
Author: Abdun Nihaal <nihaal@cse.iitm.ac.in>
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 <nihaal@cse.iitm.ac.in>
    Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
    Link: https://patch.msgid.link/20260715075311.527753-1-nihaal@cse.iitm.ac.in
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
gpiolib: tolerate gpio-hogs lacking a hogging state [+ + +]
Author: Daniel Golle <daniel@makrotopia.org>
Date:   Tue Jul 14 00:30:53 2026 +0100

    gpiolib: tolerate gpio-hogs lacking a hogging state
    
    commit e1cc8fa0fb9e5112d15f2c310b68ac316981c06c upstream.
    
    Commit d1d564ec4992 ("gpio: move hogs into GPIO core") made
    gpiochip_add_hog() return -EINVAL for hog nodes lacking any of the
    'input', 'output-low' or 'output-high' properties. The error is
    propagated by gpiochip_hog_lines() and fails registration of the
    whole GPIO chip.
    
    The previous OF-specific implementation tolerated such nodes:
    of_parse_own_gpio() warned "no hogging state specified, bailing out"
    and of_gpiochip_add_hog() stopped processing the node without failing
    chip registration.
    
    Some boards deliberately ship hog nodes without a hogging state in
    their base devicetree and supply the state via overlay, e.g. the PCIe
    slot key selection hogs on the BananaPi R4 Pro added in
    commit e309fa232d12 ("arm64: dts: mediatek: mt7988a-bpi-r4pro: rework
    pcie gpio-hog handling"), as the polarity set in the base devicetree
    could not be overridden from an overlay.
    
    Booting such a board without an overlay applied now fails to register
    the gpiochip. On the BananaPi R4 Pro this means the MT7988A pinctrl
    device fails to probe, all peripherals including the console UART
    defer forever, and the board finally hangs when clk_disable_unused()
    gates the clocks of the UART still in use by earlycon:
    
      gpiochip_add_data_with_key: GPIOs 512..595 (pinctrl_moore) failed to register, -22
      mt7988-pinctrl 1001f000.pinctrl: error -EINVAL: Failed to add gpio_chip
      ...
      clk: Disabling unused clocks
      (hangs)
    
    Restore the previous behaviour by warning about hog nodes lacking a
    hogging state and skipping them instead of failing the registration
    of the whole GPIO chip.
    
    Fixes: d1d564ec4992 ("gpio: move hogs into GPIO core")
    Cc: stable@vger.kernel.org
    Signed-off-by: Daniel Golle <daniel@makrotopia.org>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Link: https://patch.msgid.link/4c67cf0839ccf57db35a826df6d8fc779531509a.1783974733.git.daniel@makrotopia.org
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
hwmon: (adt7470) Fix busy-loop and I2C flooding in update thread [+ + +]
Author: Luiz Angelo Daros de Luca <luizluca@gmail.com>
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: sashiko-bot@kernel.org
    Closes: https://lore.kernel.org/r/20260716213252.EACA71F000E9@smtp.kernel.org
    Fixes: 89fac11cb3e7 ("adt7470: make automatic fan control really work")
    Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
    Link: https://lore.kernel.org/r/20260727-adt7470_fixes-v2-3-598e38a46ba6@gmail.com
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

hwmon: (adt7470) Fix cache updated before hardware write on I2C error [+ + +]
Author: Luiz Angelo Daros de Luca <luizluca@gmail.com>
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 <luizluca@gmail.com>
    Link: https://lore.kernel.org/r/20260727-adt7470_fixes-v2-2-598e38a46ba6@gmail.com
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

hwmon: (adt7470) Fix divide-by-zero TOCTOU crash in fan speed read [+ + +]
Author: Luiz Angelo Daros de Luca <luizluca@gmail.com>
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: sashiko-bot@kernel.org
    Closes: https://lore.kernel.org/r/20260727034929.E29B71F000E9@smtp.kernel.org/
    Fixes: fc958a61ff6d ("hwmon: (adt7470) Convert to devm_hwmon_device_register_with_info API")
    Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
    Link: https://lore.kernel.org/r/20260727-adt7470_fixes-v2-7-598e38a46ba6@gmail.com
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

hwmon: (adt7470) Fix fans stuck in manual mode on I2C errors [+ + +]
Author: Luiz Angelo Daros de Luca <luizluca@gmail.com>
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: sashiko-bot@kernel.org
    Closes: https://lore.kernel.org/r/20260716213252.EACA71F000E9@smtp.kernel.org
    Fixes: ef67959c4253 ("hwmon: (adt7470) Convert to use regmap")
    Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
    Link: https://lore.kernel.org/r/20260727-adt7470_fixes-v2-1-598e38a46ba6@gmail.com
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

hwmon: (adt7470) Fix PWM auto temp state array and bounds check [+ + +]
Author: Luiz Angelo Daros de Luca <luizluca@gmail.com>
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: sashiko-bot@kernel.org
    Closes: https://lore.kernel.org/all/20260727034932.0B7C41F000E9@smtp.kernel.org/#t
    Fixes: 6f9703d0be16 ("hwmon: add support for adt7470")
    Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
    Link: https://lore.kernel.org/r/20260727-adt7470_fixes-v2-8-598e38a46ba6@gmail.com
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

hwmon: (adt7470) Fix swapped PWM3 and PWM4 auto mode masks [+ + +]
Author: Luiz Angelo Daros de Luca <luizluca@gmail.com>
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 <luizluca@gmail.com>
    Link: https://lore.kernel.org/r/20260727-adt7470_fixes-v2-4-598e38a46ba6@gmail.com
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

hwmon: (adt7470) Fix temperature alarm logic in hwmon_temp_read() [+ + +]
Author: Luiz Angelo Daros de Luca <luizluca@gmail.com>
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: sashiko-bot@kernel.org
    Closes: https://lore.kernel.org/r/20260717211224.B9E291F000E9@smtp.kernel.org
    Fixes: fc958a61ff6d ("hwmon: (adt7470) Convert to devm_hwmon_device_register_with_info API")
    Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
    Link: https://lore.kernel.org/r/20260727-adt7470_fixes-v2-5-598e38a46ba6@gmail.com
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

hwmon: (adt7470) Use cached PWM frequency value [+ + +]
Author: Luiz Angelo Daros de Luca <luizluca@gmail.com>
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 <luizluca@gmail.com>
    Link: https://lore.kernel.org/r/20260727-adt7470_fixes-v2-6-598e38a46ba6@gmail.com
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

hwmon: (ina2xx) Fix various overflow issues [+ + +]
Author: Guenter Roeck <linux@roeck-us.net>
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 <loic.poulain@oss.qualcomm.com>
    Fixes: ab7fbee452be ("hwmon: (ina2xx) Fix various overflow issues")
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

hwmon: (lm90) Only report alarms if driver is ready [+ + +]
Author: Guenter Roeck <linux@roeck-us.net>
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 <sashiko-bot@kernel.org>
    Fixes: f6d0775119fb9 ("hwmon: (lm90) Rework alarm/status handling")
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

hwmon: (ltc4282) Fix reading the minimum alarm voltage [+ + +]
Author: Guenter Roeck <linux@roeck-us.net>
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 <nuno.sa@analog.com>
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

hwmon: (nct6775-core) Fix number of temperature registers for NCT6116 [+ + +]
Author: Guenter Roeck <linux@roeck-us.net>
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 <florian.bezdeka@siemens.com>
    Closes: https://lore.kernel.org/linux-hwmon/57cfc3fa-d4e9-4c10-8aa7-4ad0af7ebebe@roeck-us.net/T/#t
    Fixes: 29c7cb485b32 ("hwmon: (nct6775) Integrate new model nct6116")
    Cc: Björn Gerhart <gerhart@posteo.de>
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

hwmon: (nct6775-core) Prevent access to unsupported weight registers [+ + +]
Author: Guenter Roeck <linux@roeck-us.net>
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 <sashiko-bot@kernel.org>
    Fixes: 29c7cb485b32 ("hwmon: (nct6775) Integrate new model nct6116")
    Cc: Björn Gerhart <gerhart@posteo.de>
    Cc: Florian Bezdeka <florian.bezdeka@siemens.com>
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

hwmon: (npcm750-pwm-fan): stop fan timer on device detach [+ + +]
Author: Hongyan Xu <getshell@seu.edu.cn>
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: stable@vger.kernel.org
    Signed-off-by: Hongyan Xu <getshell@seu.edu.cn>
    Link: https://lore.kernel.org/r/20260729100116.790-1-getshell@seu.edu.cn
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

hwmon: (nzxt-smart2) DMA-align output buffer [+ + +]
Author: Guenter Roeck <linux@roeck-us.net>
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 <sashiko-bot@kernel.org>
    Fixes: 53e68c20aeb1 ("hwmon: add driver for NZXT RGB&Fan Controller/Smart Device v2.")
    Cc: Aleksandr Mezin <mezin.alexander@gmail.com>
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

hwmon: (pmbus) Fix return value from pmbus_update_byte_data() [+ + +]
Author: Guenter Roeck <linux@roeck-us.net>
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 <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

hwmon: (pmbus/core) notify on the hwmon device, not the i2c client [+ + +]
Author: Vincent Jardin <vjardin@free.fr>
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: stable@vger.kernel.org # v6.4+
    Signed-off-by: Vincent Jardin <vjardin@free.fr>
    Link: https://lore.kernel.org/r/20260723-fix_hwmon_notify_v1-v1-1-5a24c528686d@free.fr
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

hwmon: (sht3x) Fix unaligned accesses [+ + +]
Author: Guenter Roeck <linux@roeck-us.net>
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 <sashiko-bot@kernel.org>
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
i2c: amd-mp2: Unregister callback on adapter add failure [+ + +]
Author: Myeonghun Pak <mhun512@gmail.com>
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 <ae878000@gmail.com>
    Signed-off-by: Ijae Kim <ae878000@gmail.com>
    Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
    Cc: <stable@vger.kernel.org> # v5.2+
    Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
    Link: https://lore.kernel.org/r/20260721144147.31150-1-mhun512@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

i2c: imx: Cancel hrtimer before clearing slave pointer [+ + +]
Author: Liem <liem16213@gmail.com>
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 <liem16213@gmail.com>
    Cc: <stable@vger.kernel.org> # v5.11+
    Acked-by: Carlos Song <carlos.song@nxp.com>
    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
    Link: https://lore.kernel.org/r/20260629023829.152651-3-liem16213@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

i2c: imx: Fix slave registration race and error handling [+ + +]
Author: Liem <liem16213@gmail.com>
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 <liem16213@gmail.com>
    Cc: <stable@vger.kernel.org> # v5.11+
    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Acked-by: Carlos Song <carlos.song@nxp.com>
    Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
    Link: https://lore.kernel.org/r/20260629023829.152651-2-liem16213@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

i2c: imx: mark I2C adapter when hardware is powered down [+ + +]
Author: Carlos Song <carlos.song@nxp.com>
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 <carlos.song@nxp.com>
    Cc: <stable@vger.kernel.org> # v6.14+
    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
    Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
    Link: https://lore.kernel.org/r/20260525030400.3182911-1-carlos.song@oss.nxp.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

i2c: iproc: reset bus after timeout if START_BUSY is stuck [+ + +]
Author: Jonas Gorski <jonas.gorski@bisdn.de>
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 <jonas.gorski@bisdn.de>
    Cc: <stable@vger.kernel.org> # v4.0+
    Acked-by: Ray Jui <ray.jui@broadcom.com>
    Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
    Link: https://lore.kernel.org/r/20260717085507.34209-1-jonas.gorski@bisdn.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

i2c: jz4780: Cache host clock rate at probe to prevent CCF prepare_lock deadlock [+ + +]
Author: H. Nikolaus Schaller <hns@goldelico.com>
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 <hns@goldelico.com>
    Cc: <stable@vger.kernel.org> # v4.1+
    Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
    Link: https://lore.kernel.org/r/2db6fd233aceb7238474e4833f4d25ca681c3ffb.1784492382.git.hns@goldelico.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

i2c: qcom-cci: drop custom suspend/resume and rely on runtime PM helpers [+ + +]
Author: Wenmeng Liu <wenmeng.liu@oss.qualcomm.com>
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 <wenmeng.liu@oss.qualcomm.com>
    Cc: <stable@vger.kernel.org> # v5.8+
    Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Reviewed-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
    Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
    Link: https://lore.kernel.org/r/20260625-cci-v1-1-a100cda673ce@oss.qualcomm.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

i2c: spacemit: request IRQ after controller initialization [+ + +]
Author: Linmao Li <lilinmao@kylinos.cn>
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 <lilinmao@kylinos.cn>
    Cc: <stable@vger.kernel.org> # v6.15+
    Reviewed-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
    Reviewed-by: Alex Elder <elder@riscstar.com>
    Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
    Link: https://lore.kernel.org/r/20260723021140.2293844-1-lilinmao@kylinos.cn
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ice: fix memory leak in ice_lbtest_prepare_rings() [+ + +]
Author: Dawei Feng <dawei.feng@seu.edu.cn>
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: stable@vger.kernel.org
    Signed-off-by: Dawei Feng <dawei.feng@seu.edu.cn>
    Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
    Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel)
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ice: fix VF interrupts cleanup [+ + +]
Author: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>
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: stable@vger.kernel.org
    Fixes: 1071a8358a28 ("ice: Implement virtchnl commands for AVF support")
    Suggested-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
    Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
    Signed-off-by: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Tested-by: Patryk Holda <patryk.holda@intel.com>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ice: suppress DPLL errors during reset recovery [+ + +]
Author: Przemyslaw Korba <przemyslaw.korba@intel.com>
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 <przemyslaw.korba@intel.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel)
    Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ice: wait for reset completion in ice_resume() [+ + +]
Author: Aaron Ma <aaron.ma@canonical.com>
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: stable@vger.kernel.org
    Reviewed-by: Kohei Enju <kohei@enjuk.jp>
    Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
    Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
    Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
    Tested-by: Alexander Nowlin <alexander.nowlin@intel.com>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
idpf: adjust TxQ ring count minimum [+ + +]
Author: Joshua Hay <joshua.a.hay@intel.com>
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 <joshua.a.hay@intel.com>
    Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
    Tested-by: Samuel Salin <Samuel.salin@intel.com>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

idpf: bound interrupt-vector register fill to the allocated array [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
Date:   Wed Jun 17 17:57:54 2026 -0400

    idpf: bound interrupt-vector register fill to the allocated array
    
    [ Upstream commit 9f7007ee9858c99aa43101bc8352c672fee85644 ]
    
    idpf_get_reg_intr_vecs() fills the caller-allocated reg_vals[] array from
    the VIRTCHNL2_OP_ALLOC_VECTORS reply in adapter->req_vec_chunks, bounding
    its inner loop only by the per-chunk num_vectors. The array is sized
    separately: idpf_intr_reg_init() allocates
    kzalloc_objs(struct idpf_vec_regs, total_vecs) from
    caps.num_allocated_vectors and only checks the returned count after the
    fill. The sum of per-chunk num_vectors is never reconciled against
    total_vecs, so a reply with a small num_allocated_vectors but chunks
    summing higher writes past the end of reg_vals[].
    
    Impact: a control plane (a PF or hypervisor device model) that returns a
    VIRTCHNL2_OP_ALLOC_VECTORS reply whose per-chunk num_vectors sum exceeds
    num_allocated_vectors writes struct idpf_vec_regs entries past the end of
    the reg_vals kmalloc allocation (KASAN slab-out-of-bounds write).
    
    Bound the fill loop to the array capacity passed in by the callers,
    mirroring the sibling idpf_vport_get_q_reg(). The existing
    num_regs < num_vecs check then rejects an undersized reply without the
    out-of-bounds write happening first.
    
    Fixes: d4d558718266 ("idpf: initialize interrupts and enable vport")
    Assisted-by: Claude:claude-opus-4-7
    Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
    Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
    Tested-by: Samuel Salin <Samuel.salin@intel.com>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

idpf: Fix mailbox IRQ name leak on request failure [+ + +]
Author: Yuho Choi <dbgh9129@gmail.com>
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 <dbgh9129@gmail.com>
    Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
    Tested-by: Samuel Salin <Samuel.salin@intel.com>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
igbvf: Fix leak in TX DMA error cleanup [+ + +]
Author: Matt Vollrath <tactii@gmail.com>
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: stable@vger.kernel.org
    Assisted-by: Claude:claude-4-7-opus
    Signed-off-by: Matt Vollrath <tactii@gmail.com>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
igc: remove napi_synchronize() in igc_down() [+ + +]
Author: David Carlier <devnexen@gmail.com>
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 <maciej.fijalkowski@intel.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: David Carlier <devnexen@gmail.com>
    Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
    Reviewed-by: Dima Ruinskiy <dima.ruinskiy@intel.com>
    Tested-by: Moriya Kadosh <moriyax.kadosh@intel.com>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
io_uring/net: initialize mshot_len for send [+ + +]
Author: Jens Axboe <axboe@kernel.dk>
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: stable@vger.kernel.org
    Reported-by: Sung Keum <kambodi127@gmail.com>
    Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
io_uring: preserve task restrictions across exec [+ + +]
Author: Kyumin Lee <fyonglkm@gmail.com>
Date:   Fri Jul 31 04:27:34 2026 +0900

    io_uring: preserve task restrictions across exec
    
    commit bc0e8faf90e776a2f1f3967a04e8091e6bdb4977 upstream.
    
    Per-task restrictions apply to all rings created by a task. Once
    installed, they should not be dropped across exec.
    
    For a task that has used io_uring, the exec cancellation path calls
    __io_uring_free(). This frees both the task context and the per-task
    restriction, so a ring created after exec is unrestricted.
    
    Split task context cleanup into io_uring_free_tctx(), and use it from
    the exec cancellation path. Keep __io_uring_free() for final task
    cleanup, where both the context and restriction are released.
    
    Fixes: ed82f35b926b ("io_uring: allow registration of per-task restrictions")
    Cc: stable@vger.kernel.org # 7.1+
    Signed-off-by: Kyumin Lee <fyonglkm@gmail.com>
    Link: https://patch.msgid.link/20260730192734.459247-1-fyonglkm@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
iomap: add a separate bio_set for iomap_split_ioend [+ + +]
Author: Christoph Hellwig <hch@lst.de>
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 <brauner@kernel.org> 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 <hch@lst.de>
    Link: https://patch.msgid.link/20260629125229.3400726-1-hch@lst.de
    Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
iommu/arm-smmu-v3-iommufd: Require exactly one Stream ID for a vDEVICE [+ + +]
Author: Nicolin Chen <nicolinc@nvidia.com>
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 <kevin.tian@intel.com>
    Assisted-by: Claude:claude-opus-4-8
    Reviewed-by: Pranjal Shrivastava <praan@google.com>
    Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
iommu/iommufd: Fix IOPF group ownership UAF [+ + +]
Author: Peiyang He <peiyang_he@smail.nju.edu.cn>
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: stable@vger.kernel.org
    Tested-by: Peiyang He <peiyang_he@smail.nju.edu.cn>
    Assisted-by: Codex:gpt-5.6-sol
    Signed-off-by: Peiyang He <peiyang_he@smail.nju.edu.cn>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
iommufd/viommu: Publish a vDEVICE only after vdevice_init() succeeds [+ + +]
Author: Nicolin Chen <nicolinc@nvidia.com>
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: stable@vger.kernel.org
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Assisted-by: Claude:claude-opus-4-8
    Reviewed-by: Pranjal Shrivastava <praan@google.com>
    Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iommufd/viommu: Release the igroup lock on the vdevice_size error path [+ + +]
Author: Nicolin Chen <nicolinc@nvidia.com>
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: stable@vger.kernel.org
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Assisted-by: Claude:claude-opus-4-8
    Reviewed-by: Pranjal Shrivastava <praan@google.com>
    Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
iommufd: Fix wrong hwpt passed to iommufd_auto_response_faults on replace [+ + +]
Author: Peiyang He <peiyang_he@smail.nju.edu.cn>
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: stable@vger.kernel.org
    Signed-off-by: Peiyang He <peiyang_he@smail.nju.edu.cn>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iommufd: Reject DMABUF pages from the access pin path [+ + +]
Author: Peiyang He <peiyang_he@smail.nju.edu.cn>
Date:   Thu Jul 9 13:08:00 2026 +0800

    iommufd: Reject DMABUF pages from the access pin path
    
    commit 5f3fc0ad9a41883a62098359b9fdbe4257f20e53 upstream.
    
    DMABUF pages are not supported for iommufd access pinning.
    iommufd_access_pin_pages() returns struct page pointers for
    in-kernel CPU access, but DMABUF-backed iopt_pages do not carry
    a userspace address that can be passed to the GUP path.
    
    iopt_pages_rw_access() already rejects IOPT_ADDRESS_DMABUF before doing
    CPU access. Apply the same rejection to iopt_area_add_access() before it
    takes pages->mutex and calls iopt_pages_fill_xarray().
    Otherwise a DMABUF-backed iopt_pages can reach the hole-fill path, where
    pfn_reader_user_pin() interprets the union as uptr and
    calls pin_user_pages_fast()/pin_user_pages_remote().
    
    This fix also avoids the lockdep warning reported from that path, where
    pages_dmabuf_mutex_key is held while gup_fast_fallback() may acquire
    mmap_lock.
    
    Link: https://patch.msgid.link/r/CD68F549BF3761B7+20260709050800.520607-1-peiyang_he@smail.nju.edu.cn
    Reported-by: Peiyang He <peiyang_he@smail.nju.edu.cn>
    Closes: https://lore.kernel.org/all/E8540D7D05768C91+8b2ef227-3368-494e-909d-7b28e1489dfb@smail.nju.edu.cn/
    Fixes: 71db84a092c3 ("iommufd: Add DMABUF to iopt_pages")
    Cc: stable@vger.kernel.org
    Tested-by: Peiyang He <peiyang_he@smail.nju.edu.cn>
    Signed-off-by: Peiyang He <peiyang_he@smail.nju.edu.cn>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ipv6: release fib6_null_entry on subtree failure [+ + +]
Author: Shuangpeng Bai <shuangpeng.kernel@gmail.com>
Date:   Mon Jul 27 14:53:39 2026 -0400

    ipv6: release fib6_null_entry on subtree failure
    
    [ Upstream commit 93cad1f6bd1e27c75c4a5ab000c2a2fc01181ccf ]
    
    When adding a source-specific route creates a new subtree, fib6_add()
    installs fib6_null_entry as the temporary leaf of the new subtree root
    and takes a fib6_info reference for that holder.
    
    If adding the first source leaf fails, the code frees the just allocated
    subtree root but leaves that hold behind. fib6_null_entry is a per-netns
    sentinel and is freed directly at netns teardown, so this does not keep
    the object alive. However, it leaves its visible refcount permanently
    elevated and can eventually saturate the refcount on repeated failures.
    
    Drop the null-entry reference before freeing the unlinked subtree root.
    
    Fixes: 5ea715289af6 ("ipv6: broadly use fib6_info_hold() helper")
    Signed-off-by: Shuangpeng Bai <shuangpeng.kernel@gmail.com>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Link: https://patch.msgid.link/20260727185339.1545169-1-shuangpeng.kernel@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ipvs: adjust double hashing when fwd method changes [+ + +]
Author: Julian Anastasov <ja@ssi.bg>
Date:   Mon Jul 13 19:52:33 2026 +0800

    ipvs: adjust double hashing when fwd method changes
    
    [ Upstream commit 712d2993bea555f1f09cd53cbdb25714f28e85db ]
    
    Synced conns can be created with one forwarding method
    and later updated with different one after the dest
    server is configured. This needs adjusting the hashing
    for node hn1 because only MASQ supports double hashing.
    
    Modify conn_tab_lock() to support seeking for hash node
    hn0 together with adding for hn1. By this way we can
    safely modify the forwarding method and hn1.hash_key
    under bucket lock for the first node hn0. The forwarding
    method is also protected by cp->lock as it is part of
    cp->flags.
    
    Fix the usage of stale idx/idx2 values in conn_tab_lock
    after jumping to the retry label. Instead, use idx/idx2
    values just to order the locking for the old/new tables.
    
    Reported-by: Zhiling Zou <roxy520tt@gmail.com>
    Link: https://patch.msgid.link/1b914f41d725bc064c9ba9830dc8169329737270.1782540466.git.roxy520tt@gmail.com/
    Link: https://sashiko.dev/#/patchset/CALMqdkR704S2BG_QD_bgHTFp2%2B1QCi7n0T4zoZyTo8mDZevYSA%40mail.gmail.com
    Fixes: f20c73b0460d ("ipvs: use more keys for connection hashing")
    Signed-off-by: Julian Anastasov <ja@ssi.bg>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ipvs: clear the nfct flag under lock [+ + +]
Author: Julian Anastasov <ja@ssi.bg>
Date:   Wed Jul 22 13:25:39 2026 +0300

    ipvs: clear the nfct flag under lock
    
    [ Upstream commit da7d894c41d5910daae2b8ffa024c52ff0a4df6a ]
    
    Sashiko warns that cp->flags should be changed under cp->lock
    
    Fixes: 35dfb013149f ("ipvs: queue delayed work to expire no destination connections if expire_nodest_conn=1")
    Fixes: f0a5e4d7a594 ("ipvs: allow connection reuse for unconfirmed conntrack")
    Link: https://sashiko.dev/#/patchset/CALMqdkR704S2BG_QD_bgHTFp2%2B1QCi7n0T4zoZyTo8mDZevYSA%40mail.gmail.com
    Signed-off-by: Julian Anastasov <ja@ssi.bg>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ipvs: do not mangle ICMP replies for non-first fragments [+ + +]
Author: Julian Anastasov <ja@ssi.bg>
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 <ja@ssi.bg>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ipvs: do not propagate one-packet flag to synced conns [+ + +]
Author: Zhiling Zou <roxy520tt@gmail.com>
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: stable@vger.kernel.org
    Reported-by: Yuan Tan <yuantan098@gmail.com>
    Reported-by: Yifan Wu <yifanwucs@gmail.com>
    Reported-by: Juefei Pu <tomapufckgml@gmail.com>
    Reported-by: Xin Liu <bird@lzu.edu.cn>
    Suggested-by: Julian Anastasov <ja@ssi.bg>
    Signed-off-by: Zhiling Zou <roxy520tt@gmail.com>
    Signed-off-by: Ren Wei <n05ec@lzu.edu.cn>
    Acked-by: Julian Anastasov <ja@ssi.bg>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ipvs: fix places with wrong packet offsets [+ + +]
Author: Julian Anastasov <ja@ssi.bg>
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 <ja@ssi.bg>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ipvs: fix the checksum validations [+ + +]
Author: Julian Anastasov <ja@ssi.bg>
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 <ja@ssi.bg>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
kbuild: Stop modifying $(objtree)/Makefile when building oot-kmods oos [+ + +]
Author: Nicolas Schier <n.schier@fritz.com>
Date:   Thu Jul 23 12:58:45 2026 +0200

    kbuild: Stop modifying $(objtree)/Makefile when building oot-kmods oos
    
    commit 39d6e68f50f4a444a6ba23b9ea2eaee806601c6d upstream.
    
    Update output Makefile in the corresponding tree only: for out-of-source
    in-tree builds update $(objtree)/Makefile, for out-of-source out-of-tree
    module builds update $(KBUILD_EXTMOD_OUTPUT)/Makefile instead.
    
    In-source builds are not affected.
    
    Since commit c9bb03ac2c66 ("kbuild: reduce output spam when building out
    of tree"), building out-of-tree kernel modules out-of-source (make M=...
    MO=...) causes a rewrite of $(objtree)/Makefile with KBUILD_EXTMOD and
    KBUILD_EXTMOD_OUTPUT being set.  That is problematic:
    
     * $(objtree)/ must not be changed in any way when building out-of-tree
       modules as it breaks other uses of $(objtree).
    
     * Setting KBUILD_EXTMOD and KBUILD_EXTMOD_OUTPUT in $(objtree)/Makefile
       kills the tree for incremental builds that start right there
       ('make -C $(objtree)'); builds starting in $(srctree) reset
       $(objtree)/Makefile to its original content.
    
    Further, $(KBUILD_EXTMOD_OUTPUT)/Makefile was not generated any more at
    all.
    
    This commit restores the previous kbuild behaviour prior to commit
    c9bb03ac2c66 ("kbuild: reduce output spam when building out of tree")
    but leaves in-place the use of filechk for output spam reduction.
    
    Fixes: c9bb03ac2c66 ("kbuild: reduce output spam when building out of tree")
    Reported-by: Anish Rashinkar <rashinkar.anish@gmail.com>
    Closes: https://lore.kernel.org/r/CAOESE2Q2-0KUDaM0mUo+c_F-tMaUsBZ-gpnhdoe0rmYdgnnuJQ@mail.gmail.com
    Cc: stable@vger.kernel.org
    Tested-by: Philipp Hahn <p.hahn@avm.de>
    Reviewed-by: Philipp Hahn <p.hahn@avm.de>
    Signed-off-by: Nicolas Schier <n.schier@fritz.com>
    Signed-off-by: Nicolas Schier <nsc@kernel.org>
    Link: https://patch.msgid.link/20260723105845.1704689-2-nsc@kernel.org
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
keys: fix out-of-bounds read in keyring_get_key_chunk() [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
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 <michael.bommarito@gmail.com>
    Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
    Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
    Link: https://lore.kernel.org/r/20260719161505.2423935-2-michael.bommarito@gmail.com
    Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

keys: make keyring key-chunk byte order agree with keyring_diff_objects() [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
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 <michael.bommarito@gmail.com>
    Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
    Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
    Link: https://lore.kernel.org/r/20260719161505.2423935-3-michael.bommarito@gmail.com
    Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
KEYS: trusted: dcp: fix key_len validation and calc_blob_len() return type [+ + +]
Author: Fabrice Derepas <fabrice.derepas@canonical.com>
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 <fabrice.derepas@canonical.com>
    Reviewed-by: David Gstir <david@sigma-star.at>
    Reviewed-by: Richard Weinberger <richard@nod.at>
    Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
    Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
    Link: https://lore.kernel.org/r/20260719163939.3624767-1-fabrice.derepas@canonical.com
    Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ksmbd: fix use-after-free in __close_file_table_ids() [+ + +]
Author: Namjae Jeon <linkinjeon@kernel.org>
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 <yunseong.kim@est.tech>
    Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ksmbd: reject repeated SMB2 NEGOTIATE requests [+ + +]
Author: Namjae Jeon <linkinjeon@kernel.org>
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: stable@vger.kernel.org
    Reported-by: Runa Takemoto <takemotoruna223@gmail.com>
    Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ksmbd: return success for deferred final close [+ + +]
Author: Namjae Jeon <linkinjeon@kernel.org>
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 <linkinjeon@kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Stable-dep-of: e7188199eff4 ("ksmbd: fix use-after-free in __close_file_table_ids()")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ksmbd: use memcmp() to compare ClientGUIDs [+ + +]
Author: Namjae Jeon <linkinjeon@kernel.org>
Date:   Mon Jul 20 10:32:01 2026 +0900

    ksmbd: use memcmp() to compare ClientGUIDs
    
    [ Upstream commit e8bb506e6ef749ac0336f3e579d8d02396b7d832 ]
    
    ClientGUID is a fixed-size binary value and can contain embedded NUL
    bytes. strncmp() stops comparing at the first NUL byte, so different
    ClientGUID values can incorrectly be treated as equal.
    
    Use memcmp() in SMB3 multichannel session binding and
    FSCTL_VALIDATE_NEGOTIATE_INFO to compare all SMB2_CLIENT_GUID_SIZE
    bytes.
    
    Fixes: f5a544e3bab7 ("ksmbd: add support for SMB3 multichannel")
    Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
    Reported-by: Samu <nomomentomori@gmail.com>
    Suggested-by: Samu <nomomentomori@gmail.com>
    Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
KVM: arm64: Add missing hyp_enter when trapping sysreg [+ + +]
Author: Vincent Donnefort <vdonnefort@google.com>
Date:   Wed Jun 17 10:52:38 2026 +0100

    KVM: arm64: Add missing hyp_enter when trapping sysreg
    
    [ Upstream commit e7821048e8d72a94b1fb7422f8b45aa374ff076f ]
    
    Add a missing hypervisor event call for hyp_enter on sysreg trapping,
    causing an unbalanced hyp_enter/hyp_exit.
    
    The enum hyp_enter_exit_reason is not ABI, so we can keep the ERET
    reasons at the end for clarity.
    
    Fixes: 696dfec22b8e ("KVM: arm64: Add hyp_enter/hyp_exit events to nVHE/pKVM hyp")
    Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
    Reviewed-by: Fuad Tabba <tabba@google.com>
    Tested-by: Fuad Tabba <tabba@google.com>
    Link: https://patch.msgid.link/20260617095238.1530121-1-vdonnefort@google.com
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

KVM: arm64: Fix hyp_trace clock disabling [+ + +]
Author: Vincent Donnefort <vdonnefort@google.com>
Date:   Wed Jul 15 11:51:00 2026 +0100

    KVM: arm64: Fix hyp_trace clock disabling
    
    [ Upstream commit bbece712cfc7f286b2908ac120dcf700279d87eb ]
    
    Fix the disable path in hyp_trace_clock_enable(), which fell through to
    re-initialize and reschedule the clock after cancelling the work. Return
    early instead.
    
    While at it, cleanup hyp_trace_clock::lock which is unused and
    hyp_trace_clock::running which is redundant: the trace_remote framework
    already serializes calls to the callback enable_tracing.
    
    Fixes: b22888917fa4 ("KVM: arm64: Sync boot clock with the nVHE/pKVM hyp")
    Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
    Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev> (✓ DKIM/linux.dev)
    Link: https://patch.msgid.link/20260715105100.3178255-1-vdonnefort@google.com
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

KVM: arm64: Fix hyp_trace_desc allocation size in hyp_trace_load() [+ + +]
Author: Vincent Donnefort <vdonnefort@google.com>
Date:   Fri Jul 10 12:48:19 2026 +0100

    KVM: arm64: Fix hyp_trace_desc allocation size in hyp_trace_load()
    
    [ Upstream commit ca28278d10ec234592989ad370d58294b9d43e0f ]
    
    The footprint calculated for struct hyp_trace_desc sizes only
    trace_buffer_desc and do not take into account the other fields. It
    worked so far thanks to the follow-up PAGE_ALIGN().
    
    Fix the descriptor size and while at it, enforce an overflow check after
    PAGE_ALIGN().
    
    Reported-by: Sashiko <sashiko-bot@kernel.org>
    Fixes: 3aed038aac8d ("KVM: arm64: Add trace remote for the nVHE/pKVM hyp")
    Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
    Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev>
    Tested-by: Fuad Tabba <fuad.tabba@linux.dev>
    Link: https://patch.msgid.link/20260710114819.2689386-3-vdonnefort@google.com
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

KVM: arm64: Fix potential leak in hyp_trace_buffer_alloc_bpages_backing [+ + +]
Author: Vincent Donnefort <vdonnefort@google.com>
Date:   Fri Jul 10 12:48:18 2026 +0100

    KVM: arm64: Fix potential leak in hyp_trace_buffer_alloc_bpages_backing
    
    [ Upstream commit df7a9d376f7a388ecfacf8dfe0b5819ddfba6972 ]
    
    In the very unlikely event of a failure in __map_hyp, the allocated
    backing pages are leaked in hyp_trace_buffer_alloc_bpages_backing(). Fix
    this by freeing the pages on error.
    
    Fixes: 3aed038aac8d ("KVM: arm64: Add trace remote for the nVHE/pKVM hyp")
    Reported-by: Sashiko <sashiko-bot@kernel.org>
    Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev>
    Tested-by: Fuad Tabba <fuad.tabba@linux.dev>
    Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
    Link: https://patch.msgid.link/20260710114819.2689386-2-vdonnefort@google.com
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

KVM: arm64: Reject guest_memfd memslots when the VM has MTE [+ + +]
Author: Alexandru Elisei <alexandru.elisei@arm.com>
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 <fuad.tabba@linux.dev>
    Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev>
    Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
    Link: https://patch.msgid.link/20260722090354.94245-1-alexandru.elisei@arm.com
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

KVM: arm64: vgic: Avoid double-deactivate of IRQs in the nested context [+ + +]
Author: D Scott Phillips <scott@os.amperecomputing.com>
Date:   Tue Jul 14 16:11:58 2026 -0700

    KVM: arm64: vgic: Avoid double-deactivate of IRQs in the nested context
    
    commit 8a570b19b4b16a8a3b5ffa2b332bd5613110b2d8 upstream.
    
    In the nested state, the physical interrupt has already been
    deactivated through the HW bit in the LR. The extra deactivation
    would be harmless but can hit an errata case on AmpereOne, so
    avoid it here.
    
    On AmpereOne, deactivating a physical interrupt through
    ICC_DIR_EL1 or ICC_EOIR1_EL1 (depending on EOImode) which is not
    active, but is the highest priority pending interrupt causes the
    cpu to lose the interrupt pending state and also prevents the
    delivery of future interrupts.
    
    Fixes: 6dd333c8942b2 ("KVM: arm64: GICv3: nv: Plug L1 LR sync into deactivation primitive")
    Signed-off-by: D Scott Phillips <scott@os.amperecomputing.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/linux-arm-kernel/20260710222128.416581-1-scott@os.amperecomputing.com/
    Link: https://patch.msgid.link/20260714231158.496808-1-scott@os.amperecomputing.com
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: arm64: vgic: Fix race between LPI release and re-registration [+ + +]
Author: Carlos López <clopez@suse.de>
Date:   Wed Jul 15 12:51:37 2026 +0200

    KVM: arm64: vgic: Fix race between LPI release and re-registration
    
    [ Upstream commit cbfe2b24a1ea9de35032dbdd100fdc700f5be92d ]
    
    Fix a potential race between decrementing an LPI's reference count and
    evicting that structure from the LPI xarray.
    
    LPI structures are maintained in the VGIC LPI xarray (dist->lpi_xa).
    When the reference count of an LPI structure drops to zero,
    vgic_release_lpi_locked() removes the structure from the xarray and
    frees it under the xarray lock.
    
    However, the release of an LPI can race with a concurrent LPI
    re-registration with the same INTID via vgic_add_lpi() on another CPU,
    since the reference count drop and the xarray eviction are not performed
    in a single atomic step. This can happen e.g. if the guest issues a
    DISCARD while the LPI is still referenced from a vCPU's active-pending
    list (ap_list), and the same INTID is re-mapped via MAPTI.
    
    Particularly, vgic_release_lpi_locked() is called from two distinct
    paths: direct release via vgic_put_irq(), and deferred release via
    vgic_release_deleted_lpis(). During direct release, the issue can result
    in deleting a newly registered LPI from the xarray:
    
      CPU0 (Releasing LPI)                    CPU1 (Adding new LPI)
      ====================                    =====================
      vgic_put_irq()
          __vgic_put_irq()
              refcount_dec_and_test()
                                              vgic_add_lpi()
                                                  xa_lock_irqsave()
                                                  old_irq = xa_load(.., intid)
                                                  vgic_try_get_irq_ref(old_irq) == false
                            new IRQ inserted -->  __xa_store(.., intid, ..)
                                                  xa_unlock_irqrestore()
      xa_lock_irqsave();
      vgic_release_lpi_locked()
          __xa_erase(.., irq->intid)   <-- BUG: new IRQ is erased
          kfree_rcu(old_irq)
    
    During the deferred release path, the old IRQ can be leaked:
    
      CPU0 (Releasing LPI)                    CPU1 (Adding new LPI)
      ====================                    =====================
      vgic_put_irq_norelease()
          __vgic_put_irq()
              refcount_dec_and_test()
          irq->pending_release = true
                                              vgic_add_lpi()
                                                  xa_lock_irqsave()
                                                  old_irq = xa_load(.., intid)
                                                  vgic_try_get_irq_ref(oldirq) == false
                     BUG: old IRQ overwritten --> __xa_store(.., intid, ..)
                                                  xa_unlock_irqrestore()
    
      vgic_release_deleted_lpis()
          xa_lock_irqsave()
          xa_for_each() { .. } <-- old IRQ with pending_release = true
                                   is gone, so it cannot be released
    
    To fix the direct release path, move the reference count drop inside
    the xarray lock, making sure that vgic_add_lpi() never encounters the
    to-be-released LPI.
    
    In the deferred release path, the refcount drop must happen under a raw
    spinlock, so the xarray lock cannot be grabbed, and the same solution
    does not work. Instead, update vgic_add_lpi(), so that if it evicts
    an LPI from the xarray, it takes on the responsibility of freeing it.
    Consequently, an LPI may now be freed concurrently after a deferred
    release drops the refcount, so accessing the pending_release field is no
    longer safe from use-after-free. Delete all uses of the flag, and update
    vgic_release_deleted_lpis() to identify orphaned LPIs purely based on
    their refcount.
    
    Reported-by: Claude:claude-opus-4-6
    Fixes: 3a08a6ca7c37 ("KVM: arm64: vgic-v3: Use bare refcount for VGIC LPIs")
    Fixes: d54594accf73 ("KVM: arm64: vgic-v3: Erase LPIs from xarray outside of raw spinlocks")
    Signed-off-by: Carlos López <clopez@suse.de>
    Link: https://patch.msgid.link/20260715105137.3973823-4-clopez@suse.de
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

KVM: arm64: vgic: Mitigate potential LPI registration failure [+ + +]
Author: Carlos López <clopez@suse.de>
Date:   Wed Jul 15 12:51:38 2026 +0200

    KVM: arm64: vgic: Mitigate potential LPI registration failure
    
    [ Upstream commit 21f12496fdd357ad4e1fcdd07dc80ab7378f7d24 ]
    
    Mitigate a potential failure when inserting a new LPI into the VGIC LPI
    xarray.
    
    When vgic_add_lpi() is preparing to register a new LPI, it pre-allocates
    an xarray entry using xa_reserve_irq(), so that it can later perform the
    insertion under the xarray lock without allocating.
    
    However, since xa_reserve_irq() is called before acquiring such lock,
    there is a potential race where xa_reserve_irq() observes a populated
    entry, thus not performing the allocation, and another CPU removes that
    entry before the xarray lock is grabbed to perform the insertion.
    
      CPU0 (Adding new LPI)                      CPU1 (Releasing LPI)
      =====================                      ===================
      vgic_add_lpi()
          /* Entry populated, does not allocate */
          xa_reserve_irq(.., intid, ..)
                                                vgic_release_deleted_lpis()
                                                    xa_lock_irqsave()
                                                    vgic_release_lpi_locked()
                              xarray node freed --> __xa_erase(.., intid)
                                                    xa_unlock_irqrestore()
          xa_lock_irqsave()
          xa_load(.., intid) == NULL
          vgic_try_get_irq_ref(NULL) == false
          __xa_store(.., intid, irq, 0) <-- xarray node was freed, gfp=0
                                            cannot allocate, returns -ENOMEM
    
    This can happen e.g. if the guest issues a DISCARD while the LPI is
    still referenced from a vCPU's active-pending list (ap_list), and the
    same INTID is re-mapped via MAPTI.
    
    Mitigate this by passing GFP_NOWAIT to __xa_store(), so that the
    allocation can happen under the lock in the rare case that this
    condition is hit. Add __GFP_ACCOUNT as well to match xa_reserve_irq()'s
    flags.
    
    Reported-by: Sashiko <sashiko-bot@kernel.org>
    Fixes: 1d6f83f60f79 ("KVM: arm64: vgic: Store LPIs in an xarray")
    Signed-off-by: Carlos López <clopez@suse.de>
    Link: https://patch.msgid.link/20260715105137.3973823-5-clopez@suse.de
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

KVM: s390: pci: Fix memory accounting for pinned/unpinned pages [+ + +]
Author: Farhan Ali <alifm@linux.ibm.com>
Date:   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: stable@vger.kernel.org
    Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
    Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
    Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
    Tested-by: Matthew Rosato <mjrosato@linux.ibm.com>
    [borntraeger@linux.ibm.com: Fixed whitespace]
    Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: s390: pci: Fix missing error codes and memory unaccounting [+ + +]
Author: Farhan Ali <alifm@linux.ibm.com>
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: stable@vger.kernel.org
    Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
    Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
    Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
    Tested-by: Matthew Rosato <mjrosato@linux.ibm.com>
    Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: s390: pci: Fix NULL dereference on AIBV allocation failure [+ + +]
Author: Farhan Ali <alifm@linux.ibm.com>
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: stable@vger.kernel.org
    Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
    Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
    Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
    Tested-by: Matthew Rosato <mjrosato@linux.ibm.com>
    Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: s390: pci: Fix resource leak on IRQ registration failure [+ + +]
Author: Farhan Ali <alifm@linux.ibm.com>
Date:   Thu Jul 23 15:14:08 2026 -0700

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

KVM: s390: pci: Reject adapter interrupt forwarding if already enabled [+ + +]
Author: Farhan Ali <alifm@linux.ibm.com>
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: stable@vger.kernel.org
    Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
    Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
    Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
    Tested-by: Matthew Rosato <mjrosato@linux.ibm.com>
    Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: s390: pci: Validate AIBV and AISB before pinning guest pages [+ + +]
Author: Farhan Ali <alifm@linux.ibm.com>
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: stable@vger.kernel.org
    Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
    Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
    Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
    Tested-by: Matthew Rosato <mjrosato@linux.ibm.com>
    Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: SVM: Update x2APIC MSR intercepts if AVIC is inhibited while L2 is active [+ + +]
Author: Sean Christopherson <seanjc@google.com>
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: stable@vger.kernel.org
    Cc: Yosry Ahmed <yosry@kernel.org>
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Link: https://patch.msgid.link/20260729213558.639074-1-pbonzini@redhat.com/
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: VMX: add memory clobber to asm for VMX instructions [+ + +]
Author: Paolo Bonzini <pbonzini@redhat.com>
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 <seanjc@google.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: x86: Cancel delayed I/O APIC EOI handling before destroying vCPUs [+ + +]
Author: Weiming Shi <bestswngs@gmail.com>
Date:   Mon Jul 27 10:17:18 2026 -0700

    KVM: x86: Cancel delayed I/O APIC EOI handling before destroying vCPUs
    
    commit 9910e835580fef3bef53b70241dd00c4bffad693 upstream.
    
    Cancel (and flush) the I/O APIC's delayed EOI handling work during the
    "pre VM destroy" phase, before vCPUs are destroyed, as processing the EOI
    broadcast will inject another IRQ if the line is asserted, i.e. will try
    to deliver an IRQ to the target vCPU(s).  Canceling the work after vCPUs
    are destroyed leads to UAF if the delayed work is processed after vCPUs are
    destroyed.
    
      BUG: KASAN: slab-use-after-free in __kvm_irq_delivery_to_apic_fast+0x9bf/0xa20 arch/x86/kvm/lapic.c:1250
      Read of size 8 at addr ffff8880499abea0 by task kworker/1:2/1218
    
      CPU: 1 UID: 0 PID: 1218 Comm: kworker/1:2 Not tainted 7.1.0-rc7 #5 PREEMPT(lazy)
      Hardware name: QEMU Ubuntu 25.10 PC v2 (i440FX + PIIX, + 10.1 machine, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
      Workqueue: events kvm_ioapic_eoi_inject_work
      Call Trace:
       <TASK>
       __dump_stack lib/dump_stack.c:94
       dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120
       print_address_description mm/kasan/report.c:378
       print_report+0x139/0x4ad mm/kasan/report.c:482
       kasan_report+0xe4/0x1d0 mm/kasan/report.c:595
       __kvm_irq_delivery_to_apic_fast+0x9bf/0xa20 arch/x86/kvm/lapic.c:1250
       __kvm_irq_delivery_to_apic+0xd8/0xbf0 arch/x86/kvm/lapic.c:1345
       kvm_irq_delivery_to_apic arch/x86/kvm/lapic.h:129
       ioapic_service+0x308/0x590 arch/x86/kvm/ioapic.c:492
       kvm_ioapic_eoi_inject_work+0x13c/0x190 arch/x86/kvm/ioapic.c:532
       process_one_work+0xa59/0x19a0 kernel/workqueue.c:3314
       process_scheduled_works kernel/workqueue.c:3397
       worker_thread+0x5eb/0xe50 kernel/workqueue.c:3478
       kthread+0x370/0x450 kernel/kthread.c:436
       ret_from_fork+0x72b/0xd30 arch/x86/kernel/process.c:158
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
       </TASK>
    
    Note, the VM is unreachable once kvm_destroy_vm() starts, and scheduling
    new work via kvm_ioapic_send_eoi() can only be done via KVM_RUN, i.e.
    requires a live vCPU.
    
    Alternatively, KVM could simply destroy the I/O APIC during the "pre" phase
    of VM destruction, but that gets more than a bit sketchy as KVM expects the
    I/O APIC to exist if ioapic_in_kernel() is true, and nested virtualization
    in particular has a bad habit of touching VM-scope state during vCPU
    destruction.  E.g. attempting to free the PIC during the pre phase would
    lead to a NULL pointer dereference in kvm_cpu_has_extint(), and it's not
    hard to imagine the I/O APIC having a similar flaw.
    
    Fixes: 17bcd7144263 ("KVM: x86: Free vCPUs before freeing VM state")
    Reported-by: <zdi-disclosures@trendmicro.com>
    Reported-by: Zhong Wang <wangzhong.c0ss4ck@bytedance.com>
    Reported-by: Xuanqing Shi <shixuanqing.11@bytedance.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Weiming Shi <bestswngs@gmail.com>
    Co-developed-by: Sean Christopherson <seanjc@google.com>
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Message-ID: <20260727171718.543491-1-seanjc@google.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
lib/alloc_tag: introduce mem_alloc_profiling_permanently_disabled() [+ + +]
Author: Harry Yoo (Oracle) <harry@kernel.org>
Date:   Sat Aug 1 12:25:32 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) <harry@kernel.org>
    Acked-by: Suren Baghdasaryan <surenb@google.com>
    Link: https://patch.msgid.link/20260713-kmalloc-no-objext-v3-3-47c7bd138de7@kernel.org
    Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
    Signed-off-by: Harry Yoo <harry@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
lib: test_hmm: use device devt for coherent device range selection [+ + +]
Author: Stanislav Kinsburskii <skinsburskii@gmail.com>
Date:   Mon Jun 29 16:30:14 2026 -0700

    lib: test_hmm: use device devt for coherent device range selection
    
    commit 4fc089235378d1f9ddb6bcbe67c192ffdcaae0ed upstream.
    
    Commit af69016dab96 ("lib: test_hmm: implement a device release method")
    moved the initial dmirror_allocate_chunk() call before cdev_device_add().
    That means the struct cdev has not been added yet, so cdev_add() has not
    initialized mdevice->cdevice.dev.
    
    The coherent-device range selection uses the device minor to choose
    between spm_addr_dev0 and spm_addr_dev1.  Reading
    MINOR(mdevice->cdevice.dev) before cdev_add() therefore always sees an
    uninitialized dev_t.  As a result, both coherent devices select the same
    physical range, and adding the second device fails due to the overlapping
    dev_pagemap range.
    
    Use mdevice->device.devt instead.  It is initialized in
    dmirror_device_init() before dmirror_allocate_chunk() is called and is the
    same dev_t later passed to cdev_device_add().
    
    Link: https://lore.kernel.org/178277581197.172200.16265155329935822153.stgit@skinsburskii
    Fixes: af69016dab96 ("lib: test_hmm: implement a device release method")
    Signed-off-by: Stanislav Kinsburskii <skinsburskii@gmail.com>
    Reviewed-by: Alistair Popple <apopple@nvidia.com>
    Cc: Balbir Singh <balbirs@nvidia.com>
    Cc: Zenghui Yu (Huawei) <zenghui.yu@linux.dev>
    Cc: Jason Gunthorpe <jgg@ziepe.ca>
    Cc: Leon Romanovsky <leon@kernel.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Linux: Linux 7.1.8 [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Sun Aug 9 20:26:58 2026 +0200

    Linux 7.1.8
    
    Link: https://lore.kernel.org/r/20260807143428.008222056@linuxfoundation.org
    Tested-by: Ronald Warsow <rwarsow@gmx.de>
    Tested-by: Pavel Machek (CIP) <pavel@nabladev.com>
    Tested-by: Shuah Khan <skhan@linuxfoundation.org>
    Tested-by: Brett A C Sheffield <bacs@librecast.net>
    Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com>
    Tested-by: Benjamin Boortz <bennib@mailbox.org>
    Tested-by: Justin M. Forbes <jforbes@fedoraproject.org>
    Tested-by: Peter Schneider <pschneider1968@googlemail.com>
    Tested-by: Markus Reichelt <lkt+2023@mareichelt.com>
    Tested-by: Ron Economos <re@w6rz.net>
    Tested-by: Barry K. Nathan <barryn@pobox.com>
    Tested-by: Miguel Ojeda <ojeda@kernel.org>
    Tested-by: Jeffrin Jose T <jeffrin@rajagiritech.edu.in>
    Tested-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
media: chips-media: wave5: Support CBP profile [+ + +]
Author: Jackson Lee <jackson.lee@chipsnmedia.com>
Date:   Mon Aug 3 21:06:29 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: stable@vger.kernel.org
    Signed-off-by: Jackson Lee <jackson.lee@chipsnmedia.com>
    Signed-off-by: Nas Chung <nas.chung@chipsnmedia.com>
    Tested-by: Brandon Brnich <b-brnich@ti.com>
    Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
    Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
    Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/huge_memory: unlock i_mmap_rwsem before releasing after-split folios [+ + +]
Author: Kiryl Shutsemau (Meta) <kas@kernel.org>
Date:   Thu Jul 16 10:54:24 2026 +0100

    mm/huge_memory: unlock i_mmap_rwsem before releasing after-split folios
    
    commit e923bd21058ea02fd0dcd3549d151d143fd036e5 upstream.
    
    __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/20260716095424.471052-1-kirill@shutemov.name
    Fixes: baa355fd3314 ("thp: file pages support for split_huge_page()")
    Signed-off-by: Kiryl Shutsemau (Meta) <kas@kernel.org>
    Reported-by: Hao Zhang <zhanghao1@kylinos.cn>
    Closes: https://lore.kernel.org/linux-mm/20260710071344.GA106129@zh-pc
    Co-developed-by: Hao Zhang <zhanghao1@kylinos.cn>
    Signed-off-by: Hao Zhang <zhanghao1@kylinos.cn>
    Acked-by: David Hildenbrand (Arm) <david@kernel.org>
    Reviewed-by: Zi Yan <ziy@nvidia.com>
    Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
    Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
    Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
    Cc: Barry Song <baohua@kernel.org>
    Cc: Dev Jain <dev.jain@arm.com>
    Cc: Lance Yang <lance.yang@linux.dev>
    Cc: Liam R. Howlett <liam@infradead.org>
    Cc: Lorenzo Stoakes <ljs@kernel.org>
    Cc: Naoya Horiguchi <nao.horiguchi@gmail.com>
    Cc: Nico Pache <npache@redhat.com>
    Cc: Ryan Roberts <ryan.roberts@arm.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/hugetlb: fix list corruption in allocate_file_region_entries() [+ + +]
Author: Xiangfeng Cai <caixiangfeng@bytedance.com>
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/20260713171456.300518-2-caixiangfeng@bytedance.com
    Fixes: d3ec7b6e09e5 ("mm/hugetlb: use list_splice to merge two list at once")
    Signed-off-by: Xiangfeng Cai <caixiangfeng@bytedance.com>
    Reviewed-by: Muchun Song <muchun.song@linux.dev>
    Cc: Baoquan He <baoquan.he@linux.dev>
    Cc: David Hildenbrand <david@kernel.org>
    Cc: Oscar Salvador <osalvador@suse.de>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Wei Yang <richard.weiyang@linux.alibaba.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mm/hugetlb: fix swap entry corruption when clearing uffd-wp at fork() [+ + +]
Author: Kiryl Shutsemau (Meta) <kas@kernel.org>
Date:   Wed Jul 8 10:01:10 2026 +0100

    mm/hugetlb: fix swap entry corruption when clearing uffd-wp at fork()
    
    commit 83abe2fd5b3aeb3123b5408a5a91709c5538fb23 upstream.
    
    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/20260708090110.136162-1-kirill@shutemov.name
    Fixes: bc70fbf269fd ("mm/hugetlb: handle uffd-wp during fork()")
    Signed-off-by: Kiryl Shutsemau <kas@kernel.org>
    Reported-by: Sashiko AI review <sashiko-bot@kernel.org>
    Closes: https://lore.kernel.org/all/20260703140011.99E601F000E9@smtp.kernel.org/
    Suggested-by: David Hildenbrand <david@kernel.org>
    Acked-by: David Hildenbrand (Arm) <david@kernel.org>
    Assisted-by: Claude:claude-fable-5
    Cc: Muchun Song <muchun.song@linux.dev>
    Cc: Oscar Salvador <osalvador@suse.de>
    Cc: Peter Xu <peterx@redhat.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/page_reporting: use system_freezable_wq to fix UAF during suspend [+ + +]
Author: Link Lin <linkl@google.com>
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/20260721005603.1710551-1-linkl@google.com
    Fixes: 36e66c554b5c ("mm: introduce Reported pages")
    Signed-off-by: Link Lin <linkl@google.com>
    Suggested-by: David Hildenbrand (Arm) <david@kernel.org>
    Suggested-by: Michael S. Tsirkin <mst@redhat.com>
    Acked-by: David Rientjes <rientjes@google.com>
    Acked-by: David Hildenbrand (Arm) <david@kernel.org>
    Acked-by: Michael S. Tsirkin <mst@redhat.com>
    Cc: Alexander Duyck <alexander.duyck@gmail.com>
    Cc: Greg Thelen <gthelen@google.com>
    Cc: James Houghton <jthoughton@google.com>
    Cc: Jason Wang <jasowang@redhat.com>
    Cc: Jiaqi Yan <jiaqiyan@google.com>
    Cc: Vlastimil Babka <vbabka@kernel.org>
    Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/percpu-km: fix bitmap overflow and accounting in pcpu_create_chunk() [+ + +]
Author: Zi Yan <ziy@nvidia.com>
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 <sashiko-bot@kernel.org>
    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 <ziy@nvidia.com>
    Acked-by: Dennis Zhou <dennis@kernel.org>
    Cc: Christoph Lameter <cl@linux.com>
    Cc: Tejun Heo <tj@kernel.org>
    Cc: Zi Yan <ziy@nvidia.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/slab: decouple SLAB_NO_SHEAVES from SLAB_NO_OBJ_EXT [+ + +]
Author: Harry Yoo (Oracle) <harry@kernel.org>
Date:   Sat Aug 1 12:25:31 2026 +0000

    mm/slab: decouple SLAB_NO_SHEAVES from SLAB_NO_OBJ_EXT
    
    commit 982e31382d9a1a3c8c4e6a13702a53711f4efe9f upstream.
    
    Bootstrap caches are created with SLAB_NO_OBJ_EXT to disallow sheaves
    and obj_exts.
    
    To allow disabling obj_exts while allowing sheaves, decouple
    SLAB_NO_SHEAVES from SLAB_NO_OBJ_EXT. Bootstrap caches now have both
    SLAB_NO_SHEAVES and SLAB_NO_OBJ_EXT.
    
    No functional change intended.
    
    Reviewed-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
    Signed-off-by: Harry Yoo (Oracle) <harry@kernel.org>
    Reviewed-by: Suren Baghdasaryan <surenb@google.com>
    Link: https://patch.msgid.link/20260713-kmalloc-no-objext-v3-2-47c7bd138de7@kernel.org
    Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
    Signed-off-by: Harry Yoo <harry@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mm/slab: prevent unbounded recursion in free path with new kmalloc type [+ + +]
Author: Harry Yoo (Oracle) <harry@kernel.org>
Date:   Sat Aug 1 12:25:33 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 <dcostantino@meta.com>
    Reported-by: Shakeel Butt <shakeel.butt@linux.dev>
    Closes: https://lore.kernel.org/linux-mm/20260625230029.703750-1-shakeel.butt@linux.dev [1]
    Fixes: 4b8736964640 ("mm/slab: add allocation accounting into slab allocation and free paths")
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/linux-mm/c5c4208d-a6f0-413e-bad9-49be12f12d55@kernel.org [2]
    Signed-off-by: Harry Yoo (Oracle) <harry@kernel.org>
    Reviewed-by: Suren Baghdasaryan <surenb@google.com>
    Link: https://patch.msgid.link/20260713-kmalloc-no-objext-v3-4-47c7bd138de7@kernel.org
    Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
    [harry@kernel.org: Backport notes:
     - Fix a minor conflict due to missing partitioned
       kmalloc caches in 7.1.
    
     - Use __GFP_NO_OBJ_EXT instead of SLAB_ALLOC_NO_OBJ_EXT
       since slab's internal alloc_flags do not exist in 7.1.
    
     - Since there is no way to distinguish between no obj_exts vs.
       no recursion in 7.1 due to lack of SLAB_ALLOC_* flags, sheaves for
       normal kmalloc caches are allocated from kmalloc-no-objext-* unlike
       upstream.
    
       Also, allocations from kmalloc-no-objext cannot allocate sheaves and
       may observe slightly higher contention. Only 7.1 has this problem as
       kmalloc caches don't have sheaves in LTS kernels.
    
     - Apply the __GFP_NO_OBJ_EXT flag to the !allow_spin path in
       alloc_slab_obj_exts(). ]
    Signed-off-by: Harry Yoo <harry@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
mm/util: don't read __page_2 for order-1 folios in snapshot_page() [+ + +]
Author: Aboorva Devarajan <aboorvad@linux.ibm.com>
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/20260708201954.686111-1-aboorvad@linux.ibm.com
    Fixes: 31a31da8a618 ("mm: move _pincount in folio to page[2] on 32bit")
    Signed-off-by: Aboorva Devarajan <aboorvad@linux.ibm.com>
    Reported-by: Sourabh Jain <sourabhjain@linux.ibm.com>
    Acked-by: David Hildenbrand (Arm) <david@kernel.org>
    Reviewed-by: Lorenzo Stoakes <ljs@kernel.org>
    Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Reviewed-by: Luiz Capitulino <luizcap@redhat.com>
    Cc: Liam R. Howlett <liam@infradead.org>
    Cc: Michal Hocko <mhocko@suse.com>
    Cc: Mike Rapoport <rppt@kernel.org>
    Cc: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
    Cc: Suren Baghdasaryan <surenb@google.com>
    Cc: Vlastimil Babka <vbabka@kernel.org>
    Cc: <stable@vger.kernel.org> # v6.15+
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/vmstat: fold stranded per-cpu node stats when a node comes online [+ + +]
Author: Gregory Price <gourry@gourry.net>
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/20260627202243.758289-1-gourry@gourry.net
    Fixes: 75ef71840539 ("mm, vmstat: add infrastructure for per-node vmstats")
    Signed-off-by: Gregory Price <gourry@gourry.net>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Mel Gorman <mgorman@techsingularity.net>
    Cc: Mike Rapoport <rppt@kernel.org>
    Cc: Vlastimil Babka <vbabka@kernel.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm: memcg: initialize *locked in memcg1_oom_prepare() stub [+ + +]
Author: Breno Leitao <leitao@debian.org>
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/20260716-memcg-oom-uninit-locked-v2-1-63631d878eb4@debian.org
    Fixes: e93d4166b40a ("mm: memcg: put cgroup v1-specific code under a config option")
    Signed-off-by: Breno Leitao <leitao@debian.org>
    Reviewed-by: Joshua Hahn <joshua.hahnjy@gmail.com>
    Acked-by: Johannes Weiner <hannes@cmpxchg.org>
    Reviewed-by: SeongJae Park <sj@kernel.org>
    Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
    Cc: Michal Hocko <mhocko@kernel.org>
    Cc: Muchun Song <muchun.song@linux.dev>
    Cc: Roman Gushchin <roman.gushchin@linux.dev>
    Cc: Shakeel Butt <shakeel.butt@linux.dev>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mm: mglru: fix stale batch updates after memcg reparenting [+ + +]
Author: Qi Zheng <qi.zheng@linux.dev>
Date:   Fri Jul 10 23:43:18 2026 +0800

    mm: mglru: fix stale batch updates after memcg reparenting
    
    commit de4660898b7aa7e03d3b120a6bfa6b26211e4e77 upstream.
    
    The mglru page table walker batches per-generation size deltas in
    walk->nr_pages while walking page tables without holding the lruvec lock.
    The reset_batch_size() later folds those deltas into walk->lruvec under
    the lruvec lock.
    
    The page table walker can run concurrently with the memcg reparenting path
    as follows:
    
    CPU0                           CPU1
    ====                           ====
    
    walk_mm
    --> walk_page_range
        --> update_batch_size
            --> walk->nr_pages += delta
    
                                  mem_cgroup_css_offline
                                  --> memcg_reparent_objcgs
                                      --> lock lruvec
                                          lru_gen_reparent_memcg
                                          --> reparent child folios to parent
                                          unlock lruvec
    
        lock lruvec
        reset_batch_size
        --> child lrugen->nr_pages += delta
    
    This will trigger the following warning in lru_gen_exit_memcg():
    
            VM_WARN_ON_ONCE(memchr_inv(lruvec->lrugen.nr_pages, 0,
                                       sizeof(lruvec->lrugen.nr_pages)));
    
    And the user-visible impact of underestimated nr_pages in MGLRU was
    premature OOMs because MGLRU does not try to reclaim memory when nr_pages
    reaches zero, but there are still more pages.
    
    To fix it, make reset_batch_size() check CSS_DYING under RCU before
    flushing the pending batch.  A non-dying memcg keeps the original lruvec
    stable against RCU-delayed offlining; a dying memcg redirects the deltas
    to the first non-dying ancestor.
    
    Link: https://lore.kernel.org/20260710154318.75388-1-qi.zheng@linux.dev
    Fixes: f304652609ea ("mm: vmscan: prepare for reparenting MGLRU folios")
    Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
    Reported-by: Peiyang He <peiyang_he@smail.nju.edu.cn>
    Closes: https://lore.kernel.org/all/5A9E929D82717101+12fcf643-efb8-4b9a-a53a-1e28cc894f0b@smail.nju.edu.cn
    Reviewed-by: Harry Yoo (Oracle) <harry@kernel.org>
    Acked-by: Johannes Weiner <hannes@cmpxchg.org>
    Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
    Cc: Axel Rasmussen <axelrasmussen@google.com>
    Cc: Barry Song <baohua@kernel.org>
    Cc: David Hildenbrand <david@kernel.org>
    Cc: Kairui Song <kasong@tencent.com>
    Cc: Lorenzo Stoakes <ljs@kernel.org>
    Cc: Michal Hocko <mhocko@kernel.org>
    Cc: Muchun Song <muchun.song@linux.dev>
    Cc: Roman Gushchin <roman.gushchin@linux.dev>
    Cc: Wei Xu <weixugc@google.com>
    Cc: Yuanchu Xie <yuanchu@google.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mm: migrate_device: fix pte_pfn/pte_dirty called on non-present PTE [+ + +]
Author: Kefeng Wang <wangkefeng.wang@huawei.com>
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/20260708003955.4024340-1-wangkefeng.wang@huawei.com
    Link: https://lore.kernel.org/20260706111958.3649651-1-wangkefeng.wang@huawei.com
    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 <wangkefeng.wang@huawei.com>
    Reviewed-by: Balbir Singh <balbirs@nvidia.com>
    Acked-by: Zi Yan <ziy@nvidia.com>
    Cc: Alistair Popple <apopple@nvidia.com>
    Cc: Byungchul Park <byungchul@sk.com>
    Cc: David Hildenbrand <david@kernel.org>
    Cc: Gregory Price <gourry@gourry.net>
    Cc: "Huang, Ying" <ying.huang@linux.alibaba.com>
    Cc: Joshua Hahn <joshua.hahnjy@gmail.com>
    Cc: Matthew Brost <matthew.brost@intel.com>
    Cc: Rakie Kim <rakie.kim@sk.com>
    Cc: Ying Huang <ying.huang@linux.alibaba.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mshv: Fix duplicate GSI detection for GSI 0 [+ + +]
Author: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
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 <skinsburskii@linux.microsoft.com>
    Reviewed-by: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com>
    Signed-off-by: Wei Liu <wei.liu@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mshv: fix hv_input_get_system_property struct [+ + +]
Author: Wei Liu <wei.liu@kernel.org>
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: stable@kernel.org
    Signed-off-by: Wei Liu <wei.liu@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mshv: Fix level-triggered check on uninitialized data [+ + +]
Author: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
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 <skinsburskii@linux.microsoft.com>
    Reviewed-by: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com>
    Signed-off-by: Wei Liu <wei.liu@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mshv: Fix missing error code on VP allocation failure [+ + +]
Author: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
Date:   Thu May 7 15:44:37 2026 +0000

    mshv: Fix missing error code on VP allocation failure
    
    [ Upstream commit f546be6a19d24d02be576d8617cb26c7acb61594 ]
    
    In mshv_partition_ioctl_create_vp(), when kzalloc for the VP struct
    fails, the code jumps to the cleanup path without setting ret. At that
    point ret is 0 from the preceding successful mshv_vp_stats_map() call,
    so the function returns success to userspace despite having failed to
    create the VP. No fd is installed and no VP is registered in pt_vp_array,
    but userspace has no way to know the operation failed.
    
    Set ret to -ENOMEM before jumping to the cleanup path.
    
    Fixes: 621191d709b14 ("Drivers: hv: Introduce mshv_root module to expose /dev/mshv to VMMs")
    Signed-off-by: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
    Reviewed-by: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com>
    Signed-off-by: Wei Liu <wei.liu@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mshv: Fix race in mshv_irqfd_deassign [+ + +]
Author: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
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 <skinsburskii@linux.microsoft.com>
    Reviewed-by: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com>
    Signed-off-by: Wei Liu <wei.liu@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mshv: Fix sleeping under spinlock in mshv_portid_alloc [+ + +]
Author: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
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 <skinsburskii@linux.microsoft.com>
    Reviewed-by: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com>
    Signed-off-by: Wei Liu <wei.liu@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mshv: Order pt_vp_array publish against irqfd assertion path [+ + +]
Author: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
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 <skinsburskii@linux.microsoft.com>
    Reviewed-by: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com>
    Signed-off-by: Wei Liu <wei.liu@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

mshv: Publish VP to pt_vp_array before installing the file descriptor [+ + +]
Author: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
Date:   Thu May 7 15:44:32 2026 +0000

    mshv: Publish VP to pt_vp_array before installing the file descriptor
    
    [ Upstream commit 72e3b0311aa90568a4b42a64445d1d3e1dc5a34d ]
    
    mshv_partition_ioctl_create_vp() called anon_inode_getfd() before
    publishing the new VP into partition->pt_vp_array.  anon_inode_getfd()
    includes fd_install(), so the fd was live in current->files before the
    publish ran.
    
    A concurrent MSHV_RUN_VP ioctl on that fd does not serialise against the
    in-progress MSHV_CREATE_VP — it takes vp->vp_mutex, not the partition
    mutex.  Once the VP starts running and traps, mshv_intercept_isr() can look
    up partition->pt_vp_array[vp_index] and observe NULL, silently dropping the
    intercept message.
    
    Split the fd creation: reserve an fd with get_unused_fd_flags(), create the
    file with anon_inode_getfile(), publish the VP via smp_store_release(), and
    finally call fd_install() as the userspace-visibility commit point.
    
    Fixes: 621191d709b14 ("Drivers: hv: Introduce mshv_root module to expose /dev/mshv to VMMs")
    Signed-off-by: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
    Reviewed-by: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com>
    Signed-off-by: Wei Liu <wei.liu@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
mshv_vtl: fix fd leak in mshv_ioctl_create_vtl() [+ + +]
Author: Yi Xie <xieyi@kylinos.cn>
Date:   Wed Jul 8 09:28:52 2026 +0800

    mshv_vtl: fix fd leak in mshv_ioctl_create_vtl()
    
    [ Upstream commit ec08dd5b9ffa52980908805bdc8a55a8f1bc6667 ]
    
    put_unused_fd() if anon_inode_getfile() fails.
    
    Fixes: 7bfe3b8ea6e30 ("Drivers: hv: Introduce mshv_vtl driver")
    Signed-off-by: Yi Xie <xieyi@kylinos.cn>
    Reviewed-by: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
    Signed-off-by: Wei Liu <wei.liu@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net/sched: cls_u32: validate offshift to prevent shift-out-of-bounds [+ + +]
Author: Cen Zhang (Microsoft) <blbllhy@gmail.com>
Date:   Thu Jul 23 00:49:55 2026 -0400

    net/sched: cls_u32: validate offshift to prevent shift-out-of-bounds
    
    [ Upstream commit aef96eead2860cbfa371e4471d4f04412213b958 ]
    
    u32_change() copies the user-provided tc_u32_sel.offshift (unsigned char,
    0-255) into the kernel knode object without bounds validation. When a
    packet later hits u32_classify() with TC_U32_VAROFFSET set, it evaluates
    `ntohs(offmask & *data) >> offshift` where the left operand is a 16-bit
    value promoted to a 32-bit int. Any offshift >= 32 is undefined behavior
    per C11 6.5.7p3, triggerable by an unprivileged user via user/network
    namespaces.
    
    UBSAN: shift-out-of-bounds in net/sched/cls_u32.c:236:43
    shift exponent 32 is too large for 32-bit type int
    
    Fix this by rejecting offshift >= 16 during filter creation in
    u32_change().
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: AutonomousCodeSecurity@microsoft.com
    Link: https://lore.kernel.org/all/20260720034514.23053-1-blbllhy@gmail.com
    Signed-off-by: Cen Zhang (Microsoft) <blbllhy@gmail.com>
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Tested-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Tested-by: Victor Nogueira <victor@mojatatu.com>
    Link: https://patch.msgid.link/20260723044955.89471-1-blbllhy@gmail.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net/sched: sch_cake: skip clearing unused tins during rate adjustment [+ + +]
Author: Jonas Köppeler <j.koeppeler@tu-berlin.de>
Date:   Mon Jul 20 23:14:52 2026 +0200

    net/sched: sch_cake: skip clearing unused tins during rate adjustment
    
    [ Upstream commit a3729e0df005a936ceb3c2b0d167f01a2b03f970 ]
    
    When cake_configure_rates() is called from the dequeue path with
    rate_adjust=true, it only needs to update the rate parameters. The
    loop that clears the unused tins is both unnecessary and harmful in
    this path:
    
     - cake_clear_tin() overwrites q->cur_tin and q->cur_flow, which are
       actively used by cake_dequeue(), corrupting the dequeue state.
     - iterating over the unused tins and their internal queues to purge
       packets adds needless overhead to the hot path.
    
    Skip the entire loop when rate_adjust is set, as neither
    cake_clear_tin() nor the mtu_time update are needed when only the
    rate changes.
    
    The clearing loop runs on every rate adjustment from the dequeue path,
    clearing (max_tins - cur_tins) tins each time, so the cost grows the
    fewer tins the configured mode actually uses. Testing cake_mq over veth
    (8 rx/tx queues, 2 Gbit limit) with flent's [1] rrul and tcp_nup tests and
    32 TCP upstreams shows a large drop in loaded latency and a throughput
    gain, restoring behaviour to pre-15c2715a5264 levels:
    
      +------------+------+------+-------+-------+---------+
      | kernel     | mode | test |  base |  load |    tput |
      |            |      |      |  (ms) |  (ms) |  (Mbit) |
      +------------+------+------+-------+-------+---------+
      | net-next   | be   | rrul | 0.810 | 11.78 | 1469.67 |
      | net-next   | be   | nup  | 0.637 | 85.71 | 1243.15 |
      | net-next   | ds3  | rrul | 0.397 | 15.28 | 1770.06 |
      | net-next   | ds3  | nup  | 0.351 | 15.98 | 1799.39 |
      +------------+------+------+-------+-------+---------+
      | patched    | be   | rrul | 0.092 |  0.56 | 1873.40 |
      | patched    | be   | nup  | 0.109 |  1.82 | 1869.12 |
      | patched    | ds3  | rrul | 0.097 |  0.98 | 1866.10 |
      | patched    | ds3  | nup  | 0.101 |  0.51 | 1861.79 |
      +------------+------+------+-------+-------+---------+
    
    The same trend holds on real hardware (IPQ8074A, 4 rx/tx queues,
    OpenWrt): in besteffort mode the tcp_nup loaded latency drops from
    ~470 ms to ~4 ms.
    
    [1] https://flent.org
    
    Fixes: 15c2715a5264 ("net/sched: sch_cake: fixup cake_mq rate adjustment for diffserv config")
    Signed-off-by: Jonas Köppeler <j.koeppeler@tu-berlin.de>
    Tested-by: Mike Pham <mikepham4321@gmail.com>
    Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
    Link: https://patch.msgid.link/20260720-sch_cake-skip-clearing-tins-v2-1-e6a8b0275c73@tu-berlin.de
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
net/smc: fix socket use-after-free during link group termination [+ + +]
Author: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
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: stable@vger.kernel.org
    Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
    Reviewed-by: Mahanta Jambigi <mjambigi@linux.ibm.com>
    Link: https://patch.msgid.link/20260723105454.87016-1-xuanqiang.luo@linux.dev
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
net: bridge: mrp: fix Option TLV length in MRP_Test frames [+ + +]
Author: David Corvaglia <david@corvaglia.dev>
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 <david@corvaglia.dev>
    Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
    Link: https://patch.msgid.link/20260726062605.2746-1-david@corvaglia.dev
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: bridge: stop fast-leave after deleting a port group [+ + +]
Author: Zhiling Zou <zhilinz@nebusec.ai>
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: stable@vger.kernel.org
    Reported-by: Vega <vega@nebusec.ai>
    Signed-off-by: Zhiling Zou <zhilinz@nebusec.ai>
    Signed-off-by: Ren Wei <enjou1224z@gmail.com>
    Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
    Link: https://patch.msgid.link/1cf0898872ef7c72d5f4c0304414a192c6dac591.1784707712.git.zhilinz@nebusec.ai
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: do not send ICMP/NDISC Redirects when peer allocation fails [+ + +]
Author: Eric Dumazet <edumazet@google.com>
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 <edumazet@google.com>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Link: https://patch.msgid.link/20260724072901.1633601-1-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: dsa: mt7530: check bus->read() errors in the MDIO regmap backend [+ + +]
Author: Daniel Golle <daniel@makrotopia.org>
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 <daniel@makrotopia.org>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://patch.msgid.link/3c628e48276c2e5522c8795a6be60d11c7a76a7d.1785213071.git.daniel@makrotopia.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: dsa: mt7530: error out on failed reads in ATC/VTCR command polling [+ + +]
Author: Daniel Golle <daniel@makrotopia.org>
Date:   Tue Jul 28 05:52:21 2026 +0100

    net: dsa: mt7530: error out on failed reads in ATC/VTCR command polling
    
    [ Upstream commit ed9adac35b8fac635f40e28461505e2e5b6c8fcc ]
    
    mt7530_fdb_cmd() and mt7530_vlan_cmd() poll the command register
    through a helper which returns 0 when the underlying read fails. A
    failed bus transaction thus clears ATC_BUSY/VTCR_BUSY and is treated
    as successful command completion, and the subsequent ATC_INVALID and
    VTCR_INVALID checks are defeated the same way.
    
    Poll using regmap_read_poll_timeout(), which stops on read errors and
    propagates them, and check the completion status read as well. Take
    the MDIO bus lock across the sequence as the switch regmap is set up
    with locking disabled.
    
    Fixes: b8f126a8d543 ("net-next: dsa: add dsa support for Mediatek MT7530 switch")
    Fixes: 83163f7dca56 ("net: dsa: mediatek: add VLAN support for MT7530")
    Signed-off-by: Daniel Golle <daniel@makrotopia.org>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://patch.msgid.link/eea1d8f15c54375b3770c23e09fb3217df487169.1785213071.git.daniel@makrotopia.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: dsa: mt7530: error out on failed reads in MT7531 PHY polling [+ + +]
Author: Daniel Golle <daniel@makrotopia.org>
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 <daniel@makrotopia.org>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://patch.msgid.link/79e85d68d210cc37342978171aa6432aa2954333.1785213071.git.daniel@makrotopia.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: ethernet: mtk_eth_soc: pass eth to mtk_handle_irq_rx in poll_controller [+ + +]
Author: Chenguang Zhao <zhaochenguang@kylinos.cn>
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 <zhaochenguang@kylinos.cn>
    Link: https://patch.msgid.link/20260723055735.885112-1-chenguang.zhao@linux.dev
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: ipv6: clear suppressed fib6 rule result [+ + +]
Author: Zhiling Zou <zhilinz@nebusec.ai>
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: stable@vger.kernel.org
    Reported-by: Vega <vega@nebusec.ai>
    Signed-off-by: Zhiling Zou <zhilinz@nebusec.ai>
    Signed-off-by: Ren Wei <enjou1224z@gmail.com>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Link: https://patch.msgid.link/4b8acb7787d54e440155585dd32ebdf0bef7d122.1784710966.git.zhilinz@nebusec.ai
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: libwx: fix FDIR ATR queue mismatch for software VLAN packets [+ + +]
Author: Jiawen Wu <jiawenwu@trustnetic.com>
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 <jiawenwu@trustnetic.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/0879DA38A8E32701+20260724074657.10773-1-jiawenwu@trustnetic.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: mana: Create separate EQs for each vPort [+ + +]
Author: Long Li <longli@microsoft.com>
Date:   Thu Jun 4 17:57:10 2026 -0700

    net: mana: Create separate EQs for each vPort
    
    [ Upstream commit fa1a3b7bcd161028e038025c1a4a8963b2f56a95 ]
    
    To prepare for assigning vPorts to dedicated MSI-X vectors, remove EQ
    sharing among the vPorts and create dedicated EQs for each vPort.
    
    Move the EQ definition from struct mana_context to struct mana_port_context
    and update related support functions. Export mana_create_eq() and
    mana_destroy_eq() for use by the MANA RDMA driver.
    
    RSS QPs now take a vport reference via pd->vport_use_count to ensure
    EQs outlive all QP consumers. The vport must already be configured by
    a raw QP before an RSS QP can be created. EQs are only destroyed when
    the last QP (raw or RSS) on the PD releases its reference.
    
    Restrict each vport to a single RSS QP. The hardware only supports one
    steering configuration (indirection table / hash key) per vport, and
    mana_disable_vport_rx() on QP destroy disables RX globally for the
    vport. Previously, creating a second RSS QP would silently overwrite
    the first QP's steering config and destroy would blackhole all traffic.
    This is now explicitly rejected with -EBUSY. Existing applications
    (DPDK being the primary RDMA consumer) always create one RSS QP per
    vport, so no real-world flows are affected.
    
    Reject cross-port PD sharing for both raw and RSS QPs. Since EQs and
    vport configuration are per-port, a PD is bound to the port used by
    its first raw QP. Subsequent QPs on the same PD must use the same
    port or the creation fails with -EINVAL. Previously this was silently
    broken: with shared EQs it appeared to work, but with per-vPort EQs
    a cross-port PD would cause wrong-port EQ teardown and corruption.
    DPDK creates one PD per port so no existing flows are affected.
    
    Serialize mana_set_channels() and the async per-port queue reset
    handler against RDMA vport configuration to prevent RDMA from claiming
    the vport during the detach/attach window. A channel_changing flag is
    set under apc->vport_mutex before detach and checked by
    mana_cfg_vport() when called from the RDMA path, blocking RDMA from
    grabbing the vport during the entire window. When the port is down
    and RDMA already holds the vport, the channel change is rejected with
    -EBUSY.
    
    Signed-off-by: Long Li <longli@microsoft.com>
    Link: https://patch.msgid.link/20260605005717.2059954-2-longli@microsoft.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: e67cc80b50f5 ("net: mana: Return error code from mana_create_rxq()")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: mana: Return error code from mana_create_rxq() [+ + +]
Author: Aditya Garg <gargaditya@linux.microsoft.com>
Date:   Mon Jul 27 04:37:59 2026 -0700

    net: mana: Return error code from mana_create_rxq()
    
    [ Upstream commit e67cc80b50f587cd1d8ffc8989dcec3291720bc3 ]
    
    mana_create_rxq() returns a struct mana_rxq pointer and returns NULL on
    any failure. The caller, mana_add_rx_queues(), cannot tell what went
    wrong and hardcodes the error as -ENOMEM. As a result the actual failure
    reported by the lower layers (for example -EPROTO from a failed HW
    request) is masked and every RX queue creation failure looks like an
    out-of-memory error.
    
    Return an ERR_PTR() encoded error code from mana_create_rxq() on failure
    instead of NULL. The caller now propagates the returned error code
    directly instead of substituting -ENOMEM.
    
    Fixes: ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)")
    Signed-off-by: Aditya Garg <gargaditya@linux.microsoft.com>
    Reviewed-by: Joe Damato <joe@dama.to>
    Link: https://patch.msgid.link/20260727113759.2881500-1-gargaditya@linux.microsoft.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: mpls: initialize rtm_tos in mpls_getroute() [+ + +]
Author: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
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 <yhlee@isslab.korea.ac.kr>
    Link: https://patch.msgid.link/20260723010830.289917-1-yhlee@isslab.korea.ac.kr
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
net: openvswitch: fix potential UAF on meter attach failure [+ + +]
Author: Ilya Maximets <i.maximets@ovn.org>
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: stable@vger.kernel.org
    Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
    Reviewed-by: Eelco Chaudron <echaudro@redhat.com>
    Link: https://patch.msgid.link/20260727121022.198461-1-i.maximets@ovn.org
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: openvswitch: fix skb leak on flow key update failure during ct [+ + +]
Author: Ilya Maximets <i.maximets@ovn.org>
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: stable@vger.kernel.org
    Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
    Reviewed-by: Aaron Conole <aconole@redhat.com>
    Link: https://patch.msgid.link/20260727181851.306076-3-i.maximets@ovn.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: openvswitch: fix skb leak on flow key update failure during recirculation [+ + +]
Author: Ilya Maximets <i.maximets@ovn.org>
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: stable@vger.kernel.org
    Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
    Reviewed-by: Aaron Conole <aconole@redhat.com>
    Link: https://patch.msgid.link/20260727181851.306076-2-i.maximets@ovn.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: phylink: put link_gpio if phylink_create fails [+ + +]
Author: Christian Marangi <ansuelsmth@gmail.com>
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 <ansuelsmth@gmail.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://patch.msgid.link/20260726150806.2437-1-ansuelsmth@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: pktgen: fix proc entry use-after-free [+ + +]
Author: Chengfeng Ye <nicoyip.dev@gmail.com>
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: stable@vger.kernel.org
    Signed-off-by: Chengfeng Ye <nicoyip.dev@gmail.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20260719145740.2888967-1-nicoyip.dev@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: stmmac: Fix E2E delay mechanism [+ + +]
Author: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@altera.com>
Date:   Mon Jul 27 23:09:04 2026 -0700

    net: stmmac: Fix E2E delay mechanism
    
    [ Upstream commit b041ed62aa6e3b2d7d36127e0e5d7bf2701f8231 ]
    
    For E2E delay mechanism, "received DELAY_REQ without timestamp" error
    messages show up for dwmac v3.70+ and dwxgmac IPs.
    
    This issue affects socfpga platforms, Agilex7 (dwmac 3.70) and
    Agilex5 (dwxgmac). According to the databook, to enable timestamping
    for all events, the SNAPTYPSEL bits in the MAC_Timestamp_Control
    register must be set to 2'b01, and the TSEVNTENA bit must be cleared
    to 0'b0.
    
    Commit 3cb958027cb8 ("net: stmmac: Fix E2E delay mechanism") already
    addresses this problem for all dwmacs above version v4.10. However,
    same holds true for v3.70 and above, as well as for dwxgmac. Updates
    the check accordingly.
    
    Fixes: 14f347334bf2 ("net: stmmac: Correctly take timestamp for PTPv2")
    Fixes: f2fb6b6275eb ("net: stmmac: enable timestamp snapshot for required PTP packets in dwmac v5.10a")
    Fixes: 3cb958027cb8 ("net: stmmac: Fix E2E delay mechanism")
    Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
    Signed-off-by: Rohan G Thomas <rohan.g.thomas@altera.com>
    Signed-off-by: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@altera.com>
    Link: https://patch.msgid.link/20260728060904.31993-1-muhammad.nazim.amirul.nazle.asmade@altera.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: sxgbe: check descriptor ring allocation failures [+ + +]
Author: Chenguang Zhao <zhaochenguang@kylinos.cn>
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 <zhaochenguang@kylinos.cn>
    Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: sxgbe: free TX rings on RX allocation failure [+ + +]
Author: Chenguang Zhao <zhaochenguang@kylinos.cn>
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 <zhaochenguang@kylinos.cn>
    Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: udp_tunnel: fix memory leak in udp_tunnel_nic_unregister() [+ + +]
Author: Eric Dumazet <edumazet@google.com>
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: syzbot+eca845fb8c18dd6b44c1@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/netdev/6a632b15.dde6c935.cf6c8.0011.GAE@google.com/T/#u
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Link: https://patch.msgid.link/20260724091137.1792543-1-edumazet@google.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
netfilter: ipset: do not update comments from kernel-side hash adds [+ + +]
Author: David Lee <david.lee@trailofbits.com>
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: stable@vger.kernel.org
    Signed-off-by: David Lee <david.lee@trailofbits.com>
    Assisted-by: Codex:gpt-5.5
    Acked-by: Jozsef Kadlecsik <kadlec@netfilter.org>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

netfilter: nf_conntrack_expect: add and use nf_ct_expect_related_pair() [+ + +]
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date:   Mon Jul 13 00:26:04 2026 +0200

    netfilter: nf_conntrack_expect: add and use nf_ct_expect_related_pair()
    
    [ Upstream commit 4aa63842fc92de1bce59d4709a0d32e718890bb2 ]
    
    Add a new function to insert a pair of expectations, this is required by
    the SIP and H323 NAT helpers. The spinlock is held to check if there is
    a slot for both expectations, in such case, insert them.
    
    This removes the need for nf_ct_unexpect_related() inside the loop to
    find a pair of consecutive ports, otherwise inserting expectations whose
    dead flag is already set on can happen.
    
    Bump master_help->expecting for the expectation class after checking if
    the expectation fits in the master expectation list, which is needed for
    this new _pair() function variant to run the eviction routine including
    the preallocated slot for the first expectation in the pair.
    
    Fixes: b8b09dc2bf35 ("netfilter: nf_conntrack_expect: use conntrack GC to reap expectations")
    Reported-by: Jaeyeong Lee <iostreampy@proton.me>
    Link: https://patch.msgid.link/178377968720.33756.12204817361601593230@proton.me/
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

netfilter: nf_conntrack_sip: widen NAT rewrite delta to s32 in sip_help_tcp() [+ + +]
Author: Xiang Mei <xmei5@asu.edu>
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 <bestswngs@gmail.com>
    Link: https://patch.msgid.link/netfilter-devel/20260712234201.3213635-1-xmei5@asu.edu
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: Xiang Mei <xmei5@asu.edu>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

netfilter: nf_tables: make nft_object rhltable per table [+ + +]
Author: Pablo Neira Ayuso <pablo@netfilter.org>
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 <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

netfilter: nft_payload: fix mask build for partial field offload [+ + +]
Author: Xiang Mei (Microsoft) <xmei5@asu.edu>
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: AutonomousCodeSecurity@microsoft.com
    Signed-off-by: Xiang Mei (Microsoft) <xmei5@asu.edu>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

netfilter: xt_hashlimit: validate hashtable supports XT_HASHLIMIT_RATE_MATCH [+ + +]
Author: Pablo Neira Ayuso <pablo@netfilter.org>
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 <talha.anything.info@gmail.com>
    Link: https://patch.msgid.link/20260721074629.668-1-talha.anything.info@gmail.com/
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
netfs: clear PG_private_2 on copy-to-cache append failure [+ + +]
Author: Yichong Chen <chenyichong@uniontech.com>
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 <chenyichong@uniontech.com>
    Signed-off-by: David Howells <dhowells@redhat.com>
    Link: https://patch.msgid.link/20260727130716.1099906-2-dhowells@redhat.com
    cc: Paulo Alcantara <pc@manguebit.org>
    cc: netfs@lists.linux.dev
    cc: linux-fsdevel@vger.kernel.org
    Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

netfs: Fix folio_queue ENOMEM in writeback by adding a mempool [+ + +]
Author: David Howells <dhowells@redhat.com>
Date:   Mon Jul 27 14:07:15 2026 +0100

    netfs: Fix folio_queue ENOMEM in writeback by adding a mempool
    
    [ Upstream commit 1d78d56c43ef3768183e8370e7367b162700e049 ]
    
    Fix the handling of folio_queue allocation failure in writeback by adding a
    mempool and passing in gfp_t flags to the rolling buffer functions that
    allocate memory, using the mempool if gfp != GFP_KERNEL.
    
    This is then extended upwards and the gfp to be used for a request is stored
    in the netfs_io_request struct and is then used for both requests and
    subrequests, eliminating the sleeping loops there.
    
    The failure caused:
    
        folio != NULL
        WARNING: fs/netfs/write_issue.c:603 at netfs_writepages+0x883/0xa10 fs/netfs/write_issue.c:603, CPU#3: syz.0.17/5919
    
    Fixes: cd0277ed0c18 ("netfs: Use new folio_queue data type and iterator instead of xarray iter")
    Reported-by: syzbot+0da43efa72f88bd3a8af@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=0da43efa72f88bd3a8af
    Signed-off-by: David Howells <dhowells@redhat.com>
    Link: https://patch.msgid.link/20260727130716.1099906-5-dhowells@redhat.com
    Tested-by: syzbot+0da43efa72f88bd3a8af@syzkaller.appspotmail.com
    cc: Paulo Alcantara <pc@manguebit.org>
    cc: Yun Zhou <yun.zhou@windriver.com>
    cc: Matthew Wilcox <willy@infradead.org>
    cc: Christoph Hellwig <hch@infradead.org>
    cc: netfs@lists.linux.dev
    cc: linux-fsdevel@vger.kernel.org
    Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

netfs: handle single writeback rolling buffer allocation failure [+ + +]
Author: Yichong Chen <chenyichong@uniontech.com>
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 <chenyichong@uniontech.com>
    Signed-off-by: David Howells <dhowells@redhat.com>
    Link: https://patch.msgid.link/20260727130716.1099906-3-dhowells@redhat.com
    cc: Paulo Alcantara <pc@manguebit.org>
    cc: netfs@lists.linux.dev
    cc: linux-fsdevel@vger.kernel.org
    Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

netfs: release readahead folios on iterator preparation failure [+ + +]
Author: Yichong Chen <chenyichong@uniontech.com>
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 <chenyichong@uniontech.com>
    Signed-off-by: David Howells <dhowells@redhat.com>
    Link: https://patch.msgid.link/20260727130716.1099906-4-dhowells@redhat.com
    cc: Paulo Alcantara <pc@manguebit.org>
    cc: netfs@lists.linux.dev
    cc: linux-fsdevel@vger.kernel.org
    Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
nexthop: avoid unlocked f6i_list walk in nh_rt_cache_flush [+ + +]
Author: Xiang Mei (Microsoft) <xmei5@asu.edu>
Date:   Wed Jul 22 00:29:51 2026 +0000

    nexthop: avoid unlocked f6i_list walk in nh_rt_cache_flush
    
    [ Upstream commit 4787a6d2629b4e8c0b6bacab1f75c1660eca44d9 ]
    
    nh_rt_cache_flush() walks nh->f6i_list during an RTNL-serialized nexthop
    replace without holding nh->lock, racing the unlocked IPv6 route
    add/delete that mutate the list under nh->lock and free fib6_info
    entries (nh_rt_cache_flush() is inlined into rtm_new_nexthop()):
    
      BUG: KASAN: slab-use-after-free in nh_rt_cache_flush (net/ipv4/nexthop.c:2243)
      Read of size 8 at addr ffff888012953e18 by task exploit/146
       nh_rt_cache_flush (net/ipv4/nexthop.c:2243)
       replace_nexthop (net/ipv4/nexthop.c:2610)
       rtm_new_nexthop (net/ipv4/nexthop.c:3323)
       rtnetlink_rcv_msg (net/core/rtnetlink.c:7076)
    
    Unlike the other f6i_list walks, this one bumps each route's sernum via
    fib6_update_sernum_upto_root(), which needs tb6_lock; taking nh->lock
    around it would invert the established tb6_lock -> nh->lock order and
    deadlock. As the only purpose is to invalidate cached dsts, bump the
    IPv6 sernum for the whole netns with rt_genid_bump_ipv6() instead,
    mirroring the rt_cache_flush() already done for IPv4 just above.
    
    Fixes: 081efd18326e ("ipv6: Protect nh->f6i_list with spinlock and flag.")
    Reported-by: AutonomousCodeSecurity@microsoft.com
    Signed-off-by: Xiang Mei (Microsoft) <xmei5@asu.edu>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Link: https://patch.msgid.link/20260722002951.2614721-2-xmei5@asu.edu
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

nexthop: take nh->lock for f6i_list walks in replace check and notify [+ + +]
Author: Xiang Mei (Microsoft) <xmei5@asu.edu>
Date:   Wed Jul 22 00:29:50 2026 +0000

    nexthop: take nh->lock for f6i_list walks in replace check and notify
    
    [ Upstream commit 072cd1f21819dedd2252e704d255de3b0cfc61a7 ]
    
    fib6_check_nh_list() and __nexthop_replace_notify() walk nh->f6i_list
    during an RTNL-serialized nexthop replace without holding nh->lock. IPv6
    RTM_NEWROUTE/RTM_DELROUTE run without RTNL and mutate that list under
    nh->lock (fib6_add_rt2node_nh(), fib6_purge_rt()), so both walks race a
    concurrent route delete that unlinks and frees a fib6_info:
    
      BUG: KASAN: slab-use-after-free in rt6_fill_node.isra.0 (net/ipv6/route.c:5799)
      Read of size 4 at addr ffff888014607e64 by task exploit/143
       rt6_fill_node.isra.0 (net/ipv6/route.c:5799)
       fib6_rt_update (net/ipv6/route.c:6412)
       __nexthop_replace_notify (net/ipv4/nexthop.c:2542)
       rtm_new_nexthop (net/ipv4/nexthop.c:2554)
       rtnetlink_rcv_msg (net/core/rtnetlink.c:7076)
    
      BUG: KASAN: slab-use-after-free in fib6_check_nh_list (net/ipv4/nexthop.c:1605)
      Read of size 8 at addr ffff888014a7d068 by task exploit/142
       fib6_check_nh_list (net/ipv4/nexthop.c:1605)
       rtm_new_nexthop (net/ipv4/nexthop.c:2575)
       rtnetlink_rcv_msg (net/core/rtnetlink.c:7076)
    
    Both walks only read the entries and take no tb6_lock, so protect them
    with nh->lock; fib6_rt_update() uses gfp_any(), which returns GFP_ATOMIC
    under the lock.
    
    Fixes: 081efd18326e ("ipv6: Protect nh->f6i_list with spinlock and flag.")
    Reported-by: AutonomousCodeSecurity@microsoft.com
    Signed-off-by: Xiang Mei (Microsoft) <xmei5@asu.edu>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Link: https://patch.msgid.link/20260722002951.2614721-1-xmei5@asu.edu
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ntfs: drop stale page-cache when shrinking a non-resident attr [+ + +]
Author: Namjae Jeon <linkinjeon@kernel.org>
Date:   Mon Jul 13 16:49:57 2026 +0900

    ntfs: drop stale page-cache when shrinking a non-resident attr
    
    [ Upstream commit 4e646ecd44759e552b0b9ccd995f3f608daab414 ]
    
    ntfs_non_resident_attr_shrink() shrinks attribute sizes but fails to
    trim the page cache. This leaves orphaned dirty folios beyond the new
    end of the attribute, leading to writeback failures (-ENOENT), data
    loss, and $EA chain corruption.
    
    Fix this by truncating the page cache to the new size immediately after
    updating the sizes, preventing writeback from flushing out-of-range folios.
    
    Fixes: 495e90fa3348 ("ntfs: update attrib operations")
    Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ntfs: harden runlist realloc size calculations [+ + +]
Author: Namjae Jeon <linkinjeon@kernel.org>
Date:   Fri Jul 10 14:22:57 2026 +0900

    ntfs: harden runlist realloc size calculations
    
    [ Upstream commit 8bed376124ab4505b70083a2b91f2c7ef6d51e24 ]
    
    Add a shared helper to safely convert runlist element counts to byte sizes
    using overflow checks, and use it in both ntfs_rl_realloc() and
    ntfs_rl_realloc_nofail().
    
    Fixes: 11ccc9107dc4 ("ntfs: update runlist handling and cluster allocator")
    Co-developed-by: Alper Mudar <kommandant_alper@proton.me>
    Signed-off-by: Alper Mudar <kommandant_alper@proton.me>
    Tested-by: Alper Mudar <kommandant_alper@proton.me>
    Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ntfs: preserve RECALL_ON_OPEN on WSL special-file reparse points [+ + +]
Author: Namjae Jeon <linkinjeon@kernel.org>
Date:   Sat Jul 11 16:36:55 2026 +0900

    ntfs: preserve RECALL_ON_OPEN on WSL special-file reparse points
    
    [ Upstream commit 523307b8516fc740895238af8473aa0630b3e088 ]
    
    When creating a WSL special file (socket, fifo, character or block
    device), __ntfs_create() sets FILE_ATTRIBUTE_RECALL_ON_OPEN in ni->flags
    as valid_reparse_data() requires for these tags. This flag is
    intentionally absent from $FILE_NAME, so the subsequent reload
    
            ni->flags = fn->file_attributes;
    
    drops it from ni->flags, the authoritative copy written back to
    $STANDARD_INFORMATION. The on-disk file_attributes becomes 0x00000404
    instead of 0x00040404, and after a remount valid_reparse_data() rejects
    the reparse point while fsck reports "$REPARSE_POINT data is corrupted".
    
    Preserve the RECALL_ON_OPEN bit across the reload. Symlinks do not set
    that bit, so they are unaffected.
    
    Fixes: af0db57d4293 ("ntfs: update inode operations")
    Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ocfs2: fix boundary check in ocfs2_check_dir_entry() to use buffer offset [+ + +]
Author: Joseph Qi <joseph.qi@linux.alibaba.com>
Date:   Fri Jul 10 12:05:12 2026 +0800

    ocfs2: fix boundary check in ocfs2_check_dir_entry() to use buffer offset
    
    commit df8ce7ab48d01ac4f247599b35f0506d95ff57e1 upstream.
    
    Commit 390ac56cf0f6 ("ocfs2: add boundary check to
    ocfs2_check_dir_entry()") added an out-of-bounds guard using the
    caller-supplied 'offset' argument:
    
            if (offset > size - OCFS2_DIR_REC_LEN(1))
                    return 0;
    
    However, 'offset' and 'size' are not measured against the same base for
    all callers.  In the block-based lookup path, ocfs2_find_entry_el() passes
    'offset' as an absolute offset into the whole directory:
    
            i = ocfs2_search_dirblock(bh, dir, name, namelen,
                                      block << sb->s_blocksize_bits,
                                      bh->b_data, sb->s_blocksize, res_dir);
    
    while 'size' is a single block size (sb->s_blocksize).  For any directory
    entry located in the second or later block, 'offset' is >=
    sb->s_blocksize, so the guard rejects every such entry even though it is
    perfectly valid and lies entirely within its block buffer.
    
    This makes mounting fail for filesystems whose system directory spans more
    than one block, e.g.  a volume formatted with a small block size:
    
      mkfs.ocfs2 -b 512 -C 4096 -N 2 -T datafiles --fs-features=usrquota,grpquota
    
      ocfs2_check_dir_entry:314 ERROR: directory entry (#18: offset=512) too close to end or out-of-bounds
      ocfs2_init_local_system_inodes:496 ERROR: status=-22, sysfile=12, slot=0
      ocfs2_mount_volume:1757 ERROR: status = -22
    
    The dirent's position within the buffer being validated is ((char *)de -
    buf), which is what the rest of the function already uses (via
    next_offset) and what must be bounds-checked against 'size'.  Compute that
    buffer-relative offset and use it for the guard.  The subtraction is
    reordered to size - buf_offset < OCFS2_DIR_REC_LEN(1) to avoid an unsigned
    underflow when size is smaller than the minimal record length.
    
    Link: https://lore.kernel.org/20260710040512.3310736-1-joseph.qi@linux.alibaba.com
    Fixes: 390ac56cf0f6 ("ocfs2: add boundary check to ocfs2_check_dir_entry()")
    Signed-off-by: Joseph Qi <joseph.qi@linux.alibaba.com>
    Reviewed-by: Dmitry Antipov <dmantipov@yandex.ru>
    Tested-by: Dmitry Antipov <dmantipov@yandex.ru>
    Cc: Mark Fasheh <mark@fasheh.com>
    Cc: Joel Becker <jlbec@evilplan.org>
    Cc: Junxiao Bi <junxiao.bi@oracle.com>
    Cc: Changwei Ge <gechangwei@live.cn>
    Cc: Jun Piao <piaojun@huawei.com>
    Cc: Heming Zhao <heming.zhao@suse.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
octeontx2-af: Block VFs from clobbering special CGX PKIND state [+ + +]
Author: Hariprasad Kelam <hkelam@marvell.com>
Date:   Wed Jul 22 13:42:29 2026 +0530

    octeontx2-af: Block VFs from clobbering special CGX PKIND state
    
    [ Upstream commit 3bd438a58e910db5dc369aa25dfed1fc95f1b596 ]
    
    PF and VF NIX LFs that share a CGX LMAC reuse the same hardware PKIND
    programming. When HiGig2 or EDSA parsing is enabled, a VF NIX LF alloc must
    not reset the LMAC RX PKIND or default TX parse config over the PF setup.
    
    Add cgx_get_pkind() and rvu_cgx_is_pkind_config_permitted() so VFs skip
    cgx_set_pkind(), rvu_npc_set_pkind(), and NIX_AF_LFX_TX_PARSE_CFG updates
    when the LMAC is using NPC_RX_HIGIG_PKIND or NPC_RX_EDSA_PKIND.
    
    Fixes: 94d942c5fb97 ("octeontx2-af: Config pkind for CGX mapped PFs")
    Cc: Geetha sowjanya <gakula@marvell.com>
    Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
    Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
    Link: https://patch.msgid.link/20260722081229.1653619-1-rkannoth@marvell.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
octeontx2-pf: Set correct sequence for carrier off and tx queue stop [+ + +]
Author: Suman Ghosh <sumang@marvell.com>
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 <sumang@marvell.com>
    Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20260724072831.2415281-1-rkannoth@marvell.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
octeontx2: cn20k: Coordinate default rules with NIX LF lifecycle [+ + +]
Author: Ratheesh Kannoth <rkannoth@marvell.com>
Date:   Tue Jun 9 09:34:50 2026 +0530

    octeontx2: cn20k: Coordinate default rules with NIX LF lifecycle
    
    [ Upstream commit aac055dbc0fadf64c9d6fbcfc066b8ba33216dc4 ]
    
    Add NIX_LF_DONT_FREE_DFT_IDXS so the PF can send NIX LF free during hw
    reinit or teardown without the AF freeing CN20K default NPC rule indexes
    while the driver still owns that state (otx2_init_hw_resources and
    otx2_free_hw_resources).
    
    On CN20K, allocate default NPC rules from NIX LF alloc before
    nix_interface_init, roll back with npc_cn20k_dft_rules_free on failure,
    and free from NIX LF free when the new flag is not set. Tighten
    rvu_mbox_handler_nix_lf_alloc error handling: use a single rc, propagate
    qmem_alloc and other errors, and set -ENOMEM only when kcalloc fails
    (remove the blanket -ENOMEM at the free_mem path).
    
    Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
    Link: https://patch.msgid.link/20260609040453.711932-7-rkannoth@marvell.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: 3bd438a58e91 ("octeontx2-af: Block VFs from clobbering special CGX PKIND state")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
of/address: Fix NULL bus dereference in of_pci_range_parser_one() [+ + +]
Author: Carlo Caione <ccaione@baylibre.com>
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: stable@vger.kernel.org
    Signed-off-by: Carlo Caione <ccaione@baylibre.com>
    Link: https://patch.msgid.link/20260727-of-range-parser-null-bus-v3-1-be01b708a4ce@baylibre.com
    Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
of: reserved_mem: prevent OOB when too many dynamic regions are defined [+ + +]
Author: Sang-Heon Jeon <ekffu200098@gmail.com>
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 <ekffu200098@gmail.com>
    Link: https://patch.msgid.link/20260614133807.2165124-2-ekffu200098@gmail.com
    Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
PCI: imx6: Keep i.MX6 Root Port MSI/MSI-X Capabilities with iMSI-RX to work around hardware bug [+ + +]
Author: Soeren Moch <smoch@web.de>
Date:   Fri Jul 17 11:32:03 2026 +0800

    PCI: imx6: Keep i.MX6 Root Port MSI/MSI-X Capabilities with iMSI-RX to work around hardware bug
    
    commit b4bee12ebeccfcd5959ace2c3a4af08f5a917d4c upstream.
    
    On some NXP chipsets, disabling Root Port MSI/MSI-X Capabilities blocks
    MSIs originating from Endpoints from reaching the iMSI-RX controller.
    
    To address this hardware bug, commit 3a4e8302e72f ("PCI: imx6: Keep Root
    Port MSI capability with iMSI-RX to work around hardware bug") preserves
    Root Port MSI and MSI-X Capabilities on i.MX7D, i.MX8MM, and i.MX8MQ
    when iMSI-RX is in use.
    
    The same applies to i.MX6Q, i.MX6QP, and i.MX6SX, so preserve Root Port
    MSI/MSI-X Capabilities there as well.
    
    Note that preserving these Capabilities means Root Port-originated MSIs
    such as AER and PME won't be received due to separate hardware limitations.
    Users may need to use workarounds such as passing the 'pcie_pme=nomsi'
    command-line parameter.
    
    Fixes: f5cd8a929c825 ("PCI: dwc: Remove MSI/MSIX capability for Root Port if iMSI-RX is used as MSI controller")
    Signed-off-by: Soeren Moch <smoch@web.de>
    Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
    Acked-by: Richard Zhu <hongxing.zhu@nxp.com>
    Cc: stable@vger.kernel.org # 7.0+
    Link: https://patch.msgid.link/20260717033203.2965045-1-hongxing.zhu@oss.nxp.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
phy: qcom: m31-eusb2: Fix return value of init call [+ + +]
Author: Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>
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 <krishna.kurapati@oss.qualcomm.com>
    Link: https://patch.msgid.link/20260718-m31-eusb2-fix-v1-1-8588a1b94d76@oss.qualcomm.com
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

phy: zynqmp: fix clock error handling in xpsgtr_phy_init() [+ + +]
Author: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
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 <radhey.shyam.pandey@amd.com>
    Reviewed-by: Michal Simek <michal.simek@amd.com>
    Link: https://patch.msgid.link/20260720153832.1130006-2-radhey.shyam.pandey@amd.com
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

phy: zynqmp: fix L0_TM_DISABLE_SCRAMBLE_ENCODER mask [+ + +]
Author: Nava kishore Manne <nava.kishore.manne@amd.com>
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: stable@vger.kernel.org
    Signed-off-by: Nava kishore Manne <nava.kishore.manne@amd.com>
    Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
    Acked-by: Michal Simek <michal.simek@amd.com>
    Link: https://patch.msgid.link/20260627155229.2791113-2-radhey.shyam.pandey@amd.com
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

phy: zynqmp: fix runtime PM leak on probe allocation failure [+ + +]
Author: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
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 <radhey.shyam.pandey@amd.com>
    Reviewed-by: Michal Simek <michal.simek@amd.com>
    Link: https://patch.msgid.link/20260720153832.1130006-3-radhey.shyam.pandey@amd.com
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

phy: zynqmp: keep SERDES scrambler and 8b/10b enabled for USB [+ + +]
Author: Nava kishore Manne <nava.kishore.manne@amd.com>
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: stable@vger.kernel.org
    Signed-off-by: Nava kishore Manne <nava.kishore.manne@amd.com>
    Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
    Acked-by: Michal Simek <michal.simek@amd.com>
    Link: https://patch.msgid.link/20260627155229.2791113-4-radhey.shyam.pandey@amd.com
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

phy: zynqmp: use read-modify-write for SERDES scrambler bypass [+ + +]
Author: Nava kishore Manne <nava.kishore.manne@amd.com>
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: stable@vger.kernel.org
    Signed-off-by: Nava kishore Manne <nava.kishore.manne@amd.com>
    Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
    Acked-by: Michal Simek <michal.simek@amd.com>
    Link: https://patch.msgid.link/20260627155229.2791113-3-radhey.shyam.pandey@amd.com
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
pinctrl-amd: Don't clear S4 wake bits at probe [+ + +]
Author: Mario Limonciello <mario.limonciello@amd.com>
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 <mario.limonciello@amd.com>
    Signed-off-by: Linus Walleij <linusw@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
pinctrl: bm1880: add missing select GENERIC_PINCONF [+ + +]
Author: Benjamin Boortz <bennib@mailbox.org>
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: stable@vger.kernel.org
    Signed-off-by: Benjamin Boortz <bennib@mailbox.org>
    Signed-off-by: Linus Walleij <linusw@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

pinctrl: devicetree: don't free uninitialized dev_name on error path [+ + +]
Author: Karl Mehltretter <kmehltretter@gmail.com>
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: stable@vger.kernel.org
    Assisted-by: Claude:claude-fable-5
    Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
    Signed-off-by: Linus Walleij <linusw@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

pinctrl: microchip-sgpio: add missing select REGMAP_MMIO [+ + +]
Author: Benjamin Boortz <bennib@mailbox.org>
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: stable@vger.kernel.org
    Signed-off-by: Benjamin Boortz <bennib@mailbox.org>
    Reviewed-by: Andy Shevchenko <andy@kernel.org>
    Signed-off-by: Linus Walleij <linusw@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

pinctrl: qcom: sc8280xp: Add missing wakeup entries for GPIO143/151 [+ + +]
Author: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
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 <konrad.dybcio@oss.qualcomm.com>
    Link: https://patch.msgid.link/20260626-topic-8280_pinctrl_wakeup-v1-1-2ccb267148f5@oss.qualcomm.com
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

pinctrl: qcom: Unconditionally mark gpio as wakeup enable [+ + +]
Author: Sneh Mankad <sneh.mankad@oss.qualcomm.com>
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 <sneh.mankad@oss.qualcomm.com>
    Reviewed-by: Maulik Shah <maulik.shah@oss.qualcomm.com>
    Reviewed-by: Linus Walleij <linusw@kernel.org>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Link: https://patch.msgid.link/20260616-enable_wakeup_capable_gpios-v3-1-fb59647d89cb@oss.qualcomm.com
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
power: supply: bq25890: fix the -10 C NTC lookup entry [+ + +]
Author: Xu Rao <raoxu@uniontech.com>
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: stable@vger.kernel.org
    Signed-off-by: Xu Rao <raoxu@uniontech.com>
    Link: https://patch.msgid.link/0619C8BF15F43B7C+20260723065444.1796002-1-raoxu@uniontech.com
    Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

power: supply: macsmc: Support macOS 27 SMC firmware [+ + +]
Author: Sasha Finkelstein <k@chaosmail.tech>
Date:   Sun Jul 12 00:48:56 2026 +0200

    power: supply: macsmc: Support macOS 27 SMC firmware
    
    commit f7b253a6e217f71d754d70c525e9b4c1dcbd4414 upstream.
    
    The SMC firmware included in macOS 27 changed the size of BCF0 key from
    4 to 1 bytes. This key is used for indicating that battery state is
    critically low. In addition, B0RM key has changed endianness.
    
    Reviewed-by: Sven Peter <sven@kernel.org>
    Reviewed-by: Joshua Peisach <jpeisach@ubuntu.com>
    Reviewed-by: Janne Grunau <j@jannau.net>
    Cc: stable@vger.kernel.org
    Fixes: 0ebf821cf6c7 ("power: supply: Add macsmc-power driver for Apple Silicon")
    Signed-off-by: Sasha Finkelstein <k@chaosmail.tech>
    Link: https://patch.msgid.link/20260712-gate-power-v4-1-aa59c6583247@chaosmail.tech
    Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

power: supply: max17040: handle missing status supplier [+ + +]
Author: Jianing Li <m13940358460@163.com>
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: stable@vger.kernel.org # 6.7+
    Signed-off-by: Jianing Li <m13940358460@163.com>
    Link: https://patch.msgid.link/20260701061042.1008-1-m13940358460@163.com
    Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
powerpc/boot: Fix simpleboot CPU node lookup check [+ + +]
Author: Thorsten Blum <thorsten.blum@linux.dev>
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 <thorsten.blum@linux.dev>
    Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
    Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
    Link: https://patch.msgid.link/20260702211554.56923-4-thorsten.blum@linux.dev
    Signed-off-by: Sasha Levin <sashal@kernel.org>

powerpc/boot: Fix treeboot-akebono CPU node lookup check [+ + +]
Author: Thorsten Blum <thorsten.blum@linux.dev>
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 <thorsten.blum@linux.dev>
    Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
    Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
    Link: https://patch.msgid.link/20260702211554.56923-6-thorsten.blum@linux.dev
    Signed-off-by: Sasha Levin <sashal@kernel.org>

powerpc/boot: Fix treeboot-currituck CPU node lookup check [+ + +]
Author: Thorsten Blum <thorsten.blum@linux.dev>
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 <thorsten.blum@linux.dev>
    Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
    Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
    Link: https://patch.msgid.link/20260702211554.56923-5-thorsten.blum@linux.dev
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
powerpc/ps3: Fix map failure path in dma_ioc0_map_pages() [+ + +]
Author: Thorsten Blum <thorsten.blum@linux.dev>
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: stable@vger.kernel.org
    Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
    Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
    Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
    Link: https://patch.msgid.link/20260711130931.740719-3-thorsten.blum@linux.dev
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ptp: netc: fix potential interrupt storm caused by incorrect unbind order [+ + +]
Author: Wei Fang <wei.fang@nxp.com>
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 <sashiko-bot@kernel.org>
    Closes: https://sashiko.dev/#/patchset/20260720012508.23227-1-wei.fang%40oss.nxp.com
    Signed-off-by: Wei Fang <wei.fang@nxp.com>
    Link: https://patch.msgid.link/20260727060348.1887464-1-wei.fang@oss.nxp.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
qede: sync udp_tunnel ports outside qede_lock in the recovery path [+ + +]
Author: Denis V. Lunev <den@openvz.org>
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 <den@openvz.org>
    CC: Andrew Lunn <andrew+netdev@lunn.ch>
    CC: "David S. Miller" <davem@davemloft.net>
    CC: Eric Dumazet <edumazet@google.com>
    CC: Jakub Kicinski <kuba@kernel.org>
    CC: Paolo Abeni <pabeni@redhat.com>
    Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
    Link: https://patch.msgid.link/20260726104311.1782900-1-den@openvz.org
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
rds: tcp: hold the RCU lock across ipv6_chk_addr() in rds_tcp_laddr_check() [+ + +]
Author: Xiang Mei <xmei5@asu.edu>
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 <bestswngs@gmail.com>
    Signed-off-by: Xiang Mei <xmei5@asu.edu>
    Reviewed-by: Allison Henderson <achender@kernel.org>
    Link: https://patch.msgid.link/20260722210203.565803-1-xmei5@asu.edu
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ring-buffer: Fix reader page read offset for remote buffers [+ + +]
Author: Vincent Donnefort <vdonnefort@google.com>
Date:   Wed Jul 29 14:36:09 2026 +0100

    ring-buffer: Fix reader page read offset for remote buffers
    
    [ Upstream commit 78cd56c2a9d2e8da763cea3b06b636266ca66911 ]
    
    A page swapped in by __rb_get_reader_page_from_remote() retains its
    stale read offset, causing subsequent reads to skip events or read
    past valid data. Fix it.
    
    Link: https://patch.msgid.link/20260729133609.4022734-1-vdonnefort@google.com
    Fixes: fbd1743ecba1 ("ring-buffer: Add non-consuming read for ring-buffer remotes")
    Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
    Reviewed-by: Keir Fraser <keirf@google.com>
    Tested-by: Keir Fraser <keirf@google.com>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ring-buffer: Fix subbuf_ids memory leak in rb_allocate_cpu_buffer() error path [+ + +]
Author: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Date:   Fri Jul 31 23:16:46 2026 +0900

    ring-buffer: Fix subbuf_ids memory leak in rb_allocate_cpu_buffer() error path
    
    [ Upstream commit 260b20d9b78bf002f89088fb62d60e8dee98f6f8 ]
    
    In rb_allocate_cpu_buffer(), cpu_buffer->subbuf_ids is allocated using
    kcalloc() when buffer->remote is non-NULL. If a subsequent page allocation
    fails (e.g., ring_buffer_desc_page() returns NULL or rb_allocate_pages()
    fails), execution jumps to fail_free_reader.
    
    While __free(kfree) automatically frees the outer cpu_buffer structure
    at scope exit, kfree(cpu_buffer) does not recursively free nested heap
    pointers such as cpu_buffer->subbuf_ids, resulting in a memory leak.
    
    Fix this by explicitly freeing cpu_buffer->subbuf_ids in the
    fail_free_reader error unwinding path when cpu_buffer->remote is set.
    
    Link: https://patch.msgid.link/178550740672.380917.6067449683620196150.stgit@devnote2
    Fixes: 2e67fabd8b77 ("ring-buffer: Introduce ring-buffer remotes")
    Assisted-by: Antigravity:gemini-3.6-flash
    Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Reviewed-by: Vincent Donnefort <vdonnefort@google.com>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
riscv/mm: use physical alignment for vmemmap_start_pfn [+ + +]
Author: Jiakai Xu <xujiakai2025@iscas.ac.cn>
Date:   Thu Jul 16 11:53:25 2026 +0000

    riscv/mm: use physical alignment for vmemmap_start_pfn
    
    commit 45ebe4540817cb540a59e4dc04014ac5dddc9990 upstream.
    
    RISC-V computes vmemmap_start_pfn by rounding phys_ram_base down to
    VMEMMAP_ADDR_ALIGN.  That alignment must therefore be expressed in the
    physical-address domain.
    
    Commit 476849b0fba4 ("riscv/mm: align vmemmap to maximal folio size")
    attempted to account for the maximal folio alignment by feeding
    MAX_FOLIO_VMEMMAP_ALIGN directly into VMEMMAP_ADDR_ALIGN.  However,
    MAX_FOLIO_VMEMMAP_ALIGN is measured in bytes of struct page storage,
    whereas VMEMMAP_ADDR_ALIGN is used to align a physical address.
    
    The mask-based compound_info encoding requires pfn_to_page(0) to be
    naturally aligned to MAX_FOLIO_VMEMMAP_ALIGN.  Commit 9f94db4c7eaa
    ("mm/sparse: check memmap alignment for compound_info_has_mask()") added a
    check for that requirement and exposed the unit mismatch on systems such
    as QEMU virt, where the DRAM base is not aligned to MAX_FOLIO_NR_PAGES *
    PAGE_SIZE.
    
    Here is the log:
    [    0.000000][    C0] ------------[ cut here ]------------
    [    0.000000][    C0] WARNING: mm/sparse.c:365 at sparse_init+0x58a/0x6fe, CPU#0: swapper/0
    [    0.000000][    C0] Modules linked in:
    [    0.000000][    C0] CPU: 0 UID: 0 PID: 0 Comm: swapper Not tainted 7.2.0-rc3-g1d8304bdd65f #2 PREEMPT
    [    0.000000][    C0] Hardware name: riscv-virtio,qemu (DT)
    [    0.000000][    C0] epc : sparse_init+0x58a/0x6fe
    [    0.000000][    C0]  ra : sparse_init+0x58a/0x6fe
    [    0.000000][    C0] epc : ffffffff86851c88 ra : ffffffff86851c88 sp : ffffffff88807a30
    [    0.000000][    C0]  gp : ffffffff8a3bf240 tp : ffffffff88842080 t0 : ff600000ffab6000
    [    0.000000][    C0]  t1 : 000000017fab6000 t2 : 65203a6573726363 s0 : ffffffff88807bc0
    [    0.000000][    C0]  s1 : 000000000e000000 a0 : 0000000000000007 a1 : 0000000000000000
    [    0.000000][    C0]  a2 : 0000000000000002 a3 : ffffffff86851c88 a4 : 0000000000000000
    [    0.000000][    C0]  a5 : ffffffff88843080 a6 : 0000000000000003 a7 : 0000000000000000
    [    0.000000][    C0]  s2 : ff60000000000000 s3 : 0040000000000000 s4 : 0004000000000000
    [    0.000000][    C0]  s5 : ffffffff8a4d92e0 s6 : ff600000ffab55e0 s7 : ffffffff88384d00
    [    0.000000][    C0]  s8 : 0000000000000003 s9 : ffffffff88384cc1 s10: ffffffff88384cc0
    [    0.000000][    C0]  s11: ffffffff8a4daae0 t3 : ffffffff915e8b20 t4 : ffffffff915e8b20
    [    0.000000][    C0]  t5 : ffffffff915e8b20 t6 : ffffffff915e8bc8 ssp : 0000000000000000
    [    0.000000][    C0] status: 0000000200000100 badaddr: ffffffff86851c88 cause: 0000000000000003
    [    0.000000][    C0] [<ffffffff86851c88>] sparse_init+0x58a/0x6fe
    [    0.000000][    C0] [<ffffffff8683d396>] mm_core_init_early+0x116/0x1e30
    [    0.000000][    C0] [<ffffffff86801edc>] start_kernel+0xd2/0x848
    
    Convert MAX_FOLIO_VMEMMAP_ALIGN to the equivalent physical alignment
    before using it in VMEMMAP_ADDR_ALIGN.  This keeps the existing
    round_down() logic while making the resulting vmemmap base satisfy the
    mask-alignment requirement.
    
    Link: https://lore.kernel.org/20260716115326.3466926-1-xujiakai2025@iscas.ac.cn
    Fixes: 476849b0fba4 ("riscv/mm: align vmemmap to maximal folio size")
    Signed-off-by: Jiakai Xu <xujiakai2025@iscas.ac.cn>
    Reviewed-by: Kiryl Shutsemau (Meta) <kas@kernel.org>
    Cc: Albert Ou <aou@eecs.berkeley.edu>
    Cc: Alexandre Ghiti <alex@ghiti.fr>
    Cc: David Hildenbrand <david@kernel.org>
    Cc: Guo Ren <guoren@kernel.org>
    Cc: Mike Rapoport <rppt@kernel.org>
    Cc: Muchun Song <muchun.song@linux.dev>
    Cc: Nam Cao <namcao@linutronix.de>
    Cc: Palmer Dabbelt <palmer@dabbelt.com>
    Cc: Vishal Moola (Oracle) <vishal.moola@gmail.com>
    Assisted-by: YuanSheng:DeepSeek-V4-Flash
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
riscv: drop __init from vec_check_unaligned_access_speed_all_cpus [+ + +]
Author: Anirudh Srinivasan <asrinivasan@oss.tenstorrent.com>
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 <asrinivasan@oss.tenstorrent.com>
    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 <pjw@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

riscv: mm: Fix out-of-bounds page-table walk during memory hot-remove [+ + +]
Author: Karl Mehltretter <kmehltretter@gmail.com>
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 <kmehltretter@gmail.com>
    Link: https://patch.msgid.link/20260729012132.24882-1-kmehltretter@gmail.com
    Signed-off-by: Paul Walmsley <pjw@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

riscv: vdso: Only try to install vDSO when present [+ + +]
Author: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Date:   Thu Jul 9 08:49:00 2026 +0200

    riscv: vdso: Only try to install vDSO when present
    
    [ Upstream commit c052927905710de1ab7364bf1925efbd12517ea3 ]
    
    vdso.so.dbg is only built with CONFIG_MMU.
    
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202607090258.iSAUYlO1-lkp@intel.com/
    Fixes: f157d411a9eb ("riscv: add missing vdso_install target")
    Fixes: 3edf39916977 ("vDSO, kbuild: Provide vDSO debug variants at runtime")
    Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
    Link: https://patch.msgid.link/20260709-riscv-install-vdso-v1-1-0ba4345419ca@linutronix.de
    Signed-off-by: Paul Walmsley <pjw@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
rtase: fix double free of multi-frag skb on DMA map failure [+ + +]
Author: Yun Lu <luyun@kylinos.cn>
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 <luyun@kylinos.cn>
    Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
    Reviewed-by: Justin Lai <justinlai0215@realtek.com>
    Link: https://patch.msgid.link/20260721023836.6691-1-luyun_611@163.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
rtla/timerlat_top: Fix on-threshold actions firing on signal [+ + +]
Author: Tomas Glozar <tglozar@redhat.com>
Date:   Mon Jul 13 16:10:47 2026 +0200

    rtla/timerlat_top: Fix on-threshold actions firing on signal
    
    [ Upstream commit fafb66e5903c2bcfc7b7e259042a8282f18a6faa ]
    
    A bug was reported when rtla-timerlat-top tool performs on-threshold
    actions, even though no threshold was hit. This is reproduced even if no
    threshold is set at all:
    
    $ rtla timerlat top -q -c 0 --on-threshold shell,command='echo BAD'
    BAD
                                         Timer Latency
    ...
    
    The bug is due to incorrect logic in timerlat_top_bpf_main_loop().
    The loop uses timerlat_bpf_wait(), the return values of which are:
    
    - > 0 (number of ringbuffer entries): at least 1 CPU hit threshold
    - = 0: time out
    - < 0: wait was interrupted by a signal
    
    Commit 3138df6f0cd0 ("rtla/timerlat: Exit top main loop on any non-zero
    wait_retval") changed the condition for "threshold hit" from
    "wait_reval == 1" (exactly 1 CPU hit threshold) to "wait_retval != 0",
    to fix a race where multiple CPUs hit the threshold at the same time.
    
    That also made it incorrectly include a signal (< 0), coming from either
    duration expired (SIGALRM) or user interrupt (SIGINT).
    
    Check for wait_retval greater than zero in the if condition to cover all
    return values correctly.
    
    Fixes: 3138df6f0cd0 ("rtla/timerlat: Exit top main loop on any non-zero wait_retval")
    Reported-by: Attila Fazekas <afazekas@redhat.com>
    Reviewed-by: Wander Lairson Costa <wander@redhat.com>
    Link: https://lore.kernel.org/r/20260713141047.687877-1-tglozar@redhat.com
    Signed-off-by: Tomas Glozar <tglozar@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
s390/dasd: Fix potential NULL pointer dereference [+ + +]
Author: Jan Höppner <hoeppner@linux.ibm.com>
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: stable@vger.kernel.org # v5.3+
    Reported-by: Vasily Gorbik <gor@linux.ibm.com>
    Acked-by: Eduard Shishkin <edward6@linux.ibm.com>
    Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
    Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
    Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
    Link: https://patch.msgid.link/20260727142840.567286-3-sth@linux.ibm.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

s390/dasd: Fix undersized format-check buffer [+ + +]
Author: Stefan Haberland <sth@linux.ibm.com>
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: stable@vger.kernel.org #4.7
    Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
    Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
    Link: https://patch.msgid.link/20260727142840.567286-4-sth@linux.ibm.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
s390/pci: Fix s390_pci_mmio_write syscall error return without MIO [+ + +]
Author: Niklas Schnelle <schnelle@linux.ibm.com>
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: stable@vger.kernel.org
    Reviewed-by: Julian Ruess <julianr@linux.ibm.com>
    Reviewed-by: Farhan Ali <alifm@linux.ibm.com>
    Fixes: a67a88b0b8de ("s390/pci: remove races against pte updates")
    Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
    Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
s390/qeth: Check CAP_NET_ADMIN for private ioctls [+ + +]
Author: Aswin Karuvally <aswin@linux.ibm.com>
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: stable@vger.kernel.org
    Suggested-by: Christian Borntraeger <borntraeger@linux.ibm.com>
    Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
    Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
    Signed-off-by: Aswin Karuvally <aswin@linux.ibm.com>
    Link: https://patch.msgid.link/20260723140050.762991-1-aswin@linux.ibm.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
s390/zcrypt: Close speculative mem read possibility [+ + +]
Author: Harald Freudenberger <freude@linux.ibm.com>
Date:   Thu Jul 23 11:54:53 2026 +0200

    s390/zcrypt: Close speculative mem read possibility
    
    commit e935cd525af4c6ed2e2c6404aa27ca19c7f39ddb upstream.
    
    The domain value is extracted from a given CCA or EP11 ioctl struct
    when a CPRB is about to be sent. Thus this is a user controlled value.
    Under some special conditions (custom device node used, administrative
    load) this value is used as an array index after bounds checking, but
    without speculation barrier.
    
    Add the missing array_index_nospec() call to prevent speculative
    execution where this domain value is used.
    
    Fixes: cfd68b33094e ("s390/zcrypt: Filter admin CPRBs on custom devices")
    Cc: stable@vger.kernel.org
    Reported-by: Christian Borntraeger <borntraeger@linux.ibm.com>
    Reviewed-by: Finn Callies <fcallies@linux.ibm.com>
    Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
    Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

s390/zcrypt: Fix buffer over-read in cca_cipher2protkey [+ + +]
Author: Harald Freudenberger <freude@linux.ibm.com>
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: stable@vger.kernel.org
    Reviewed-by: Ingo Franzki <ifranzki@linux.ibm.com>
    Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
    Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

s390/zcrypt: Fix missing mem scrub at clear key import in cca_clr2cipherkey() [+ + +]
Author: Harald Freudenberger <freude@linux.ibm.com>
Date:   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: stable@vger.kernel.org
    Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
    Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
    Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

s390/zcrypt: Fix wrong domain value verification with EP11 CPRBs [+ + +]
Author: Harald Freudenberger <freude@linux.ibm.com>
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: stable@vger.kernel.org
    Reviewed-by: Finn Callies <fcallies@linux.ibm.com>
    Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
    Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

s390/zcrypt: Validate length for CCA AES cipher key requests [+ + +]
Author: Holger Dengler <dengler@linux.ibm.com>
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 <dengler@linux.ibm.com>
    Cc: stable@vger.kernel.org # 5.4+
    Reviewed-by: Harald Freudenberger <freude@linux.ibm.com>
    Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

s390/zcrypt: Validate length for CCA ECC private key requests [+ + +]
Author: Holger Dengler <dengler@linux.ibm.com>
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 <dengler@linux.ibm.com>
    Cc: stable@vger.kernel.org # 5.10+
    Reviewed-by: Harald Freudenberger <freude@linux.ibm.com>
    Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
sched/deadline: Use revised wakeup rule only for running dl_server [+ + +]
Author: Gabriele Monaco <gmonaco@redhat.com>
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 <gmonaco@redhat.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Acked-by: Juri Lelli <juri.lelli@redhat.com>
    Tested-by: Andrea Righi <arighi@nvidia.com>
    Link: https://patch.msgid.link/20260522125833.264145-1-gmonaco@redhat.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
scsi: libiscsi: Fix stale-data leak into the SCSI sense buffer [+ + +]
Author: HyeongJun An <sammiee5311@gmail.com>
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 <sashiko-bot@kernel.org>
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: HyeongJun An <sammiee5311@gmail.com>
    Acked-by: Chris Leech <cleech@redhat.com>
    Link: https://patch.msgid.link/20260714104934.1404423-1-sammiee5311@gmail.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: libiscsi_tcp: Bound SCSI Response data segment to the connection buffer [+ + +]
Author: HyeongJun An <sammiee5311@gmail.com>
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 <cleech@redhat.com>
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: HyeongJun An <sammiee5311@gmail.com>
    Acked-by: Chris Leech <cleech@redhat.com>
    Link: https://patch.msgid.link/20260716065848.1653431-1-sammiee5311@gmail.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: libsas: Fix HA resume deadlock and hisi_sas disk-wake race [+ + +]
Author: Xingui Yang <yangxingui@huawei.com>
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 <yangxingui@huawei.com>
    Reviewed-by: John Garry <john.g.garry@oracle.com>
    Link: https://patch.msgid.link/20260716081145.3950172-1-yangxingui@huawei.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: libsas: terminate deferred commands on time out [+ + +]
Author: Damien Le Moal <dlemoal@kernel.org>
Date:   Thu Jul 9 16:02:23 2026 +0900

    scsi: libsas: terminate deferred commands on time out
    
    commit de202d2251bc181c6019b1ad3c0ba8133e5ec68d upstream.
    
    If a command times out while we have deferred non-NCQ commands waiting to
    be issued, the SCSI EH task is not immediately woken up as the waiting
    deferred commands are never issued nor completed, thus leaving the SCSI
    host in a busy state (shost->host_failed != scsi_host_busy(shost)) which
    prevents the SCSI EH task from being woken up. Eventually, when the
    deferred commands also time out, the SCSI EH task is woken up and the
    timeout processing occurs.
    
    Avoid this unnecessary additional SCSI EH wake up time with the same
    method as implemented in libata-scsi, using the eh_timed_out SCSI host
    template operation. The function sas_eh_timed_out() implements this
    operation and executes the function ata_scsi_retry_deferred_qc()
    for SATA devices.
    
    Co-developed-by: Igor Pylypiv <ipylypiv@google.com>
    Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
    Fixes: 0ea84089dbf6 ("ata: libata-scsi: avoid Non-NCQ command starvation")
    Cc: stable@vger.kernel.org
    Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
    Reviewed-by: John Garry <john.g.garry@oracle.com>
    Reviewed-by: Hannes Reinecke <hare@kernel.org>
    Tested-by: Igor Pylypiv <ipylypiv@google.com>
    Reviewed-by: Niklas Cassel <cassel@kernel.org>
    Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

scsi: mpi3mr: Fix potential deadlock in mpi3mr_fault_uevent_emit [+ + +]
Author: Chandrakanth Patil <chandrakanth.patil@broadcom.com>
Date:   Fri Jul 24 23:22:31 2026 +0530

    scsi: mpi3mr: Fix potential deadlock in mpi3mr_fault_uevent_emit
    
    [ Upstream commit ccff8c92571500fcfed21281e33daaf645bf692f ]
    
    mpi3mr_fault_uevent_emit() runs from the fault watchdog and reset paths
    where host I/O may already be blocked. GFP_KERNEL allocations here, both
    the local kzalloc_obj() and the ones inside kobject_uevent_env() itself,
    can trigger reclaim that waits on that blocked I/O and deadlock.
    
    Use memalloc_noio_save()/restore() to cover the whole call instead of
    just the local allocation.
    
    Fixes: ec54b348f274 ("scsi: mpi3mr: Record and report controller firmware faults")
    Reported-by: sashiko-bot <sashiko-bot@kernel.org>
    Closes: https://sashiko.dev/#/patchset/20260724164630.924288-1-chandrakanth.patil%40broadcom.com
    Signed-off-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com>
    Link: https://patch.msgid.link/20260724175231.935192-1-chandrakanth.patil@broadcom.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: scsi_debug: Fix REPORT ZONES alloc_len underflow OOB write [+ + +]
Author: Ibrahim Hashimov <security@auditcode.ai>
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 <dlemoal@kernel.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Ibrahim Hashimov <security@auditcode.ai>
    Assisted-by: AuditCode-AI:2026.07
    Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
    Reviewed-by: Bart Van Assche <bvanassche@acm.org>
    Link: https://patch.msgid.link/20260712183739.83915-1-security@auditcode.ai
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

scsi: target: Clear cmd_cnt when initial counter enrollment fails [+ + +]
Author: Leon Romanovsky <leon@kernel.org>
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 <leonro@nvidia.com>
    Reviewed-by: Mike Christie <michael.christie@oracle.com>
    Link: https://patch.msgid.link/20260722-reference-count-underflow-in-target-v1-1-63ab664f12fd@nvidia.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: target: iblock: Fix wrong PR ops NULL check for PREEMPT/RELEASE [+ + +]
Author: TanZheng <tanzheng@kylinos.cn>
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 <tanzheng@kylinos.cn>
    Reviewed-by: Mike Christie <michael.christie@oracle.com>
    Link: https://patch.msgid.link/20260724075850.280699-1-kensanya@163.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: ufs: core: Cancel RTC work in active-active suspend [+ + +]
Author: Guangshuo Li <lgs201920130244@gmail.com>
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 <lgs201920130244@gmail.com>
    Reviewed-by: Peter Wang <peter.wang@mediatek.com>
    Reviewed-by: Bean Huo <beanhuo@micron.com>
    Reviewed-by: Bart Van Assche <bvanassche@acm.org>
    Link: https://patch.msgid.link/20260714172726.1736967-1-lgs201920130244@gmail.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: ufs: core: Initialize hba->rpmbs list in ufshcd [+ + +]
Author: Ao Sun <ao.sun@transsion.com>
Date:   Thu Jul 23 03:45:30 2026 +0000

    scsi: ufs: core: Initialize hba->rpmbs list in ufshcd
    
    [ Upstream commit 0279fd451a9971c0d5b959fc59f3e11b55e1694e ]
    
    Initialize the hba->rpmbs list in ufshcd_alloc_host() to prevent NULL
    pointer dereference in the device teardown path if ufs_rpmb_probe()
    fails.
    
    Fixes: b06b8c421485 ("scsi: ufs: core: Add OP-TEE based RPMB driver for UFS devices")
    Co-developed-by: Jiazi Li <jiazi.li@transsion.com>
    Signed-off-by: Jiazi Li <jiazi.li@transsion.com>
    Signed-off-by: Ao Sun <ao.sun@transsion.com>
    Reviewed-by: Bean Huo <beanhuo@micron.com>
    Link: https://patch.msgid.link/20260723034440.217-1-ao.sun@transsion.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: ufs: core: Revert "Delegate the interrupt service routine to a threaded IRQ handler" [+ + +]
Author: Bart Van Assche <bvanassche@acm.org>
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 <neil.armstrong@linaro.org>
    Cc: 孙魁 (Kui Sun) <kui.sun@unisoc.com>
    Cc: André Draszik <andre.draszik@linaro.org>
    Cc: Gregory CLEMENT <gregory.clement@bootlin.com>
    Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Fixes: 3c7ac40d7322 ("scsi: ufs: core: Delegate the interrupt service routine to a threaded IRQ handler")
    Signed-off-by: Bart Van Assche <bvanassche@acm.org>
    Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Tested-by: André Draszik <andre.draszik@linaro.org> # on Pixel 6
    Reviewed-by: André Draszik <andre.draszik@linaro.org>
    Link: https://patch.msgid.link/b70eb60a01f971bed68c42c5b555929db5f835df.1784135511.git.bvanassche@acm.org
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

scsi: ufs: dt-bindings: Add missing mcq reg for qcom,sa8255p-ufshc [+ + +]
Author: Shawn Guo <shengchao.guo@oss.qualcomm.com>
Date:   Mon Jul 20 10:35:52 2026 +0800

    scsi: ufs: dt-bindings: Add missing mcq reg for qcom,sa8255p-ufshc
    
    commit 4d5282c06ca198319c2de41b10511ddcb8068f42 upstream.
    
    Qualcomm UFS controller found on SoCs SA8255P/SA8797P has a MCQ I/O address
    space. It should be defined in the bindings even though Linux driver
    currently doesn't utilize it. Fix the binding before it gets adopted by
    DTS.
    
    Fixes: e2725ed2a7fb ("scsi: ufs: dt-bindings: Document bindings for SA8255P UFS Host Controller")
    Cc: stable@vger.kernel.org
    Signed-off-by: Shawn Guo <shengchao.guo@oss.qualcomm.com>
    Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
    Link: https://patch.msgid.link/20260720023552.2667237-1-shengchao.guo@oss.qualcomm.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

scsi: zfcp: Fix memory leak during adapter release by destroying gid_pn_req [+ + +]
Author: Benjamin Block <bblock@linux.ibm.com>
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 <bblock@linux.ibm.com>
    Tested-by: M Nikhil <nikh1092@linux.ibm.com>
    Acked-by: M Nikhil <nikh1092@linux.ibm.com>
    Reviewed-by: Chinmaya Kajagar <chinmayk@linux.ibm.com>
    Reviewed-by: Nihar Panda <niharp@linux.ibm.com>
    Link: https://patch.msgid.link/20260720072736.3381816-2-niharp@linux.ibm.com
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
sctp: prevent peer transport count overflow [+ + +]
Author: Asim Viladi Oglu Manizada <manizada@pm.me>
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: stable@vger.kernel.org
    Signed-off-by: Asim Viladi Oglu Manizada <manizada@pm.me>
    Acked-by: Xin Long <lucien.xin@gmail.com>
    Link: https://patch.msgid.link/20260725032053.521705-1-manizada@pm.me
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

sctp: reject stale cookies with mismatched verification tags [+ + +]
Author: Yuxiang Yang <yangyx22@mails.tsinghua.edu.cn>
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: stable@vger.kernel.org
    Signed-off-by: Yuxiang Yang <yangyx22@mails.tsinghua.edu.cn>
    Acked-by: Xin Long <lucien.xin@gmail.com>
    Link: https://patch.msgid.link/20260723225623.2658868-1-yangyx22@mails.tsinghua.edu.cn
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

sctp: validate Adaptation Indication parameter length [+ + +]
Author: Charles Vosburgh <trilobyte777@gmail.com>
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: stable@vger.kernel.org
    Signed-off-by: Charles Vosburgh <trilobyte777@gmail.com>
    Acked-by: Xin Long <lucien.xin@gmail.com>
    Link: https://patch.msgid.link/20260727-sctp-adaptation-length-v1-1-0ab58b2810a5@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
selftest: fix headers in fclog.c [+ + +]
Author: Jori Koolstra <jkoolstra@xs4all.nl>
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/20260710171741.837308-1-jkoolstra@xs4all.nl
    Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
    Cc: Aleksa Sarai <cyphar@cyphar.com>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Wei Yang <richard.weiyang@gmail.com>
    Cc: Christian Brauner <brauner@kernel.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
selftests/clone3: fix wild pointer access of getline due to missing init [+ + +]
Author: Chris Gellermann <christian.gellermann@codasip.com>
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/20260722130246.2135563-1-christian.gellermann@codasip.com
    Link: https://lore.kernel.org/20260722130246.2135563-2-christian.gellermann@codasip.com
    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 <christian.gellermann@codasip.com>
    Acked-by: David Hildenbrand (arm) <david@kernel.org>
    Reviewed-by: Lorenzo Stoakes <ljs@kernel.org>
    Cc: Christian Brauner <brauner@kernel.org>
    Cc: Liam R. Howlett <liam@infradead.org>
    Cc: Lorenzo Stoakes <ljs@kernel.org>
    Cc: Michal Hocko <mhocko@suse.com>
    Cc: Mike Rapoport <rppt@kernel.org>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Suren Baghdasaryan <surenb@google.com>
    Cc: Vlastimil Babka <vbabka@kernel.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
selftests/lkdtm: rename STACKLEAK_ERASING to KSTACK_ERASE [+ + +]
Author: Haofeng Li <lihaofeng@kylinos.cn>
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 <lihaofeng@kylinos.cn>
    Link: https://patch.msgid.link/tencent_CD80B5F746B6AABD68AF3F1097AD02C96F05@qq.com
    Signed-off-by: Kees Cook <kees@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
selftests/mm: fix potential wild pointer access of getline due to missing init [+ + +]
Author: Chris Gellermann <christian.gellermann@codasip.com>
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/20260722130246.2135563-3-christian.gellermann@codasip.com
    Link: https://pubs.opengroup.org/onlinepubs/9799919799/functions/getline.html [1]
    Fixes: 26b4224d9961 ("selftests: expanding more mlock selftest")
    Signed-off-by: Chris Gellermann <christian.gellermann@codasip.com>
    Acked-by: David Hildenbrand (arm) <david@kernel.org>
    Reviewed-by: Lorenzo Stoakes <ljs@kernel.org>
    Cc: Christian Brauner <brauner@kernel.org>
    Cc: Liam R. Howlett <liam@infradead.org>
    Cc: Michal Hocko <mhocko@suse.com>
    Cc: Mike Rapoport <rppt@kernel.org>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Suren Baghdasaryan <surenb@google.com>
    Cc: Vlastimil Babka <vbabka@kernel.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
selftests/net/af_unix: test listen() rejects wrong socket states [+ + +]
Author: John Ericson <mail@johnericson.me>
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 <mail@johnericson.me>
    Link: https://patch.msgid.link/20260718182903.2295560-2-John.Ericson@Obsidian.Systems
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
selftests/seccomp: Fix pointer type mismatch build error [+ + +]
Author: Kuan-Ying Lee <kuan-ying.lee@canonical.com>
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 <kuan-ying.lee@canonical.com>
    Acked-by: Jiri Olsa <jolsa@kernel.org>
    Link: https://patch.msgid.link/20260715053559.28535-1-kuan-ying.lee@canonical.com
    Signed-off-by: Kees Cook <kees@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
selftests: netfilter: nft_flowtable.sh: fix offload counter verification for tunnel tests [+ + +]
Author: Lorenzo Bianconi <lorenzo@kernel.org>
Date:   Mon Jul 13 14:53:22 2026 +0200

    selftests: netfilter: nft_flowtable.sh: fix offload counter verification for tunnel tests
    
    [ Upstream commit 1d6123f87eebb5148844cd43045c6e598799720b ]
    
    The IPIP and IP6IP6 tunnel tests call check_counters() to verify
    flowtable offloading occurred, but the flow-add rule only matches
    meta oif "veth1". When traffic is routed through a tunnel device,
    oif is the tunnel interface (tun0, tun6, etc.), not veth1, so
    the flow-add rule never fires, no flowtable entry is created,
    and counters stay at zero — producing a silent false pass.
    Fix by adding tunnel-specific flow-add rules for each tunnel
    interface. These match TCP dport 12345 traffic before the bare
    accept rule, set ct mark, add the flow to the flowtable, and
    increment routed_orig. The existing routed_repl rule on veth0
    already handles the reply direction since decapsulated reply
    packets exit through the physical interface.
    Also add check_counters() for the IP6IP6 non-VLAN and
    IP6IP6-over-VLAN tests which previously used a bare PASS message.
    
    Fixes: fe8313316eaf ("selftests: netfilter: nft_flowtable.sh: Add IPIP flowtable selftest")
    Fixes: 5e5180352193 ("selftests: netfilter: nft_flowtable.sh: Add IP6IP6 flowtable selftest")
    Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
smb: client: fix buffer leaks in SMB1 read and write [+ + +]
Author: Dawei Feng <dawei.feng@seu.edu.cn>
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 <dawei.feng@seu.edu.cn>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
spi: qcom-qspi: Correct max DMA length to avoid 64K boundary failure [+ + +]
Author: Vijaya Krishna Nivarthi <vijaya.nivarthi@oss.qualcomm.com>
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: stable@vger.kernel.org
    Signed-off-by: Vijaya Krishna Nivarthi <vijaya.nivarthi@oss.qualcomm.com>
    Link: https://patch.msgid.link/20260722092358.459943-1-vnivarth@qti.qualcomm.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

spi: spi-cadence: Move TX FIFO full busy-wait into FIFO [+ + +]
Author: Srikanth Boyapally <srikanth.boyapally@amd.com>
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 <srikanth.boyapally@amd.com>
    Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
    Link: https://patch.msgid.link/20260720125510.60166-1-srikanth.boyapally@amd.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

spi: spi-nxp-fspi: add per-SoC SDR/DTR clock rate limits for all supported SoCs [+ + +]
Author: Haibo Chen <haibo.chen@nxp.com>
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 <haibo.chen@nxp.com>
    Link: https://patch.msgid.link/20260728-fspi-clock-v2-1-dbe786a4a6eb@nxp.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

spi: spi-qpic-snand: write the feature value before executing SET_FEATURE [+ + +]
Author: Stanislaw Pal <kuncy7@gmail.com>
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: stable@vger.kernel.org
    Signed-off-by: Stanislaw Pal <kuncy7@gmail.com>
    Reviewed-by: Md Sadre Alam <md.alam@oss.qualcomm.com>
    Link: https://patch.msgid.link/20260727163216.109938-1-kuncy7@gmail.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
thunderbolt: Prevent XDomain delayed work use-after-free on disconnect [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
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: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4-7
    Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
    Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
tipc: avoid use-after-free in poll trace queue dumps [+ + +]
Author: Zihan Xi <zihanx@nebusec.ai>
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: stable@vger.kernel.org
    Reported-by: Vega <vega@nebusec.ai>
    Signed-off-by: Zihan Xi <zihanx@nebusec.ai>
    Signed-off-by: Ren Wei <enjou1224z@gmail.com>
    Reviewed-by: Tung Nguyen <tung.quang.nguyen@est.tech>
    Link: https://patch.msgid.link/f8119abd5e5ecc400597de667ae9d39656de56d0.1784794294.git.zihanx@nebusec.ai
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tracing/filters: Fix false positive match in regex_match_full() [+ + +]
Author: Masami Hiramatsu (Google) <mhiramat@kernel.org>
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: stable@vger.kernel.org
    Link: https://patch.msgid.link/178528488779.124250.5571741156199253769.stgit@devnote2
    Assisted-by: Antigravity:gemini-3.5-flash
    Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tracing/fprobe: Roll back on enable_trace_fprobe() failure [+ + +]
Author: Raushan Patel <raushan.jhon@gmail.com>
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/20260724064208.480030-1-raushan.jhon@gmail.com/
    
    Fixes: 334e5519c375 ("tracing/probes: Add fprobe events for tracing function entry and exit.")
    Cc: stable@vger.kernel.org
    Signed-off-by: Raushan Patel <raushan.jhon@gmail.com>
    Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tracing/mmiotrace: Add NULL check for mmio_trace_array in logging functions [+ + +]
Author: Masami Hiramatsu (Google) <mhiramat@kernel.org>
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) <mhiramat@kernel.org>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

tracing/mmiotrace: Reset dropped_count in mmio_reset_data() [+ + +]
Author: Masami Hiramatsu (Google) <mhiramat@kernel.org>
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) <mhiramat@kernel.org>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
tracing/probes: Reject $arg0 in meta argument expansion [+ + +]
Author: Raushan Patel <raushan.jhon@gmail.com>
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/20260724054435.146279-1-raushan.jhon@gmail.com/
    
    Fixes: 18b1e870a496 ("tracing/probes: Add $arg* meta argument for all function args")
    Cc: stable@vger.kernel.org
    Signed-off-by: Raushan Patel <raushan.jhon@gmail.com>
    Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tracing: Check return value of __register_event() in trace_module_add_events() [+ + +]
Author: Masami Hiramatsu (Google) <mhiramat@kernel.org>
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: stable@vger.kernel.org
    Link: https://patch.msgid.link/178528487878.124250.14170824576025743236.stgit@devnote2
    Assisted-by: Antigravity:gemini-3.5-flash
    Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ublk: reset kernel-owned dev_info fields in ublk_ctrl_add_dev() [+ + +]
Author: Ming Lei <tom.leiming@gmail.com>
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: stable@vger.kernel.org
    Signed-off-by: Ming Lei <tom.leiming@gmail.com>
    Reviewed-by: Caleb Sander Mateos <csander@purestorage.com>
    Link: https://patch.msgid.link/20260726145025.1507383-1-tom.leiming@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
um: vector: fix use-after-free in vector_mmsg_rx() [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
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: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
    Signed-off-by: Richard Weinberger <richard@nod.at>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
uprobes: Fix NULL pointer dereference in hprobe_expire() [+ + +]
Author: Breno Leitao <leitao@debian.org>
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 <leitao@debian.org>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Acked-by: Oleg Nesterov <oleg@redhat.com>
    Acked-by: Andrii Nakryiko <andrii@kernel.org>
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20260729-uprobe-v1-1-61896b87c867@debian.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
usb: typec: ucsi: Correct teardown ordering in ucsi_init() error path [+ + +]
Author: Andrei Kuchynski <akuchynski@chromium.org>
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: stable@vger.kernel.org
    Fixes: 7aa7d4bf9d3f ("usb: typec: ucsi: Fix race condition and ordering in port unregistration")
    Reported-by: "Borah, Chaitanya Kumar" <chaitanya.kumar.borah@intel.com>
    Closes: https://lore.kernel.org/all/22064276-6c56-411a-9f20-6917ceeb865f@intel.com/
    Signed-off-by: Andrei Kuchynski <akuchynski@chromium.org>
    Tested-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Link: https://patch.msgid.link/20260717104614.325250-1-akuchynski@chromium.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: typec: ucsi: Fix race condition and ordering in port unregistration [+ + +]
Author: Andrei Kuchynski <akuchynski@chromium.org>
Date:   Thu Jul 30 10:06:26 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 <stable@kernel.org>
    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 <akuchynski@chromium.org>
    Reviewed-by: Benson Leung <bleung@chromium.org>
    Link: https://patch.msgid.link/20260707141736.1635698-1-akuchynski@chromium.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: typec: ucsi: split connector lock classes [+ + +]
Author: Sergey Senozhatsky <senozhatsky@chromium.org>
Date:   Thu Jul 30 10:06:25 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 <senozhatsky@chromium.org>
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Link: https://patch.msgid.link/20260515060042.136083-1-senozhatsky@chromium.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Stable-dep-of: 7aa7d4bf9d3f ("usb: typec: ucsi: Fix race condition and ordering in port unregistration")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
userfaultfd: wait on source PMD during UFFDIO_MOVE [+ + +]
Author: Usama Arif <usama.arif@linux.dev>
Date:   Sun Jul 5 06:12:31 2026 -0700

    userfaultfd: wait on source PMD during UFFDIO_MOVE
    
    commit 4165b7d1c45c2da0dfefe528f8d1fb7d79f0d344 upstream.
    
    move_pages_huge_pmd() snapshots src_pmdval under src_ptl, drops the lock,
    and, for migration entries, waits with pmd_migration_entry_wait().
    
    Passing &src_pmdval is wrong.  pmd_migration_entry_wait() must lock and
    re-read the real page-table PMD; on split-PMD-lock kernels, a stack
    address also resolves to the wrong lock.  softleaf_entry_wait_on_locked()
    then waits without a folio reference, which is safe only while serialized
    against migration-entry removal by the real PT lock.
    
    Pass src_pmd, matching __handle_mm_fault() and hmm_vma_walk_pmd().
    
    Link: https://lore.kernel.org/20260705131231.1499198-1-usama.arif@linux.dev
    Fixes: adef440691ba ("userfaultfd: UFFDIO_MOVE uABI")
    Reported-by: sashiko-bot <sashiko-bot@kernel.org>
    Link: https://sashiko.dev/#/patchset/20260703173903.3789516-1-usama.arif%40linux.dev?part=8
    Signed-off-by: Usama Arif <usama.arif@linux.dev>
    Reviewed-by: Rik van Riel <riel@surriel.com>
    Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
    Reviewed-by: Lance Yang <lance.yang@linux.dev>
    Acked-by: David Hildenbrand (Arm) <david@kernel.org>
    Reviewed-by: Lance Yang <lance.yang@linux.dev>
    Reviewed-by: Lorenzo Stoakes <ljs@kernel.org>
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Cc: Barry Song <baohua@kernel.org>
    Cc: Dev Jain <dev.jain@arm.com>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Liam R. Howlett <liam@infradead.org>
    Cc: Nico Pache <npache@redhat.com>
    Cc: Ryan Roberts <ryan.roberts@arm.com>
    Cc: Shakeel Butt <shakeel.butt@linux.dev>
    Cc: Zi Yan <ziy@nvidia.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
veth: convert frag_list skbs before running XDP [+ + +]
Author: Matt Fleming <mfleming@cloudflare.com>
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: stable@vger.kernel.org
    Signed-off-by: Matt Fleming <mfleming@cloudflare.com>
    Reviewed-by: Toke Høiland-Jørgensen <toke@toke.dk>
    Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
    Link: https://patch.msgid.link/20260722191925.2192070-1-matt@readmodwrite.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
vxlan: re-fetch eth header after route_shortcircuit() [+ + +]
Author: Eric Dumazet <edumazet@google.com>
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: stable@vger.kernel.org
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
    Link: https://patch.msgid.link/20260723144249.759100-2-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

vxlan: unclone skb head before modifying eth header in route_shortcircuit() [+ + +]
Author: Eric Dumazet <edumazet@google.com>
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: stable@vger.kernel.org
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Link: https://patch.msgid.link/20260723144249.759100-3-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

vxlan: use neigh_ha_snapshot() in route_shortcircuit() [+ + +]
Author: Eric Dumazet <edumazet@google.com>
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: stable@vger.kernel.org
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
    Link: https://patch.msgid.link/20260723144249.759100-4-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

vxlan: use pskb_network_may_pull() for transmit path header pulls [+ + +]
Author: Eric Dumazet <edumazet@google.com>
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 <edumazet@google.com>
    Cc: stable@vger.kernel.org
    Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Link: https://patch.msgid.link/20260723144249.759100-6-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

vxlan: use pskb_network_may_pull() in route_shortcircuit() [+ + +]
Author: Eric Dumazet <edumazet@google.com>
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: stable@vger.kernel.org
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
    Link: https://patch.msgid.link/20260723144249.759100-5-edumazet@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
wifi: ath12k: fix out-of-bounds clear_bit in ath12k_mac_dp_peer_cleanup() [+ + +]
Author: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Date:   Mon Jul 20 14:43:22 2026 +0800

    wifi: ath12k: fix out-of-bounds clear_bit in ath12k_mac_dp_peer_cleanup()
    
    [ Upstream commit 47abd2ca281531deee38a3b3770d885e270e9fc9 ]
    
    ath12k_mac_dp_peer_cleanup() clears the ML peer ID slot on the
    free_ml_peer_id_map bitmap by indexing it with dp_peer->peer_id. That is
    wrong: dp_peer->peer_id for an MLO peer always carries the
    ATH12K_PEER_ML_ID_VALID bit (BIT(13)), so clear_bit() is invoked with
    index >= 0x2000, which is far outside the bitmap of ATH12K_MAX_MLO_PEERS
    (256) bits and corrupts memory adjacent to ah->free_ml_peer_id_map. The
    intended bitmap entry also never gets cleared, so subsequent
    ath12k_peer_ml_alloc() calls eventually run out of IDs.
    
    The ID without the VALID bit is what ath12k_peer_ml_alloc() returned and
    is stored in ahsta->ml_peer_id. Use that instead.
    
    While there, also reset ahsta->ml_peer_id to ATH12K_MLO_PEER_ID_INVALID so
    the bitmap and ahsta->ml_peer_id stay in sync.
    
    Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c5-00302-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.115823.3
    
    Fixes: ee16dcf573d5 ("wifi: ath12k: Define ath12k_dp_peer structure & APIs for create & delete")
    Signed-off-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
    Reviewed-by: Rameshkumar Sundaram <rameshkumar.sundaram@oss.qualcomm.com>
    Link: https://patch.msgid.link/20260720-ath12k-fw-allocated-ml-peer-id-v2-1-630632758a80@oss.qualcomm.com
    Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: mac80211: fix tid_tx use-after-free on BA session stop [+ + +]
Author: Zhao Li <enderaoelyther@gmail.com>
Date:   Tue Jul 28 19:21:56 2026 +0800

    wifi: mac80211: fix tid_tx use-after-free on BA session stop
    
    commit 2f067f5a450ea07efd249142a11d940a068fe29c upstream.
    
    ieee80211_stop_tx_ba_cb() hands tid_tx to kfree_rcu() through
    ieee80211_remove_tid_tx(), and then reads tid_tx->ndp after dropping
    sta->lock:
    
            ieee80211_remove_tid_tx(sta, tid);      /* kfree_rcu(tid_tx, rcu_head) */
            ...
            spin_unlock_bh(&sta->lock);
    
            if (start_txq)
                    ieee80211_agg_start_txq(sta, tid, false);
    
            if (send_delba)
                    ieee80211_send_delba(..., tid_tx->ndp);
    
    That read is not covered by an RCU read-side critical section, and it runs
    in preemptible process context: both callers hold the wiphy mutex, reaching
    it either from the ieee80211_ba_session_work() wiphy work or from
    ieee80211_sta_tear_down_BA_sessions() during station teardown.
    Softirqs can run in that window too, both from the local_bh_enable() that
    ends ieee80211_agg_start_txq() and from any interrupt exit, so the RCU
    callback can free tid_tx before the read.
    
    Driving the function from a test module with the grace period forced into
    that window, KASAN reports the read, and the free arrives on the ordinary
    RCU softirq path:
    
      BUG: KASAN: slab-use-after-free in ieee80211_stop_tx_ba_cb+0x3cd/0x400
      Read of size 1 at addr ffff888002b9f52e by task kworker/0:1/10
      [...]
      Freed by task 57:
       __kasan_slab_free+0x47/0x70
       __rcu_free_sheaf_prepare+0x70/0x250
       rcu_free_sheaf_nobarn+0x18/0x40
       rcu_core+0x426/0x1310
       handle_softirqs+0x144/0x590
       __irq_exit_rcu+0xea/0x150
       irq_exit_rcu+0x9/0x20
       sysvec_apic_timer_interrupt+0x6b/0x80
       asm_sysvec_apic_timer_interrupt+0x1a/0x20
    
    send_delba is only set when tx_stop is set, which happens for
    AGG_STOP_LOCAL_REQUEST alone, so this is reached on local teardown -
    session idle timeout, PTK rekey, suspend, HW reconfig - and not from a
    peer's DELBA.
    
    Read ndp into a local before the session is freed, while sta->lock is still
    held. tid_tx->ndp has a single writer, in
    ieee80211_tx_ba_session_handle_start(), which cannot run concurrently here:
    both paths are serialised by the wiphy mutex, and the session is already
    marked HT_AGG_STATE_STOPPING at this point. tid_tx->ndp is also the only
    tid_tx dereference left after ieee80211_remove_tid_tx() in this function.
    
    Fixes: 98acd4c1d9f7 ("wifi: mac80211: add support for NDP ADDBA/DELBA for S1G")
    Assisted-by: Codex:gpt-5.6-sol
    Assisted-by: Kimi:K3
    Cc: stable@vger.kernel.org
    Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
    Link: https://patch.msgid.link/20260728112156.96822-1-enderaoelyther@gmail.com
    [move/change the comment a bit to be more general not just on ndp,
     initialize ndp directly]
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

wifi: mac80211: validate individual TWT params before driver setup [+ + +]
Author: Zhao Li <enderaoelyther@gmail.com>
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 <enderaoelyther@gmail.com>
    Link: https://patch.msgid.link/20260723010928.76551-1-enderaoelyther@gmail.com
    [edit commit message to not overclaim lack of validation nor
     understate driver impact]
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: mwifiex: use the subframe length when parsing A-MSDU TDLS frames [+ + +]
Author: Zhao Li <enderaoelyther@gmail.com>
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: stable@vger.kernel.org
    Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
    Link: https://patch.msgid.link/20260728115325.19128-1-enderaoelyther@gmail.com
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
x86/boot: Add volatile, clobbers and zero-length test in memcmp() [+ + +]
Author: Mauricio Faria de Oliveira <mfo@igalia.com>
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 <bp@alien8.de>
    Signed-off-by: Mauricio Faria de Oliveira <mfo@igalia.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Link: https://lore.kernel.org/all/20260721-pvh-kasan-inline-v7-2-38979a50cef0@igalia.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
x86/CPU/AMD: Carve out a Zen5 models range [+ + +]
Author: Pratik Vishwakarma <Pratik.Vishwakarma@amd.com>
Date:   Wed Jul 29 05:54:59 2026 +0000

    x86/CPU/AMD: Carve out a Zen5 models range
    
    commit 52075128273ace53e6254e37899a47d40d4baf45 upstream.
    
    Family 0x1a, model 0xd0..0xd7 belongs to the Zen5 generation. Carve it
    out from the larger, Zen6 range where former doesn't belong.
    
      [ bp: Rewrite commit message, add tags. ]
    
    Fixes: b5f53e6d3d32 ("x86/CPU/AMD: Add more Zen6 models")
    Signed-off-by: Pratik Vishwakarma <Pratik.Vishwakarma@amd.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Cc: <stable@kernel.org>
    Link: https://patch.msgid.link/20260729055459.15904-1-Pratik.Vishwakarma@amd.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
xsk: drain continuation descs after overflow in xsk_build_skb() [+ + +]
Author: Jason Xing <kerneljasonxing@gmail.com>
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/20260425041726.85FB3C2BCB2@smtp.kernel.org/
    Reviewed-by: Jason Xing <kernelxing@tencent.com>
    Co-developed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com> # wrapped cq addr submission onto routine
    Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
    Signed-off-by: Jason Xing <kernelxing@tencent.com>
    Acked-by: Stanislav Fomichev <sdf@fomichev.me>
    Link: https://patch.msgid.link/20260719135609.147823-3-maciej.fijalkowski@intel.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

xsk: fix buffer leak in xsk_drop_skb() for AF_XDP multi-buffer Tx [+ + +]
Author: Jason Xing <kerneljasonxing@gmail.com>
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/20260425041726.85FB3C2BCB2@smtp.kernel.org/
    
    Fixes: cf24f5a5feea ("xsk: add support for AF_XDP multi-buffer on Tx path")
    Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
    Signed-off-by: Jason Xing <kernelxing@tencent.com>
    Acked-by: Stanislav Fomichev <sdf@fomichev.me>
    Link: https://patch.msgid.link/20260719135609.147823-2-maciej.fijalkowski@intel.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

xsk: provide sufficient space in pool->tx_descs [+ + +]
Author: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Date:   Sun Jul 19 15:56:06 2026 +0200

    xsk: provide sufficient space in pool->tx_descs
    
    [ Upstream commit 08c9a8e794b4694c100dafcb80e069e29ad81b64 ]
    
    The temporary Tx descriptor array in an XSK buffer pool is currently
    sized from the Tx ring of the socket that creates the pool.
    
    This is insufficient for shared-UMEM Tx. A later socket may have a
    larger Tx ring and submit a valid multi-buffer packet containing more
    descriptors than the first socket's ring, while still remaining within
    the device's xdp_zc_max_segs limit.
    
    A packet-framed batch parser bounded by the temporary array cannot reach
    the end-of-packet descriptor in that case. It leaves the packet on the
    Tx ring and encounters the same packet on every subsequent attempt,
    stalling Tx processing for that socket.
    
    Size the temporary descriptor array to the larger of the first Tx ring
    and the device's xdp_zc_max_segs capability. This keeps the array large
    enough to inspect one maximum-sized valid packet. Larger shared Tx rings
    do not require further resizing, as they can be processed over multiple
    batches.
    
    Following commit will actually address the data path side.
    
    Fixes: d5581966040f ("xsk: support ZC Tx multi-buffer in batch API")
    Reviewed-by: Jason Xing <kernelxing@tencent.com>
    Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
    Acked-by: Stanislav Fomichev <sdf@fomichev.me>
    Link: https://patch.msgid.link/20260719135609.147823-4-maciej.fijalkowski@intel.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

xsk: reclaim invalid Tx descriptors in ZC batch path [+ + +]
Author: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Date:   Sun Jul 19 15:56:07 2026 +0200

    xsk: reclaim invalid Tx descriptors in ZC batch path
    
    [ Upstream commit 72f2b4516faf55d4dfac2414649d3cffa5fd2c5e ]
    
    The zero-copy Tx batch parser stops when it encounters an invalid
    descriptor. If this happens after one or more continuation descriptors,
    the Tx consumer can be advanced past fragments that are neither submitted
    to the driver nor returned to userspace through the completion ring.
    
    A similar problem occurs when a packet exceeds xdp_zc_max_segs. The
    descriptors consumed up to the limit are released without completion, and
    the remaining continuation descriptors can subsequently be interpreted
    as the beginning of another packet.
    
    Parse Tx batches in packet units and distinguish descriptors belonging to
    complete valid packets from descriptors consumed while draining an
    invalid or oversized packet. Return the former to the driver and append
    the latter to the CQ address area so userspace can reclaim their UMEM
    frames.
    
    Treat a standalone invalid descriptor as a one-descriptor reclaim-only
    packet. Advancing the Tx-ring consumer releases the ring slot, but does
    not by itself return ownership of the referenced UMEM frame to userspace.
    
    Once draining starts, continue until the packet's end-of-packet
    descriptor is consumed. Preserve the drain state on the socket when EOP
    has not yet been supplied, so draining can continue during a later call.
    Leave incomplete but otherwise valid packets on the Tx ring.
    
    Shared-UMEM pools using multi-buffer Tx also need packet-framed parsing.
    Walk their Tx sockets one packet at a time, preserving the existing
    per-socket fairness scheme, instead of using the legacy one-descriptor
    fallback. Keep that fallback for shared pools that do not use
    multi-buffer Tx. Since the drain state is maintained per socket and both
    the singular and shared paths can resume an interrupted drain, changing
    the socket list from singular to shared requires no special bind-time
    transition.
    
    CQ entries are positional, and drivers may complete only part of the Tx
    work returned by xsk_tx_peek_release_desc_batch(). Therefore, reclaim-only
    entries cannot be published immediately when earlier driver-visible
    descriptors are still outstanding.
    
    Track the number of driver-visible CQ entries preceding the reclaim
    entries. Let xsk_tx_completed() publish partial hardware Tx completions,
    and publish the reclaim entries only after every earlier Tx descriptor
    has completed. Complete a reclaim-only batch immediately when there is no
    driver-visible work in front of it, and prevent another Tx batch from
    being appended while reclaim entries remain pending.
    
    Also cap batch processing by the size of the pool's temporary descriptor
    array, as Tx rings belonging to sockets sharing a UMEM may have different
    sizes.
    
    This ensures that every invalid Tx descriptor consumed by the ZC batch
    path is either submitted to the driver as part of a valid packet or
    returned to userspace without violating CQ completion ordering.
    
    Reviewed-by: Jason Xing <kernelxing@tencent.com>
    Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
    Acked-by: Stanislav Fomichev <sdf@fomichev.me>
    Fixes: cf24f5a5feea ("xsk: add support for AF_XDP multi-buffer on Tx path")
    Link: https://patch.msgid.link/20260719135609.147823-5-maciej.fijalkowski@intel.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>