Changelog in Linux kernel 7.1.4

 
6lowpan: fix NHC entry use-after-free on error path [+ + +]
Author: Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>
Date:   Tue Jun 9 16:00:52 2026 +0800

    6lowpan: fix NHC entry use-after-free on error path
    
    commit 1720db928e5a58ca7d75ac1d514c3b73fd7061a7 upstream.
    
    lowpan_nhc_do_uncompression() looks up an NHC descriptor while holding
    lowpan_nhc_lock.  If the descriptor has no uncompress callback, the error
    path drops the lock before printing nhc->name.
    
    lowpan_nhc_del() removes descriptors under the same lock and then relies
    on synchronize_net() before the owning module can be unloaded.  That only
    waits for net RX RCU readers.  lowpan_header_decompress() is also exported
    and can be reached from callers that are not necessarily covered by the net
    core RX critical section, for example the Bluetooth 6LoWPAN L2CAP receive
    path.
    
    This leaves a race where one task drops lowpan_nhc_lock in the error path,
    another task unregisters and frees the matching descriptor after
    synchronize_net() returns, and the first task then dereferences nhc->name
    for the warning.
    
    With the post-unlock window widened, KASAN reports:
    
      BUG: KASAN: slab-use-after-free in lowpan_nhc_do_uncompression+0x1f4/0x220
      Read of size 8
      lowpan_nhc_do_uncompression
      lowpan_header_decompress
    
    Fix this by printing the warning before dropping lowpan_nhc_lock, so the
    descriptor name is read while unregister is still excluded.  The malformed
    packet is still rejected with -ENOTSUPP.
    
    Fixes: 92aa7c65d295 ("6lowpan: add generic nhc layer interface")
    Cc: stable@vger.kernel.org
    Reported-by: Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>
    Reported-by: Yuxiang Yang <yangyx22@mails.tsinghua.edu.cn>
    Reported-by: Ao Wang <wangao@seu.edu.cn>
    Reported-by: Xuewei Feng <fengxw06@126.com>
    Reported-by: Qi Li <qli01@tsinghua.edu.cn>
    Reported-by: Ke Xu <xuke@tsinghua.edu.cn>
    Signed-off-by: Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>
    Acked-by: Alexander Aring <aahringo@redhat.com>
    Link: https://patch.msgid.link/20260609080054.4541-1-zhaoyz24@mails.tsinghua.edu.cn
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ACPI: CPPC: Suppress UBSAN warning caused by field misuse [+ + +]
Author: Jeremy Linton <jeremy.linton@arm.com>
Date:   Mon Jun 1 18:58:08 2026 -0500

    ACPI: CPPC: Suppress UBSAN warning caused by field misuse
    
    commit 1b1acf2dada0cc3931bb2cb9ff8832edfbee46a1 upstream.
    
    The definition of reg->access_width changes depending on the
    reg->space_id type.  Type ACPI_ADR_SPACE_PLATFORM_COMM uses
    access_width to indicate the PCC region, which can result in a UBSAN
    if the value is greater than 4.
    
    For example:
    
     UBSAN: shift-out-of-bounds in drivers/acpi/cppc_acpi.c:1090:9
     shift exponent 32 is too large for 32-bit type 'int'
     CPU: 61 UID: 0 PID: 1220 Comm: (udev-worker) Not tainted 7.0.10-201.fc44.aarch64 #1 PREEMPT(lazy)
     Hardware name: To be filled by O.E.M.
     Call trace:
      ...(trimming)
      ubsan_epilogue+0x10/0x48
      __ubsan_handle_shift_out_of_bounds+0xdc/0x1e0
      cpc_write+0x4d0/0x670
      cppc_set_perf+0x18c/0x490
      cppc_cpufreq_cpu_init+0x1c8/0x380 [cppc_cpufreq]
      ... (trimming)
    
    Lets fix this by validating the region type, as well as whether
    access_width has a value. Then since we are returning bit_width
    directly for ACPI_ADR_SPACE_PLATFORM_COMM, drop the code correcting
    the size.
    
    Fixes: 2f4a4d63a193 ("ACPI: CPPC: Use access_width over bit_width for system memory accesses")
    Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
    Tested-by: Jarred White <jarredwhite@linux.microsoft.com>
    Reviewed-by: Jarred White <jarredwhite@linux.microsoft.com>
    Reviewed-by: Easwar Hariharan <easwar.hariharan@linux.microsoft.com>
    Cc: All applicable <stable@vger.kernel.org>
    Link: https://patch.msgid.link/20260601235808.1113137-1-jeremy.linton@arm.com
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ACPI: NFIT: core: Fix acpi_nfit_init() error cleanup [+ + +]
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Wed Jun 3 19:57:02 2026 +0200

    ACPI: NFIT: core: Fix acpi_nfit_init() error cleanup
    
    commit 38bf27511ef41bffebd157ec3eba41fc89ba59cd upstream.
    
    If acpi_nfit_init() fails after adding the acpi_desc object to the
    acpi_descs list, that object is never removed from that list because
    the acpi_nfit_shutdown() devm action is not added for the NFIT device
    in that case.  Next, the acpi_nfit_init() failure causes
    acpi_nfit_probe() to fail, the acpi_desc object is freed, and a
    dangling pointer is left behind in the acpi_descs.  Any subsequent
    ACPI Machine Check Exception will trigger nfit_handle_mce() which
    iterates over acpi_descs and so a use-after-free will occur.
    
    Moreover, if acpi_nfit_probe() returns 0 after installing a notify
    handler for the NFIT device and without allocating the acpi_desc
    object and setting the NFIT device's driver data pointer, the
    acpi_desc object will be allocated by acpi_nfit_update_notify()
    and acpi_nfit_init() will be called to initialize it.  Regardless
    of whether or not acpi_nfit_init() fails in that case, the
    acpi_nfit_shutdown() devm action is not added for the NFIT device
    and acpi_desc is never removed from the acpi_descs list.  If the
    acpi_desc object is freed subsequently on driver removal, any
    subsequent ACPI MCE will lead to a use-after-free like in the
    previous case.
    
    To address the first issue mentioned above, make acpi_nfit_probe()
    call acpi_nfit_shutdown() directly on acpi_nfit_init() failures and
    to address the other one, add a remove callback to the driver and
    make it call acpi_nfit_shutdown().  Also, since it is now possible to
    pass NULL to acpi_nfit_shutdown() or the acpi_desc object passed to it
    may not have been initialized, add checks against NULL for acpi_desc and
    its nvdimm_bus field to that function and make acpi_nfit_unregister()
    clear the latter after unregistering the NVDIMM bus.
    
    Fixes: a61fe6f7902e ("nfit, tools/testing/nvdimm: unify common init for acpi_nfit_desc")
    Fixes: fbabd829fe76 ("acpi, nfit: fix module unload vs workqueue shutdown race")
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Cc: All applicable <stable@vger.kernel.org>
    Reviewed-by: Dave Jiang <dave.jiang@intel.com>
    Link: https://patch.msgid.link/1963615.tdWV9SEqCh@rafael.j.wysocki
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ACPI: NFIT: core: Fix possible NULL pointer dereference [+ + +]
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Wed Jun 3 19:56:21 2026 +0200

    ACPI: NFIT: core: Fix possible NULL pointer dereference
    
    commit 027e128abb82788189d6d45b68e3e8e7329b67be upstream.
    
    After commit 9b311b7313d6 ("ACPI: NFIT: Install Notify() handler before
    getting NFIT table"), acpi_nfit_probe() installs an ACPI notify handler
    for the NFIT device before checking the presence of the NFIT table.  If
    that table is not there, 0 is returned without allocating the acpi_desc
    object and setting the driver data pointer of the NFIT device.  If the
    platform firmware triggers an NFIT_NOTIFY_UC_MEMORY_ERROR notification
    on the NFIT device at that point, acpi_nfit_uc_error_notify() will
    dereference a NULL pointer.
    
    Prevent that from occurring by adding an acpi_desc check against NULL
    to acpi_nfit_uc_error_notify().
    
    Fixes: 9b311b7313d6 ("ACPI: NFIT: Install Notify() handler before getting NFIT table")
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Cc: All applicable <stable@vger.kernel.org>
    Reviewed-by: Dave Jiang <dave.jiang@intel.com>
    Link: https://patch.msgid.link/2418508.ElGaqSPkdT@rafael.j.wysocki
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ALSA: aoa: check snd_ctl_new1() return value [+ + +]
Author: Zhao Dongdong <zhaodongdong@kylinos.cn>
Date:   Wed May 27 20:09:14 2026 +0800

    ALSA: aoa: check snd_ctl_new1() return value
    
    commit 8df560fefe6fed6a20b7e06720eeaeccec349ac0 upstream.
    
    snd_ctl_new1() can return NULL when memory allocation fails. In
    layout.c, the function does not check the return value before
    dereferencing ctl->id.name or passing to aoa_snd_ctl_add(), which can
    lead to a NULL pointer dereference.
    
    Add NULL checks after snd_ctl_new1() calls and return early if any
    fails.
    
    Assisted-by: Opencode:DeepSeek-V4-Flash
    Cc: stable@vger.kernel.org
    Fixes: f3d9478b2ce4 ("[ALSA] snd-aoa: add snd-aoa")
    Signed-off-by: Zhao Dongdong <zhaodongdong@kylinos.cn>
    Link: https://patch.msgid.link/tencent_35F3A25FEEBF190A2E15ED787754C57E3708@qq.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: caiaq: fix out-of-bounds read in the Traktor Kontrol S4 input parser [+ + +]
Author: Maoyi Xie <maoyixie.tju@gmail.com>
Date:   Thu Jun 18 14:03:15 2026 +0800

    ALSA: caiaq: fix out-of-bounds read in the Traktor Kontrol S4 input parser
    
    commit f7f3f9fd81e7adbaa12c2e62ee07f0e094a543fd upstream.
    
    snd_usb_caiaq_tks4_dispatch() decodes the Traktor Kontrol S4 input
    stream in fixed 16-byte (TKS4_MSGBLOCK_SIZE) message blocks. On every
    iteration it advances buf and subtracts the block size while looping on
    "while (len)".
    
    len is urb->actual_length. That value is supplied by the device and is
    not guaranteed to be a multiple of 16. When a final short block leaves
    len between 1 and 15, the loop runs once more, reads up to buf[15], and
    then does "len -= TKS4_MSGBLOCK_SIZE". As len is unsigned this underflows
    to a huge value. The loop then keeps iterating and walking buf far past
    the end of the 512-byte ep4_in_buf, reading out of bounds until a bogus
    block id happens to be hit.
    
    Iterate only while a full message block is available. This stops the
    unsigned underflow and silently drops any trailing partial block, which
    carries no complete control value anyway.
    
    The sibling endpoint-4 parsers are not affected. The Traktor Kontrol X1
    and Maschine arms in snd_usb_caiaq_ep4_reply_dispatch() floor
    urb->actual_length before dispatching.
    
    Fixes: 15c5ab607045 ("ALSA: snd-usb-caiaq: Add support for Traktor Kontrol S4")
    Cc: stable@vger.kernel.org
    Signed-off-by: Maoyi Xie <maoyixie.tju@gmail.com>
    Link: https://patch.msgid.link/178176259547.3343534.2724779296835237429@maoyixie.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: cmipci: check snd_ctl_new1() return value [+ + +]
Author: Zhao Dongdong <zhaodongdong@kylinos.cn>
Date:   Wed May 27 20:09:13 2026 +0800

    ALSA: cmipci: check snd_ctl_new1() return value
    
    commit c205bd1b28fb7e5f1061a4e78813fad7d315cb3e upstream.
    
    snd_ctl_new1() can return NULL when memory allocation fails.
    snd_cmipci_spdif_controls() does not check the return value before
    dereferencing kctl->id.device, which can lead to a NULL pointer
    dereference.
    
    Add NULL checks after snd_ctl_new1() calls and return -ENOMEM if any
    fails.
    
    Assisted-by: Opencode:DeepSeek-V4-Flash
    Cc: stable@vger.kernel.org
    Fixes: f2f312ad88c6 ("ALSA: cmipci: Fix kctl->id initialization")
    Signed-off-by: Zhao Dongdong <zhaodongdong@kylinos.cn>
    Link: https://patch.msgid.link/tencent_964433DCD132125D5EDA79EE068A2D6EFA09@qq.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: compress: Fix task creation error unwind [+ + +]
Author: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Date:   Mon Jun 15 10:37:26 2026 -0300

    ALSA: compress: Fix task creation error unwind
    
    commit 4a60127debb9e370d6c0e22a307326b624a141f3 upstream.
    
    snd_compr_task_new() allocates the driver task before validating the
    returned DMA buffers and reserving file descriptors. When either of
    those later steps fails, the core frees its task wrapper and DMA-buffer
    references without calling the driver's task_free() callback. Any
    driver resources allocated by task_create() are therefore leaked.
    
    The dual-fd allocation path also jumps to cleanup without storing the
    negative get_unused_fd_flags() result in retval. Since retval still
    contains the successful task_create() return value, TASK_CREATE can
    incorrectly report success although the task was discarded.
    
    Preserve the fd allocation errors and call task_free() when failure
    occurs after a successful task_create() callback.
    
    Fixes: 04177158cf98 ("ALSA: compress_offload: introduce accel operation mode")
    Fixes: 3d3f43fab4cf ("ALSA: compress_offload: improve file descriptors installation for dma-buf")
    Cc: stable@vger.kernel.org
    Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
    Link: https://patch.msgid.link/20260615-alsa-compress-task-unwind-v1-1-39e8ad3ddb27@gmail.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: doc: usb-audio: Add doc for QUIRK_FLAG_IFB_SILENCE_ON_EMPTY [+ + +]
Author: Rong Zhang <i@rong.moe>
Date:   Wed May 27 01:49:23 2026 +0800

    ALSA: doc: usb-audio: Add doc for QUIRK_FLAG_IFB_SILENCE_ON_EMPTY
    
    commit 06363f96e3d6b54ff7b5d2ce85cab95bd5e874b0 upstream.
    
    QUIRK_FLAG_IFB_SILENCE_ON_EMPTY was introduced into usb-audio before
    without appropriate documentation, so add it.
    
    Fixes: a23812004228 ("ALSA: usb-audio: add IFB_SILENCE_ON_EMPTY quirk for Behringer Flow 8")
    Signed-off-by: Rong Zhang <i@rong.moe>
    Link: https://patch.msgid.link/20260527-uac-quirk-get-cur-vol-v1-1-e9362b712e5e@rong.moe
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: es1938: check snd_ctl_new1() return value [+ + +]
Author: Zhao Dongdong <zhaodongdong@kylinos.cn>
Date:   Wed May 27 20:09:09 2026 +0800

    ALSA: es1938: check snd_ctl_new1() return value
    
    commit 1edd1f02dddd20aeb6066ded41017615766ea42f upstream.
    
    snd_ctl_new1() can return NULL when memory allocation fails.
    snd_es1938_mixer() does not check the return value before dereferencing
    the pointer, which can lead to a NULL pointer dereference.
    
    Add a NULL check after snd_ctl_new1() and return -ENOMEM if it fails.
    
    Assisted-by: Opencode:DeepSeek-V4-Flash
    Cc: stable@vger.kernel.org
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Zhao Dongdong <zhaodongdong@kylinos.cn>
    Link: https://patch.msgid.link/tencent_E0DC65165FDF2C8982BAFB6794B854B53B0A@qq.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: FCP: Add Focusrite ISA C8X support [+ + +]
Author: Geoffrey D. Bennett <g@b4.vu>
Date:   Tue Jun 23 02:59:04 2026 +0930

    ALSA: FCP: Add Focusrite ISA C8X support
    
    commit e0ecb324246be9cf3a0689346a658e48a38546b2 upstream.
    
    Add USB PID 0x821e to the list of devices handled by the Focusrite
    Control Protocol (FCP) driver.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
    Link: https://patch.msgid.link/ajlw4HK+2RSW3nUl@m.b4.vu
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: firewire: isight: bound the sample count to the packet payload [+ + +]
Author: Maoyi Xie <maoyixie.tju@gmail.com>
Date:   Sun Jun 21 23:09:07 2026 +0800

    ALSA: firewire: isight: bound the sample count to the packet payload
    
    commit 29b9667982e4df2ed7744f86b1144f8bb58eb698 upstream.
    
    isight_packet() takes the frame count from the device iso packet and
    checks it only against the device claimed iso length.
    
            count = be32_to_cpu(payload->sample_count);
            if (likely(count <= (length - 16) / 4))
                    isight_samples(isight, payload->samples, count);
    
    length is the iso header data_length. It can be up to 0xffff. So the
    gate allows a count up to about 16379. isight_samples() then copies
    count frames out of payload->samples into the PCM DMA buffer.
    
    payload->samples holds only 2 * MAX_FRAMES_PER_PACKET values. The
    device multiplexes two samples per frame. A count past
    MAX_FRAMES_PER_PACKET reads past the payload. A count past the buffer
    size writes past runtime->dma_area. The smallest PCM buffer is larger
    than MAX_FRAMES_PER_PACKET. Bounding the count to MAX_FRAMES_PER_PACKET
    keeps both the read and the write in range.
    
    A malicious or faulty Apple iSight on the FireWire bus reaches this
    during a normal capture.
    
    Add the MAX_FRAMES_PER_PACKET bound to the gate.
    
    Fixes: 3a691b28a0ca ("ALSA: add Apple iSight microphone driver")
    Suggested-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
    Cc: stable@vger.kernel.org
    Signed-off-by: Maoyi Xie <maoyixie.tju@gmail.com>
    Link: https://patch.msgid.link/178205454729.1900991.7807310178296762772@maoyixie.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: gus: check snd_ctl_new1() return value [+ + +]
Author: Zhao Dongdong <zhaodongdong@kylinos.cn>
Date:   Wed May 27 20:09:10 2026 +0800

    ALSA: gus: check snd_ctl_new1() return value
    
    commit c7fa99d30c7a166a5e5db5a585ce7501ff68326b upstream.
    
    snd_ctl_new1() can return NULL when memory allocation fails.
    snd_gf1_pcm_volume_control() does not check the return value before
    dereferencing kctl->id.index, which can lead to a NULL pointer
    dereference.
    
    Add a NULL check after snd_ctl_new1() and return -ENOMEM if it fails.
    
    Assisted-by: Opencode:DeepSeek-V4-Flash
    Cc: stable@vger.kernel.org
    Fixes: c5ae57b1bb99 ("ALSA: gus: Fix kctl->id initialization")
    Signed-off-by: Zhao Dongdong <zhaodongdong@kylinos.cn>
    Link: https://patch.msgid.link/tencent_F644A3DCAD32945D62DB2FEEBE8A996F6809@qq.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: hda/cs35l41: Fix firmware load work teardown [+ + +]
Author: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Date:   Mon May 11 01:29:34 2026 -0300

    ALSA: hda/cs35l41: Fix firmware load work teardown
    
    commit b65020d5398f499c09498c9786dba6d67ae57664 upstream.
    
    cs35l41_hda creates ALSA controls whose private data points at the
    cs35l41_hda object. The firmware load control can also queue
    fw_load_work.
    
    Those controls are not removed on component unbind, and device remove
    only cancels fw_load_work through cs35l41_remove_dsp(). That helper is
    skipped when halo_initialized is false. With firmware_autostart
    disabled, a firmware load can be requested before the DSP has been
    initialized. If the component or device is removed before the queued
    work runs, the worker can run after teardown and dereference driver
    state that is no longer valid.
    
    Track the created controls and remove them on unbind so no new control
    callback can reach the driver data or queue more work. Then cancel
    fw_load_work to drain any request that was already queued. Also cancel
    the work unconditionally during device remove before runtime PM teardown.
    
    Fixes: 47ceabd99a28 ("ALSA: hda: cs35l41: Support Firmware switching and reloading")
    Fixes: 4c870513fbb0 ("ALSA: hda: cs35l41: Add read-only ALSA control for forced mute")
    Cc: stable@vger.kernel.org
    Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
    Reviewed-by: Stefan Binding <sbinding@opensource.cirrus.com>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Link: https://patch.msgid.link/20260511-alsa-hda-cs35l41-fw-work-teardown-v1-1-1184e9bc4f25@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: hda/hdmi: Add force-connect quirk for HP EliteDesk 800 G5 Mini [+ + +]
Author: Cameron Graham <cam.graham@gmail.com>
Date:   Fri Jun 12 21:46:01 2026 +1200

    ALSA: hda/hdmi: Add force-connect quirk for HP EliteDesk 800 G5 Mini
    
    commit 0ec17ee704615125c0b6e100c38129393a346bcc upstream.
    
    The HP EliteDesk 800 G5 Mini (PCI subsystem 103c:8595) uses
    Cannon Lake PCH cAVS HDA with DisplayPort audio pins 0x05 and
    0x06 set to AC_JACK_PORT_NONE (N/A) in BIOS defaults, causing
    hdmi_add_pin() to skip them and the DP audio device to not
    appear in ALSA.
    
    Add the board to the existing force_connect_list alongside the
    similar HP EliteDesk 800 G4 entries.
    
    Signed-off-by: Cameron Graham <cam.graham@gmail.com>
    Cc: <stable@vger.kernel.org>
    Link: https://patch.msgid.link/20260612094601.1209845-1-cam.graham@gmail.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: hda/hdmi: Use 'AC_PINSENSE_ELDV' to detect pinsense for Loongson [+ + +]
Author: Huacai Chen <chenhuacai@kernel.org>
Date:   Wed May 27 22:08:41 2026 +0800

    ALSA: hda/hdmi: Use 'AC_PINSENSE_ELDV' to detect pinsense for Loongson
    
    commit 958e4450e961d75bd9d8f5bfe245fb15bc78e02a upstream.
    
    Due to a hardware defect, for Loongson PCI HDMI devices with a reversion
    ID of 2, the pin sense status must be determined via the ELD.
    
    Add a codec flag, eld_jack_detect, to indicate this case, and do special
    handlings in read_pin_sense().
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Baoqi Zhang <zhangbaoqi@loongson.cn>
    Signed-off-by: Haowei Zheng <zhenghaowei@loongson.cn>
    Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
    Link: https://patch.msgid.link/20260527140841.3407183-1-chenhuacai@loongson.cn
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: hda/realtek: Fix noisy mic for Clevo V6xxAW [+ + +]
Author: Aaron Erhardt <aer@tuxedocomputers.com>
Date:   Tue May 19 17:49:48 2026 +0200

    ALSA: hda/realtek: Fix noisy mic for Clevo V6xxAW
    
    commit 493765b8e922a506e09e22e80b6cc9ff05e8295b upstream.
    
    Add a PCI quirk to reduce the volume of the internal microphone to prevent
    extremely noisy signal.
    
    Signed-off-by: Aaron Erhardt <aer@tuxedocomputers.com>
    Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20260519155047.106096-1-wse@tuxedocomputers.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: ice1712: check snd_ctl_new1() return value [+ + +]
Author: Zhao Dongdong <zhaodongdong@kylinos.cn>
Date:   Wed May 27 20:09:11 2026 +0800

    ALSA: ice1712: check snd_ctl_new1() return value
    
    commit 2b929b91b0f3bc6de8a844370049cd99ee8e31ff upstream.
    
    snd_ctl_new1() can return NULL when memory allocation fails. The
    ice1712 driver calls snd_ctl_new1() without checking the return value
    before dereferencing the pointer in multiple places (ice1712.c,
    ice1724.c, aureon.c), which can lead to NULL pointer dereferences.
    
    Add NULL checks after snd_ctl_new1() calls and return -ENOMEM if any
    fails.
    
    Assisted-by: Opencode:DeepSeek-V4-Flash
    Cc: stable@vger.kernel.org
    Fixes: b9a4efd61b6b ("ALSA: ice1712,ice1724: fix the kcontrol->id initialization")
    Signed-off-by: Zhao Dongdong <zhaodongdong@kylinos.cn>
    Link: https://patch.msgid.link/tencent_42E5E2AB1B6A5101F7EE8C2117F1F687BB07@qq.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: seq: Fix uninitialised heap leak in snd_seq_event_dup() [+ + +]
Author: HyeongJun An <sammiee5311@gmail.com>
Date:   Wed Jun 24 08:38:40 2026 +0900

    ALSA: seq: Fix uninitialised heap leak in snd_seq_event_dup()
    
    commit 435990e25bf1f4af3e6df12a6fbfd1f7ba4a97d4 upstream.
    
    snd_seq_event_dup() copies an incoming event into a pool cell and, in
    the UMP-enabled build, clears the trailing cell->ump.raw.extra word that
    the memcpy() did not cover.  The guard deciding whether to clear it
    compares the copied size against sizeof(cell->event):
    
            memcpy(&cell->ump, event, size);
            if (size < sizeof(cell->event))
                    cell->ump.raw.extra = 0;
    
    For a legacy (non-UMP) event, size == sizeof(struct snd_seq_event) ==
    sizeof(cell->event), so the condition is false and the extra word keeps
    stale data.  The cell pool is allocated with kvmalloc() (not zeroed) and
    cells are reused via a free list, so that word holds uninitialised heap
    or leftover event data.
    
    When such a cell is delivered to a UMP client (client->midi_version > 0)
    that set SNDRV_SEQ_FILTER_NO_CONVERT -- so the legacy event reaches it
    unconverted -- snd_seq_read() reads it out as the larger struct
    snd_seq_ump_event and copies the stale word to user space, a 4-byte
    kernel heap infoleak to an unprivileged /dev/snd/seq client.
    
    Compare against sizeof(cell->ump) instead, so the trailing word is zeroed
    for every event shorter than the UMP cell.
    
    Fixes: 46397622a3fa ("ALSA: seq: Add UMP support")
    Cc: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: HyeongJun An <sammiee5311@gmail.com>
    Link: https://patch.msgid.link/20260623233841.853326-1-sammiee5311@gmail.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: us144mkii: capture_urb_complete: redundant usb_anchor_urb corrupts anchor list on each resubmission [+ + +]
Author: WenTao Liang <vulab@iscas.ac.cn>
Date:   Sat Jun 27 12:29:49 2026 +0800

    ALSA: us144mkii: capture_urb_complete: redundant usb_anchor_urb corrupts anchor list on each resubmission
    
    commit 5cff1529a2f9b3461a7f5a6e36a86682fc290534 upstream.
    
    In capture_urb_complete(), usb_anchor_urb() is called on every
    completion callback, but the URB is already anchored from the
    initial submission in tascam_trigger_start(). Each redundant call
    corrupts the anchor's doubly-linked list and inflates the URB
    refcount. When usb_kill_anchored_urbs() traverses the list during
    stream stop / suspend / disconnect, the corrupted list leads to
    use-after-free.
    
    Remove the redundant usb_anchor_urb() from the resubmit path.
    
    Cc: stable@vger.kernel.org
    Fixes: c1bb0c13e430 ("ALSA: usb-audio: us144mkii: Implement audio capture and decoding")
    Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>
    Link: https://patch.msgid.link/20260627042949.61767-1-vulab@iscas.ac.cn
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: usb-audio: add IFB_SILENCE_ON_EMPTY quirk for Behringer Flow 8 [+ + +]
Author: Gordon Chen <chengordon326@gmail.com>
Date:   Tue May 26 15:29:06 2026 +0800

    ALSA: usb-audio: add IFB_SILENCE_ON_EMPTY quirk for Behringer Flow 8
    
    commit a23812004228d4b041a858b927db787a7ff80f50 upstream.
    
    The Behringer Flow 8 (1397:050c) is an 8-channel USB mixer that
    declares OUT EP 0x01 with implicit feedback from capture EP 0x81 via
    its UAC2 endpoint companion descriptor. After 5-35 minutes of
    continuous playback, the device occasionally returns a capture URB in
    which every iso_frame_desc has a non-zero status (-EXDEV bursts,
    visible as rate-limited "frame N active: -18" lines in dmesg from
    pcm.c).
    
    In that case snd_usb_handle_sync_urb() at endpoint.c counts bytes==0
    and falls into the early "skip empty packets" return originally added
    for M-Audio Fast Track Ultra. As a result the playback EP loses its
    sole IFB-driven feeder and the OUT ring starves permanently: hw_ptr
    stops advancing while substream state remains RUNNING. Only USB
    re-enumeration recovers.
    
    Three independent ftrace captures (taken at the moment of stall via a
    userspace watchdog) consistently show:
    
      - 60-70 capture URB completions in the 70ms window before the marker
      - 0 retire_playback_urb / queue_pending_output_urbs /
        snd_usb_endpoint_implicit_feedback_sink calls
      - every usb_submit_urb in the window comes from
        snd_complete_urb+0x64e (capture self-resubmit), none from the
        queue_pending_output_urbs path
    
    Add a new opt-in quirk QUIRK_FLAG_IFB_SILENCE_ON_EMPTY: when set, the
    early return is skipped and we fall through to enqueue a packet_info
    whose packet_size[i] are all 0 (the existing loop already maps
    status!=0 packets to size 0). prepare_outbound_urb then emits a
    silence packet, the OUT ring keeps moving, and the device rides
    through the glitch.
    
    The default behaviour (early return) is preserved for all existing
    devices including M-Audio Fast Track Ultra. Only Flow 8 opts in here.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Gordon Chen <chengordon326@gmail.com>
    Link: https://patch.msgid.link/20260526072906.90106-1-chengordon326@gmail.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: usb-audio: avoid kobject path lookup in DualSense match [+ + +]
Author: Darvell Long <contact@darvell.me>
Date:   Wed Jun 24 07:37:23 2026 -0700

    ALSA: usb-audio: avoid kobject path lookup in DualSense match
    
    commit 7693c0cc415f3a16a7a3355f245474a5e661be4e upstream.
    
    The DualSense jack-detection input handler verifies that a matching input
    device belongs to the same physical controller by building kobject path
    strings for both the input device and the USB audio device, then comparing
    the path prefix.
    
    This was observed when a weak physical connection caused the controller
    to rapidly disconnect and reconnect. During that repeated hotplug,
    snd_dualsense_ih_match() can run while the controller's USB device is
    being disconnected. kobject_get_path() walks ancestor kobjects and
    dereferences their names; if the USB device kobject name is no longer
    valid, this can fault in strlen():
    
      RIP: 0010:strlen+0x10/0x30
      Call Trace:
       kobject_get_path+0x34/0x150
       snd_dualsense_ih_match+0x49/0xd0 [snd_usb_audio]
       input_register_device+0x566/0x6a0
       ps_probe+0xb89/0x1590 [hid_playstation]
    
    The same ownership check can be done without building kobject path
    strings. The input device is parented below the HID device, USB interface
    and USB device, so walking the input device parent chain and comparing
    against the mixer USB device preserves the check without dereferencing
    kobject names during disconnect.
    
    Fixes: 79d561c4ec04 ("ALSA: usb-audio: Add mixer quirk for Sony DualSense PS5")
    Cc: <stable@vger.kernel.org>
    Assisted-by: Cute:gpt-5.5
    Signed-off-by: Darvell Long <contact@darvell.me>
    Link: https://patch.msgid.link/20260624143723.2986353-1-contact@darvell.me
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: usb-audio: Propagate errors in scarlett_ctl_enum_put() [+ + +]
Author: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Date:   Sun Apr 19 17:30:30 2026 -0300

    ALSA: usb-audio: Propagate errors in scarlett_ctl_enum_put()
    
    commit 0f25cf1f02e3dba626791d949c759a48c0a44996 upstream.
    
    scarlett_ctl_enum_put() ignores the return value from
    snd_usb_set_cur_mix_value() and reports success whenever the
    requested enum value differs from the current one.
    
    If the SET_CUR request fails, the callback still returns success even
    though neither the hardware state nor the cached mixer value changed.
    
    Fixes: 76b188c4b370 ("ALSA: usb-audio: Scarlett mixer interface for 6i6, 18i6, 18i8 and 18i20")
    Cc: stable@vger.kernel.org
    Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Link: https://patch.msgid.link/20260419-usb-write-error-propagation-v1-2-5a3bd4a673ae@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: usb-audio: Propagate US-16x08 write errors in route/mix EQ-switch put callbacks [+ + +]
Author: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Date:   Sun Apr 19 17:30:31 2026 -0300

    ALSA: usb-audio: Propagate US-16x08 write errors in route/mix EQ-switch put callbacks
    
    commit 3c06aec8abda6ba068b58a8b7119cdb2a48456b1 upstream.
    
    Several US-16x08 mixer put callbacks log failed control URBs but
    still return success to userspace. That hides device write failures
    even though the requested value was not applied.
    
    Return the negative write error instead in the route, master, bus,
    channel, and EQ switch put callbacks.
    
    Fixes: d2bb390a2081 ("ALSA: usb-audio: Tascam US-16x08 DSP mixer quirk")
    Cc: stable@vger.kernel.org
    Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Link: https://patch.msgid.link/20260419-usb-write-error-propagation-v1-3-5a3bd4a673ae@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: usb-audio: Roll back quirk control caches on write errors [+ + +]
Author: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Date:   Wed Apr 29 10:20:01 2026 -0300

    ALSA: usb-audio: Roll back quirk control caches on write errors
    
    commit 6380957fa24251856a532e48a46a4dc3d1ae26b6 upstream.
    
    Several mixer quirk callbacks cache the requested
    control value in kcontrol->private_value before
    issuing a single vendor or class write.
    
    Their paired get and resume paths consume that cache
    directly, so a failed write currently leaves software
    state changed even though the update did not succeed.
    That can make later reads report a value the device
    never accepted and can replay the stale cache on resume.
    
    Restore the previous cached value on failure in
    the Audigy2NX LED, Emu0204 channel switch,
    Xonar U1 output switch, Native Instruments controls,
    FTU effect program switch, and Sound Blaster E1 input source switch.
    
    Fixes: 9cf3689bfe07 ("ALSA: usb-audio: Add audigy2nx resume support")
    Fixes: 5f503ee9e270 ("ALSA: usb-audio: Add Emu0204 channel switch resume support")
    Fixes: 2bfb14c3b8fb ("ALSA: usb-audio: Add Xonar U1 resume support")
    Fixes: da6d276957ea ("ALSA: usb-audio: Add resume support for Native Instruments controls")
    Fixes: 0b4e9cfcef05 ("ALSA: usb-audio: Add resume support for FTU controls")
    Fixes: 388fdb8f882a ("ALSA: usb-audio: Support changing input on Sound Blaster E1")
    Cc: stable@vger.kernel.org
    Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
    Link: https://patch.msgid.link/20260429-alsa-usb-quirks-cache-rollback-v1-1-01b35c688b80@gmail.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: usb-audio: Update Babyface Pro control caches only after successful writes [+ + +]
Author: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Date:   Wed Apr 29 10:20:02 2026 -0300

    ALSA: usb-audio: Update Babyface Pro control caches only after successful writes
    
    commit d8f802ccf1fdbeb89d62748d6a0d0fbd442c8127 upstream.
    
    snd_bbfpro_ctl_put() and snd_bbfpro_vol_put()
    cache the requested packed control state in
    kcontrol->private_value before issuing the USB write.
    
    Their get and resume paths use that cached value directly,
    so a failed write can leave the driver reporting and later
    replaying a setting the hardware never accepted.
    
    Update the cached state only after a successful USB write.
    
    Fixes: 3e8f3bd04716 ("ALSA: usb-audio: RME Babyface Pro mixer patch")
    Cc: stable@vger.kernel.org
    Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
    Link: https://patch.msgid.link/20260429-alsa-usb-quirks-cache-rollback-v1-2-01b35c688b80@gmail.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: usb-audio: Update US-16x08 EQ/comp shadow state after successful writes [+ + +]
Author: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Date:   Sun Apr 19 17:30:32 2026 -0300

    ALSA: usb-audio: Update US-16x08 EQ/comp shadow state after successful writes
    
    commit a440c17869ecd71da0f295b62868fc742d09a8ba upstream.
    
    snd_us16x08_comp_put() and snd_us16x08_eq_put() update their
    software stores before sending the USB write. If the transfer
    fails, later get callbacks report a value the hardware never
    accepted.
    
    Build the outgoing message from the current store plus the
    pending value, then commit the store only after a successful
    write.
    
    Fixes: d2bb390a2081 ("ALSA: usb-audio: Tascam US-16x08 DSP mixer quirk")
    Cc: stable@vger.kernel.org
    Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Link: https://patch.msgid.link/20260419-usb-write-error-propagation-v1-4-5a3bd4a673ae@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: usx2y: us144mkii: fix work UAF on disconnect [+ + +]
Author: HyeongJun An <sammiee5311@gmail.com>
Date:   Wed Jul 1 18:52:31 2026 +0900

    ALSA: usx2y: us144mkii: fix work UAF on disconnect
    
    commit 147996e7e7c9e8339c0e04f6fa7ccb3e4d448ff7 upstream.
    
    tascam_disconnect() cancels capture_work and midi_in_work before
    usb_kill_anchored_urbs() kills the capture/MIDI-in URBs.  Those URBs
    self-resubmit, and their completion handlers reschedule the work.
    
    A URB that completes in the small window between cancel_work_sync() and
    usb_kill_anchored_urbs() therefore re-arms the work after its only
    cancel.  Nothing cancels it again before snd_card_free() frees the
    card-private tascam structure, so the work handler then runs on freed
    memory.
    
    Kill the anchored URBs before cancelling the work; once the work is
    cancelled no remaining URB can complete to re-arm it.
    
    Fixes: c1bb0c13e430 ("ALSA: usb-audio: us144mkii: Implement audio capture and decoding")
    Cc: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: HyeongJun An <sammiee5311@gmail.com>
    Link: https://patch.msgid.link/20260701095231.1020811-1-sammiee5311@gmail.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: virtio: Add missing 384 kHz PCM rate mapping [+ + +]
Author: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Date:   Fri May 15 10:32:25 2026 -0300

    ALSA: virtio: Add missing 384 kHz PCM rate mapping
    
    commit 83fbbcb7935ec6d2c8ba3bc133e8a0ead2ab0b2d upstream.
    
    The VirtIO sound UAPI defines VIRTIO_SND_PCM_RATE_384000, and ALSA
    has SNDRV_PCM_RATE_384000. However, virtio-snd's rate conversion
    tables stop at 192 kHz.
    
    A device advertising only 384 kHz is rejected as having no supported
    PCM frame rates. A device advertising 384 kHz together with lower rates
    does not expose 384 kHz through the ALSA hardware constraints. The
    selected ALSA rate also needs a reverse mapping for SET_PARAMS.
    
    Add the missing 384 kHz entries to both conversion tables.
    
    Fixes: 29b96bf50ba9 ("ALSA: virtio: build PCM devices and substream hardware descriptors")
    Fixes: da76e9f3e43a ("ALSA: virtio: PCM substream operators")
    Cc: stable@vger.kernel.org
    Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
    Link: https://patch.msgid.link/20260515-alsa-virtio-384k-rate-v1-1-35ecb5df835c@gmail.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: virtio: Validate control metadata from the device [+ + +]
Author: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Date:   Thu May 7 11:28:30 2026 -0300

    ALSA: virtio: Validate control metadata from the device
    
    commit c77a6cbb36ff8cbc1f084d94f8dcda5250935271 upstream.
    
    virtio-snd control handling trusts the device-provided control type and
    value count returned by the device.
    
    That metadata is then used directly to index g_v2a_type_map[] in
    virtsnd_kctl_info(), and to size loops and memcpy() operations in
    virtsnd_kctl_get() and virtsnd_kctl_put() against fixed-size
    virtio_snd_ctl_value and snd_ctl_elem_value arrays.
    
    A buggy or malicious device can therefore trigger out-of-bounds access by
    advertising an invalid control type or an oversized value count.
    
    Validate control type and count once in virtsnd_kctl_parse_cfg(), before
    querying enumerated items or exposing the control to ALSA.
    
    Fixes: d6568e3de42d ("ALSA: virtio: add support for audio controls")
    Cc: stable@vger.kernel.org
    Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
    Link: https://patch.msgid.link/20260507-alsa-virtio-validate-kctl-info-v1-1-7404fb12ec37@gmail.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: ymfpci: check snd_ctl_new1() return value [+ + +]
Author: Zhao Dongdong <zhaodongdong@kylinos.cn>
Date:   Wed May 27 20:09:12 2026 +0800

    ALSA: ymfpci: check snd_ctl_new1() return value
    
    commit e64d170346d00b580c0043de3e5ccb3e331c47d4 upstream.
    
    snd_ctl_new1() can return NULL when memory allocation fails.
    snd_ymfpci_create_spdif_controls() does not check the return value
    before dereferencing kctl->id.device, which can lead to a NULL pointer
    dereference.
    
    Add NULL checks after snd_ctl_new1() calls and return -ENOMEM if any
    fails.
    
    Assisted-by: Opencode:DeepSeek-V4-Flash
    Cc: stable@vger.kernel.org
    Fixes: c9b83ae4a160 ("ALSA: ymfpci: Fix kctl->id initialization")
    Signed-off-by: Zhao Dongdong <zhaodongdong@kylinos.cn>
    Link: https://patch.msgid.link/tencent_4745C5DC2333325C0EDAB1EFC88A136E6809@qq.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
arm64: fpsimd: Fix type mismatch in sme_{save,load}_state() [+ + +]
Author: Mark Rutland <mark.rutland@arm.com>
Date:   Wed Jun 3 12:06:12 2026 +0100

    arm64: fpsimd: Fix type mismatch in sme_{save,load}_state()
    
    commit 247bd153905085c18ff9006cca1ccb96dfd18e7f upstream.
    
    The sme_save_state() and sme_load_state() functions take a 32-bit int
    argument that describes whether to save/restore ZT0. Their assembly
    implementations consume the entire 64-bit register containing this
    32-bit value, and will attempt to save/restore ZT0 if any bit of
    that 64-bit register is non-zero.
    
    Per the AAPCS64 parameter passing rules, the callee is responsible for
    any necessary widening, and the upper 32-bits are permitted to contain
    arbitrary values. If the upper 32 bits are non-zero, this could result
    in an unexpected attempt to save/restore ZT0, and consequently could
    lead to unexpected traps/undefs/faults.
    
    In practice compilers are very unlikely to generate code where the upper
    32-bits would be non-zero, but they are permitted to do so.
    
    Fix this by only consuming the low 32 bits of the register, and update
    comments accordingly.
    
    Fixes: 95fcec713259 ("arm64/sme: Implement context switching for ZT0")
    Signed-off-by: Mark Rutland <mark.rutland@arm.com>
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Fuad Tabba <tabba@google.com>
    Cc: James Morse <james.morse@arm.com>
    Cc: Marc Zyngier <maz@kernel.org>
    Cc: Mark Brown <broonie@kernel.org>
    Cc: Oliver Upton <oupton@kernel.org>
    Cc: Vladimir Murzin <vladimir.murzin@arm.com>
    Cc: Will Deacon <will@kernel.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
audit: Fix data races of skb_queue_len() readers on audit_queue [+ + +]
Author: Chi Wang <wangchi@kylinos.cn>
Date:   Fri Jun 19 15:42:44 2026 +0800

    audit: Fix data races of skb_queue_len() readers on audit_queue
    
    commit c9a71daaecb2fb1d8c704545cc0b1c920b9bf5d7 upstream.
    
    Multiple readers access audit_queue.qlen via skb_queue_len() without
    holding the queue lock or using READ_ONCE(), while kauditd writes to
    this field via the skb_dequeue() → __skb_unlink() path with WRITE_ONCE()
    protected by a spinlock. This constitutes data races.
    
    All affected skb_queue_len(&audit_queue) call sites:
      - kauditd_thread() wait_event_freezable() condition
      - audit_receive_msg() AUDIT_GET handler (s.backlog assignment)
      - audit_receive() backlog check
      - audit_log_start() backlog check and pr_warn()
    
    KCSAN reports the following conflicting access pattern (one example):
    ==================================================================
    BUG: KCSAN: data-race in audit_log_start / skb_dequeue
    
    write (marked) to 0xffffffff8512ee20 of 4 bytes by task 661 on cpu 57:
     skb_dequeue+0x70/0xf0
     kauditd_send_queue+0x71/0x220
     kauditd_thread+0x1cb/0x430
     kthread+0x1c2/0x210
     ret_from_fork+0x162/0x1a0
     ret_from_fork_asm+0x1a/0x30
    
    read to 0xffffffff8512ee20 of 4 bytes by task 36586 on cpu 1:
     audit_log_start+0x2a0/0x6b0
     audit_core_dumps+0x64/0xa0
     do_coredump+0x14b/0x1260
     get_signal+0xeb2/0xf70
     arch_do_signal_or_restart+0x41/0x170
     exit_to_user_mode_loop+0xa2/0x1c0
     do_syscall_64+0x1a3/0x1c0
     entry_SYSCALL_64_after_hwframe+0x76/0xe0
    
    value changed: 0x00000001 -> 0x00000000
    ==================================================================
    
    Resolve the race by switching to lockless helper skb_queue_len_lockless(),
    which internally uses READ_ONCE() and properly pairs with the WRITE_ONCE()
    write accesses already present on the writer side.
    
    Cc: stable@vger.kernel.org
    Fixes: 3197542482df ("audit: rework audit_log_start()")
    Signed-off-by: Chi Wang <wangchi@kylinos.cn>
    Reviewed-by: Ricardo Robaina <rrobaina@redhat.com>
    [PM: line length tweak]
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

audit: fix potential integer overflow in audit_log_n_hex() [+ + +]
Author: Ricardo Robaina <rrobaina@redhat.com>
Date:   Thu Jul 2 11:04:11 2026 -0300

    audit: fix potential integer overflow in audit_log_n_hex()
    
    commit 65dfde57d1e29ce2b76fc23dd565eccd5c0bc0f0 upstream.
    
    The function calculates new_len as len << 1 for hex encoding. This
    has two overflow risks: the shift itself can overflow when len is
    large, and the result can be truncated when assigned to new_len
    (declared as int) from the size_t calculation.
    
    Fix by using check_shl_overflow() to catch shift overflow and
    changing new_len and loop counter i to size_t to prevent truncation.
    
    Cc: stable@vger.kernel.org
    Fixes: 168b7173959f ("AUDIT: Clean up logging of untrusted strings")
    Reviewed-by: Richard Guy Briggs <rgb@redhat.com>
    Signed-off-by: Ricardo Robaina <rrobaina@redhat.com>
    [PM: remove vertical whitspace noise]
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

audit: fix removal of dangling executable rules [+ + +]
Author: Ricardo Robaina <rrobaina@redhat.com>
Date:   Wed May 13 18:47:59 2026 -0300

    audit: fix removal of dangling executable rules
    
    commit 888a0396e154524f4027f27da84bdbec9eb68916 upstream.
    
    When an audited executable is deleted from the disk, its dentry
    becomes negative. Any later attempt to delete the associated audit
    rule will lead to audit_alloc_mark() encountering this negative
    dentry and immediately aborting, returning -ENOENT.
    
    This early abort prevents the subsystem from allocating the temporary
    fsnotify mark needed to construct the search key, meaning the kernel
    cannot find the existing rule in its own lists to delete it. This
    leaves a dangling rule in memory, resulting in the following error
    while attempting to delete the rule:
    
     # ./audit-dupe-exe-deadlock.sh
     No rules
     Error deleting rule (No such file or directory)
     There was an error while processing parameters
    
     # auditctl -l
     -a always,exit -S all -F exe=/tmp/file -F path=/tmp/file -F key=dr
    
     # auditctl -D
     Error deleting rule (No such file or directory)
     There was an error while processing parameters
    
    This patch fixes this issue by removing the d_really_is_negative()
    check. By doing so, a dummy mark can be successfully generated for
    the deleted path, which allows the audit subsystem to properly match
    and flush the dangling rule.
    
    Cc: stable@kernel.org
    Fixes: 76a53de6f7ff ("VFS/audit: introduce kern_path_parent() for audit")
    Acked-by: Waiman Long <longman@redhat.com>
    Acked-by: Richard Guy Briggs <rgb@redhat.com>
    Signed-off-by: Ricardo Robaina <rrobaina@redhat.com>
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
binder: fix UAF in binder_free_transaction() [+ + +]
Author: Carlos Llamas <cmllamas@google.com>
Date:   Fri Jun 19 18:52:31 2026 +0000

    binder: fix UAF in binder_free_transaction()
    
    commit f223d27a546c1e1f48d38fd67760e78f068fe8c4 upstream.
    
    In binder_free_transaction(), the t->to_proc is read under the t->lock.
    However, once the t->lock is dropped, the to_proc can die in parallel.
    This leads to a use-after-free error when we attempt to acquire its
    inner lock right afterwards:
    
      ==================================================================
      BUG: KASAN: slab-use-after-free in _raw_spin_lock+0xe4/0x1a0
      Write of size 4 at addr ffff00001125da70 by task B/672
    
      CPU: 20 UID: 0 PID: 672 Comm: B Not tainted 7.1.0-rc6-00284-g8e65320d91cd #4 PREEMPT
      Hardware name: linux,dummy-virt (DT)
      Call trace:
       _raw_spin_lock+0xe4/0x1a0
       binder_free_transaction+0x8c/0x320
       binder_send_failed_reply+0x21c/0x2f8
       binder_thread_release+0x488/0x7e0
       binder_ioctl+0x12c0/0x29a0
      [...]
    
      Allocated by task 675:
       __kmalloc_cache_noprof+0x174/0x444
       binder_open+0x118/0xb70
       do_dentry_open+0x374/0x1040
       vfs_open+0x58/0x3bc
      [...]
    
      Freed by task 212:
       __kasan_slab_free+0x58/0x80
       kfree+0x1a0/0x4a4
       binder_proc_dec_tmpref+0x32c/0x5e0
       binder_deferred_func+0xc48/0x104c
       process_one_work+0x53c/0xbc0
      [...]
      ==================================================================
    
    To prevent this, pin the target thread (t->to_thread) to guarantee the
    target process remains alive. Undelivered transactions without a target
    thread are already safe, as the target process can only be the current
    context in those paths.
    
    Cc: stable <stable@kernel.org>
    Reported-by: Alice Ryhl <aliceryhl@google.com>
    Closes: https://lore.kernel.org/all/aikJKVuny_eOivwN@google.com/
    Fixes: a370003cc301 ("binder: fix possible UAF when freeing buffer")
    Signed-off-by: Carlos Llamas <cmllamas@google.com>
    Reviewed-by: Alice Ryhl <aliceryhl@google.com>
    Link: https://patch.msgid.link/20260619185233.2194678-2-cmllamas@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

binder: fix UAF in binder_thread_release() [+ + +]
Author: Carlos Llamas <cmllamas@google.com>
Date:   Fri Jun 19 18:52:30 2026 +0000

    binder: fix UAF in binder_thread_release()
    
    commit 114a116aaa5f0295376cdf12da743c5bce3b20ce upstream.
    
    When a thread exits, binder_thread_release() walks its transaction stack
    to clear the t->from and t->to_proc that correspond with the exiting
    thread. However, a process dying in parallel might attempt to kfree some
    of these transactions. And if one of them has no associated t->to_proc,
    the t->to_proc->inner_lock will not be acquired.
    
    This means that transaction accesses in binder_thread_release() after
    t->to_proc has been cleared might race with binder_free_transaction()
    and cause a use-after-free error as reported by KASAN:
    
      ==================================================================
      BUG: KASAN: slab-use-after-free in binder_thread_release+0x5d0/0x798
      Write of size 8 at addr ffff000016627500 by task X/715
    
      CPU: 17 UID: 0 PID: 715 Comm: X Not tainted 7.1.0-rc5-00149-g8fde5d1d47f6 #30 PREEMPT
      Hardware name: linux,dummy-virt (DT)
      Call trace:
       binder_thread_release+0x5d0/0x798
       binder_ioctl+0x12c0/0x299c
       [...]
    
      Allocated by task 717 on cpu 18 at 67.267803s:
       __kasan_kmalloc+0xa0/0xbc
       __kmalloc_cache_noprof+0x174/0x444
       binder_transaction+0x554/0x8150
       binder_thread_write+0xa30/0x4354
       binder_ioctl+0x20f0/0x299c
       [...]
    
      Freed by task 202 on cpu 18 at 90.416221s:
       __kasan_slab_free+0x58/0x80
       kfree+0x1a0/0x4a4
       binder_free_transaction+0x150/0x294
       binder_send_failed_reply+0x398/0x6d8
       binder_release_work+0x3e4/0x4ec
       binder_deferred_func+0xbd8/0x104c
       [...]
      ==================================================================
    
    In order to avoid this, make sure that binder_free_transaction() reads
    the t->to_proc under the transaction lock. This will serialize the
    transaction release with the accesses in binder_thread_release(). Plus,
    it matches the documented locking rules for @to_proc.
    
    Cc: stable <stable@kernel.org>
    Fixes: 7a4408c6bd3e ("binder: make sure accesses to proc/thread are safe")
    Reviewed-by: Alice Ryhl <aliceryhl@google.com>
    Signed-off-by: Carlos Llamas <cmllamas@google.com>
    Link: https://patch.msgid.link/20260619185233.2194678-1-cmllamas@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
block: partitions: fix of_node refcount leak in of_partition() [+ + +]
Author: Wentao Liang <vulab@iscas.ac.cn>
Date:   Tue May 26 10:21:24 2026 +0000

    block: partitions: fix of_node refcount leak in of_partition()
    
    commit 148cd4873115feb266c002d4d4618ea7f14342d9 upstream.
    
    of_partition() calls of_node_get() on the parent device node at the
    beginning of the function, storing the reference in 'partitions_np'.
    This reference is leaked in two paths:
    
    1. The compatibility check at the top of the function returns 0
       without releasing partitions_np when the node exists but is not
       "fixed-partitions" compatible.
    
    2. The function returns 1 at the end after successfully processing
       all partitions without releasing partitions_np.
    
    Fix both leaks by adding of_node_put(partitions_np) on each path.
    
    Fixes: 2e3a191e89f9 ("block: add support for partition table defined in OF")
    Cc: stable@vger.kernel.org
    Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
    Reviewed-by: Md Haris Iqbal <haris.iqbal@linux.dev>
    Link: https://patch.msgid.link/20260526102124.2283846-1-vulab@iscas.ac.cn
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

block: skip sync_blockdev() on surprise removal in bdev_mark_dead() [+ + +]
Author: Chao Shi <coshi036@gmail.com>
Date:   Fri May 22 18:00:25 2026 -0400

    block: skip sync_blockdev() on surprise removal in bdev_mark_dead()
    
    commit 49f06cff50a4ccf3b7a1a662ceb892b3b21a527a upstream.
    
    bdev_mark_dead()'s @surprise == true means the device is already gone.
    The filesystem callback fs_bdev_mark_dead() honours this and skips
    sync_filesystem(), but the bare block device path (no ->mark_dead op)
    lost its !surprise guard when the holder ->mark_dead callback was wired
    up (see Fixes), and now calls sync_blockdev() unconditionally, which can
    hang forever waiting on writeback that can no longer complete.
    
    syzkaller hit this via nvme_reset_work()'s "I/O queues lost" path:
    nvme_mark_namespaces_dead() -> blk_mark_disk_dead() ->
    bdev_mark_dead(bdev, true) -> sync_blockdev() blocks in
    folio_wait_writeback(), wedging the reset worker and every task waiting
    on it.
    
    Skip the sync on surprise removal, matching fs_bdev_mark_dead();
    invalidate_bdev() still runs. Orderly removal (surprise == false) is
    unchanged.
    
    Found by FuzzNvme(Syzkaller with FEMU fuzzing framework).
    
    Fixes: d8530de5a6e8 ("block: call into the file system for bdev_mark_dead")
    Acked-by: Sungwoo Kim <iam@sung-woo.kim>
    Acked-by: Dave Tian <daveti@purdue.edu>
    Acked-by: Weidong Zhu <weizhu@fiu.edu>
    Signed-off-by: Chao Shi <coshi036@gmail.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Link: https://patch.msgid.link/20260522220025.1770388-1-coshi036@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Bluetooth: 6lowpan: Fix using chan->conn as indication to no remote netdev [+ + +]
Author: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date:   Fri Jun 12 10:21:09 2026 -0400

    Bluetooth: 6lowpan: Fix using chan->conn as indication to no remote netdev
    
    commit d38eaf611839b85ade3dd3db309dbc8aaaaf0095 upstream.
    
    b66774b48dd9 ("Bluetooth: L2CAP: Fix UAF in channel timeout by holding
    conn ref") don't reset the chan->conn to NULL anymore making the bt#
    netdev not be remove once the last l2cap_chan_del is removed.
    
    Instead of restoring the original behavior this remove the logic of
    keeping the interface after the last channel is removed because it
    never worked as intended and the l2cap_chan_del always detach its
    l2cap_conn which results in always removing the channel anyway.
    
    Fixes: b66774b48dd9 ("Bluetooth: L2CAP: Fix UAF in channel timeout by holding conn ref")
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: bnep: pin L2CAP connection during netdev registration [+ + +]
Author: Yousef Alhouseen <alhouseenyousef@gmail.com>
Date:   Sun Jun 28 02:50:58 2026 +0200

    Bluetooth: bnep: pin L2CAP connection during netdev registration
    
    commit bb067a99a0356196c0b89a95721985485ebce5a5 upstream.
    
    bnep_add_connection() reads the L2CAP connection without holding the
    channel lock, then passes its HCI device to register_netdev(). Controller
    teardown can clear and release that connection concurrently, leaving the
    network device registration path to dereference a freed parent device.
    
    Take a reference to the L2CAP connection while holding the channel lock.
    Retain it until register_netdev() has taken the parent device reference.
    
    Fixes: 65f53e9802db ("Bluetooth: Access BNEP session addresses through L2CAP channel")
    Reported-by: syzbot+fed5dce4553262f3b35c@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=fed5dce4553262f3b35c
    Cc: stable@vger.kernel.org
    Signed-off-by: Yousef Alhouseen <alhouseenyousef@gmail.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: btmtksdio: fix infinite loop in btmtksdio_txrx_work() [+ + +]
Author: Sergey Senozhatsky <senozhatsky@chromium.org>
Date:   Tue Jun 9 21:10:06 2026 +0900

    Bluetooth: btmtksdio: fix infinite loop in btmtksdio_txrx_work()
    
    commit a257407e2bbbb099ed427719a50563f67fa366d8 upstream.
    
    Every once in a while we see a hung btmtksdio_flush() task:
    
     INFO: task kworker/u17:0:189 blocked for more than 122 seconds.
     __cancel_work_timer+0x3f4/0x460
     cancel_work_sync+0x1c/0x2c
     btmtksdio_flush+0x2c/0x40
     hci_dev_open_sync+0x10c4/0x2190
     [..]
    
    It all boils down to incorrect time_is_before_jiffies() usage in
    btmtksdio_txrx_work().  The btmtksdio_txrx_work() loop is expected
    to be terminated if running for longer than 5*HZ.  However the
    timeout check is twisted:  time_is_before_jiffies(old_jiffies + 5*HZ)
    evaluates to true when old_jiffies + 5*HZ is in the past i.e. when a
    timeout has occurred.  Using OR with time_is_before_jiffies(txrx_timeout)
    means that:
    - before the 5-second timeout: the condition is `int_status || false`,
      so it loops as long as there are pending interrupts.
    - after the 5-second timeout: the condition becomes `int_status || true`,
      which is always true.
    
    When the loop becomes infinite btmtksdio_txrx_work() loop never
    terminates and never releases the SDIO host.
    
    Fix loop termination condition to actually enforce a 5*HZ timeout.
    
    Fixes: 26270bc189ea4 ("Bluetooth: btmtksdio: move interrupt service to work")
    Cc: stable@vger.kernel.org
    Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
    Reviewed-by: Sean Wang <sean.wang@mediatek.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: btnxpuart: Fix out-of-bounds firmware read in nxp_recv_fw_req_v3() [+ + +]
Author: Maoyi Xie <maoyixie.tju@gmail.com>
Date:   Wed Jun 17 16:36:52 2026 +0800

    Bluetooth: btnxpuart: Fix out-of-bounds firmware read in nxp_recv_fw_req_v3()
    
    commit badff6c3bed8923a1257a853f137d447976eec30 upstream.
    
    During the v3 firmware download the controller sends a v3_data_req with a
    32 bit offset and a 16 bit len. nxp_recv_fw_req_v3() checks only the lower
    bound of the offset and then sends firmware from that offset.
    
      nxpdev->fw_dnld_v3_offset = offset - nxpdev->fw_v3_offset_correction;
      serdev_device_write_buf(nxpdev->serdev, nxpdev->fw->data +
                              nxpdev->fw_dnld_v3_offset, len);
    
    Nothing checks that fw_dnld_v3_offset + len stays within nxpdev->fw->size,
    so a controller that asks for an offset or length past the firmware image
    makes the driver read past the end of nxpdev->fw->data and send that
    memory back over UART.
    
    nxp_recv_fw_req_v1() already bounds the same write. Add the equivalent
    check to the v3 path, reject the request when it falls outside the firmware
    image, and zero len on the error path so the fw_v3_prev_sent bookkeeping at
    free_skb stays consistent.
    
    Fixes: 689ca16e5232 ("Bluetooth: NXP: Add protocol support for NXP Bluetooth chipsets")
    Suggested-by: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
    Reviewed-by: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Maoyi Xie <maoyixie.tju@gmail.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: btusb: Add USB ID 2c4e:0128 for Mercusys MA60XNB [+ + +]
Author: Zenm Chen <zenmchen@gmail.com>
Date:   Tue May 26 00:19:42 2026 +0800

    Bluetooth: btusb: Add USB ID 2c4e:0128 for Mercusys MA60XNB
    
    commit 88b4d528eda4ac71c2952b3458f2abbc80a91cd2 upstream.
    
    Add USB ID 2c4e:0128 for Mercusys MA60XNB, an RTL8851BU-based
    Wi-Fi + Bluetooth adapter.
    
    The information in /sys/kernel/debug/usb/devices about the Bluetooth
    device is listed as the below:
    
    T:  Bus=03 Lev=01 Prnt=01 Port=04 Cnt=01 Dev#=  3 Spd=480  MxCh= 0
    D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=2c4e ProdID=0128 Rev= 0.00
    S:  Manufacturer=Realtek
    S:  Product=802.11ax WLAN Adapter
    S:  SerialNumber=00e04c000001
    C:* #Ifs= 3 Cfg#= 1 Atr=e0 MxPwr=500mA
    A:  FirstIf#= 0 IfCount= 2 Cls=e0(wlcon) Sub=01 Prot=01
    I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
    I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
    I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
    I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
    I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
    I:  If#= 1 Alt= 6 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  63 Ivl=1ms
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  63 Ivl=1ms
    I:* If#= 2 Alt= 0 #EPs= 8 Cls=ff(vend.) Sub=ff Prot=ff Driver=rtw89_8851bu
    E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=09(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=0a(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=0b(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=0c(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    Cc: stable@vger.kernel.org # 6.6.x
    Signed-off-by: Zenm Chen <zenmchen@gmail.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: btusb: fix use-after-free on marvell probe failure [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Thu Jun 4 08:37:37 2026 +0200

    Bluetooth: btusb: fix use-after-free on marvell probe failure
    
    commit c5b600a3c05b1a7a110d558df935a8fc8a471c79 upstream.
    
    Make sure to stop any TX URBs submitted during Marvell OOB wakeup
    configuration on later probe failures to avoid use-after-free in the
    completion callback.
    
    This issue was reported by Sashiko while reviewing a fix for a wakeup
    source leak in the btusb probe errors paths.
    
    Link: https://sashiko.dev/#/patchset/20260402092704.2346710-1-johan%40kernel.org
    Fixes: a4ccc9e33d2f ("Bluetooth: btusb: Configure Marvell to use one of the pins for oob wakeup")
    Cc: stable@vger.kernel.org      # 4.11
    Cc: Rajat Jain <rajatja@google.com>
    Signed-off-by: Johan Hovold <johan@kernel.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 use-after-free on registration failure [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Thu Jun 4 08:37:36 2026 +0200

    Bluetooth: btusb: fix use-after-free on registration failure
    
    commit eedc6867ebad73edbfaf9a0a65fbef7115cc4753 upstream.
    
    Make sure to release the sibling interfaces in case controller
    registration fails to avoid use-after-free and double-free when they are
    eventually disconnected.
    
    This issue was reported by Sashiko while reviewing a fix for a wakeup
    source leak in the btusb probe errors paths.
    
    Link: https://sashiko.dev/#/patchset/20260402092704.2346710-1-johan%40kernel.org
    Fixes: 9bfa35fe422c ("[Bluetooth] Add SCO support to btusb driver")
    Fixes: 9d08f50401ac ("Bluetooth: btusb: Add support for Broadcom LM_DIAG interface")
    Cc: stable@vger.kernel.org      # 2.6.27
    Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
    Signed-off-by: Johan Hovold <johan@kernel.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 wakeup source leak on probe failure [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Thu Jun 4 08:37:38 2026 +0200

    Bluetooth: btusb: fix wakeup source leak on probe failure
    
    commit 3d93e1bb0fb881fe3ef961d1120556658e9cac4d upstream.
    
    Make sure to disable wakeup on probe failure to avoid leaking the wakeup
    source.
    
    Fixes: fd913ef7ce61 ("Bluetooth: btusb: Add out-of-band wakeup support")
    Cc: stable@vger.kernel.org      # 4.11
    Cc: Rajat Jain <rajatja@google.com>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: fix UAF in bt_accept_dequeue() [+ + +]
Author: Yousef Alhouseen <alhouseenyousef@gmail.com>
Date:   Sun Jun 28 02:23:05 2026 +0200

    Bluetooth: fix UAF in bt_accept_dequeue()
    
    commit 4bd0b274054f2679f28b70222b607bb0afc3ab9a upstream.
    
    bt_accept_get() takes a temporary reference before dropping the accept
    queue lock. bt_accept_dequeue() currently drops that reference before
    bt_accept_unlink(), leaving only the queue reference.
    
    bt_accept_unlink() drops the queue reference. The subsequent
    sock_hold() therefore accesses freed memory if it was the final
    reference, as observed by KASAN during listening L2CAP socket cleanup.
    
    Retain the temporary queue-walk reference through unlink and hand it to
    the caller on success. Drop it explicitly on the closed and
    not-yet-connected paths.
    
    Fixes: ab1513597c6c ("Bluetooth: fix UAF in l2cap_sock_cleanup_listen() vs l2cap_conn_del()")
    Reported-by: syzbot+674ff7e4d7fdfd572afc@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=674ff7e4d7fdfd572afc
    Cc: stable@vger.kernel.org
    Signed-off-by: Yousef Alhouseen <alhouseenyousef@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_conn: Fix null ptr deref in hci_abort_conn() [+ + +]
Author: Siwei Zhang <oss@fourdim.xyz>
Date:   Mon Jun 15 11:33:05 2026 -0400

    Bluetooth: hci_conn: Fix null ptr deref in hci_abort_conn()
    
    commit 12917f591cea1af36087dba5b9ec888652f0b42a upstream.
    
    hci_abort_conn() read hci_skb_event(hdev->sent_cmd) when a connection
    was pending, but hdev->sent_cmd can be NULL while req_status is still
    HCI_REQ_PEND, leading to a NULL pointer dereference and a general
    protection fault from the hci_rx_work() receive path.
    
    Instead of inspecting hdev->sent_cmd, track the in-flight create
    connection command with a new per-connection HCI_CONN_CREATE flag and
    route all cancellation through hci_cancel_connect_sync(), which
    dispatches to a dedicated per-type cancel function. The create command
    is in exactly one of two states: still queued, or in flight. The cancel
    function holds cmd_sync_work_lock across the whole decision: the worker
    takes this lock to dequeue every entry, so while it is held a queued
    command cannot start running and an in-flight command cannot complete
    and let the next command become pending. This keeps the flag test and
    hci_cmd_sync_cancel() atomic with respect to the worker, so a queued
    command is simply dequeued, and an in-flight command owned by this
    connection is cancelled without the risk of cancelling an unrelated
    command that became pending in the meantime. CIS uses the same flag
    mechanism via HCI_CONN_CREATE_CIS but cannot be dequeued per-connection.
    
    hci_acl_create_conn_sync() and hci_le_create_conn_sync() clear
    HCI_CONN_CREATE after the create command completes, but the command
    status handler can free conn via hci_conn_del() (for example when the
    controller rejects the connection) while the worker is still blocked on
    the connection complete event. Hold a reference on conn across the
    create command so the flag can be cleared without a use-after-free.
    
    Fixes: a13f316e90fd ("Bluetooth: hci_conn: Consolidate code for aborting connections")
    Cc: stable@vger.kernel.org
    Suggested-by: XIAO WU <xiaowu.417@qq.com>
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: Siwei Zhang <oss@fourdim.xyz>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: hci_uart: clear HCI_UART_SENDING when write_work is canceled [+ + +]
Author: Pauli Virtanen <pav@iki.fi>
Date:   Sat Jun 13 21:43:37 2026 +0300

    Bluetooth: hci_uart: clear HCI_UART_SENDING when write_work is canceled
    
    commit 1b0d946d6f08bd39211385bc703a440911b41e46 upstream.
    
    HCI_UART_SENDING bit in tx_state means write_work is pending and blocks
    queueing it again.  Currently this bit is not cleared when canceling the
    work in hci_uart_close(), which blocks future writes when device is
    reopened later if write_work was pending.
    
    Fix by clearing HCI_UART_SENDING when canceling the work.
    
    Also make clearing of tx_skb safe by using disable_work_sync +
    enable_work instead of just cancel_work_sync.  hci_uart_flush() purges
    the proto tx queue so we can cancel the pending write_work there,
    instead of doing it just in hci_uart_close().  Re-enable and possibly
    requeue the work after queue flush.
    
    Fixes: c1bb9336ae6b ("Bluetooth: hci_uart: fix UAFs and race conditions in close and init paths")
    Link: https://lore.kernel.org/linux-bluetooth/07e0a28650773abec711ee492fdb1bf5d21a6c98.camel@iki.fi/
    Cc: stable@vger.kernel.org
    Signed-off-by: Pauli Virtanen <pav@iki.fi>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: ISO: avoid NULL deref of conn in iso_conn_big_sync() [+ + +]
Author: Muhammad Bilal <meatuni001@gmail.com>
Date:   Sun Jun 21 21:23:05 2026 +0500

    Bluetooth: ISO: avoid NULL deref of conn in iso_conn_big_sync()
    
    commit d5541eb148da72d5e0a1bca8ecd171f9fc8b366f upstream.
    
    iso_conn_big_sync() drops the socket lock to call hci_get_route() and
    then re-acquires it, but dereferences iso_pi(sk)->conn->hcon afterwards
    without re-checking that conn is still valid.
    
    While the lock is dropped, the connection can be torn down under the
    same socket lock: iso_disconn_cfm() -> iso_conn_del() -> iso_chan_del()
    sets iso_pi(sk)->conn to NULL (and the broadcast teardown path can also
    clear conn->hcon on its own). When iso_conn_big_sync() re-acquires the
    lock and reads conn->hcon, conn may be NULL, causing a NULL pointer
    dereference (hcon is the first member of struct iso_conn).
    
    This path is reached from iso_sock_recvmsg() for a PA-sync broadcast
    sink socket (BT_SK_DEFER_SETUP | BT_SK_PA_SYNC), so the dropped-lock
    window can race with connection teardown driven by controller events.
    
    Re-validate iso_pi(sk)->conn and its hcon after re-acquiring the socket
    lock and bail out if the connection went away, as already done in the
    sibling iso_sock_rebind_bc().
    
    Fixes: 7a17308c17880d ("Bluetooth: iso: Fix circular lock in iso_conn_big_sync")
    Cc: stable@vger.kernel.org
    Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: L2CAP: cancel pending_rx_work before taking conn->lock [+ + +]
Author: Runyu Xiao <runyu.xiao@seu.edu.cn>
Date:   Wed Jun 17 23:36:13 2026 +0800

    Bluetooth: L2CAP: cancel pending_rx_work before taking conn->lock
    
    commit 2641a9e0a1dd4af2e21995470a21d55dd35e5203 upstream.
    
    l2cap_conn_del() takes conn->lock and then calls cancel_work_sync() for
    pending_rx_work.  process_pending_rx() takes the same mutex, so teardown
    can deadlock against the worker it is flushing.
    
    This issue was found by our static analysis tool and then manually
    reviewed against the current tree.
    
    The grounded PoC kept the l2cap_conn_ready() -> queue_work(...,
    &conn->pending_rx_work) submit path, the l2cap_conn_del() ->
    cancel_work_sync(&conn->pending_rx_work) teardown path, and the
    process_pending_rx() -> mutex_lock(&conn->lock) worker edge.  Lockdep
    reported:
    
      WARNING: possible circular locking dependency detected
      process_pending_rx+0x21/0x2a [vuln_msv]
      l2cap_conn_del.constprop.0+0x3f/0x4e [vuln_msv]
      *** DEADLOCK ***
    
    Cancel pending_rx_work before taking conn->lock, matching the existing
    lock-before-drain ordering used for the two delayed works in the same
    teardown path.  The pending_rx queue is still purged after the work has
    been cancelled and conn->lock has been acquired.
    
    Fixes: 7ab56c3a6ecc ("Bluetooth: Fix deadlock in l2cap_conn_del()")
    Cc: stable@vger.kernel.org
    Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: L2CAP: Fix UAF in channel timeout by holding conn ref [+ + +]
Author: Marco Elver <elver@google.com>
Date:   Fri Jun 5 16:23:35 2026 +0200

    Bluetooth: L2CAP: Fix UAF in channel timeout by holding conn ref
    
    commit b66774b48dd98f07254951f74ea6f513efe7ff8b upstream.
    
    l2cap_chan_timeout() runs asynchronously and accesses chan->conn. If
    the connection is torn down while the timer is running or pending,
    chan->conn can be freed, leading to a use-after-free when the timer
    worker attempts to lock conn->lock:
    
    | BUG: KASAN: slab-use-after-free in instrument_atomic_read_write include/linux/instrumented.h:112 [inline]
    | BUG: KASAN: slab-use-after-free in atomic_long_try_cmpxchg_acquire include/linux/atomic/atomic-instrumented.h:4456 [inline]
    | BUG: KASAN: slab-use-after-free in __mutex_trylock_fast kernel/locking/mutex.c:161 [inline]
    | BUG: KASAN: slab-use-after-free in mutex_lock+0x4f/0xa0 kernel/locking/mutex.c:318
    | Write of size 8 at addr ffff8881298d9550 by task kworker/2:1/83
    |
    | CPU: 2 UID: 0 PID: 83 Comm: kworker/2:1 Not tainted 7.1.0-rc6-next-20260601-dirty #6 PREEMPT(full)
    | Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.17.0-debian-1.17.0-1 04/01/2014
    | Workqueue: events l2cap_chan_timeout
    | Call Trace:
    |  <TASK>
    |  instrument_atomic_read_write include/linux/instrumented.h:112 [inline]
    |  atomic_long_try_cmpxchg_acquire include/linux/atomic/atomic-instrumented.h:4456 [inline]
    |  __mutex_trylock_fast kernel/locking/mutex.c:161 [inline]
    |  mutex_lock+0x4f/0xa0 kernel/locking/mutex.c:318
    |  l2cap_chan_timeout+0x5d/0x1b0 net/bluetooth/l2cap_core.c:422
    |  process_one_work kernel/workqueue.c:3326 [inline]
    |  process_scheduled_works+0x7c8/0xfb0 kernel/workqueue.c:3409
    |  worker_thread+0x8a9/0xcf0 kernel/workqueue.c:3490
    |  kthread+0x346/0x430 kernel/kthread.c:436
    |  ret_from_fork+0x1a3/0x470 arch/x86/kernel/process.c:158
    |  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
    |  </TASK>
    |
    | Allocated by task 320:
    |  l2cap_conn_add+0xa7/0x820 net/bluetooth/l2cap_core.c:7075
    |  l2cap_connect_cfm+0xdb/0xd70 net/bluetooth/l2cap_core.c:7452
    |  hci_connect_cfm include/net/bluetooth/hci_core.h:2139 [inline]
    |  hci_remote_features_evt+0x52f/0x9f0 net/bluetooth/hci_event.c:3760
    |  hci_event_func net/bluetooth/hci_event.c:7796 [inline]
    |  hci_event_packet+0x561/0xa70 net/bluetooth/hci_event.c:7847
    |  hci_rx_work+0x370/0x890 net/bluetooth/hci_core.c:4040
    |  process_one_work kernel/workqueue.c:3326 [inline]
    |  process_scheduled_works+0x7c8/0xfb0 kernel/workqueue.c:3409
    |  worker_thread+0x8a9/0xcf0 kernel/workqueue.c:3490
    |  kthread+0x346/0x430 kernel/kthread.c:436
    |  ret_from_fork+0x1a3/0x470 arch/x86/kernel/process.c:158
    |  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
    |
    | Freed by task 322:
    |  hci_disconn_cfm include/net/bluetooth/hci_core.h:2154 [inline]
    |  hci_conn_hash_flush+0x101/0x1f0 net/bluetooth/hci_conn.c:2736
    |  hci_dev_close_sync+0x889/0xde0 net/bluetooth/hci_sync.c:5405
    |  hci_dev_do_close net/bluetooth/hci_core.c:502 [inline]
    |  hci_unregister_dev+0x1f7/0x370 net/bluetooth/hci_core.c:2679
    |  vhci_release+0x12a/0x180 drivers/bluetooth/hci_vhci.c:690
    |  __fput+0x369/0x890 fs/file_table.c:510
    |  task_work_run+0x160/0x1d0 kernel/task_work.c:233
    |  get_signal+0xf5b/0x1120 kernel/signal.c:2810
    |  arch_do_signal_or_restart+0x4d/0x600 arch/x86/kernel/signal.c:337
    |  __exit_to_user_mode_loop kernel/entry/common.c:64 [inline]
    |  exit_to_user_mode_loop+0x85/0x510 kernel/entry/common.c:98
    |  do_syscall_64+0x263/0x3d0 arch/x86/entry/syscall_64.c:100
    |  entry_SYSCALL_64_after_hwframe+0x77/0x7f
    |
    | The buggy address belongs to the object at ffff8881298d9400
    |  which belongs to the cache kmalloc-512 of size 512
    | The buggy address is located 336 bytes inside of
    |  freed 512-byte region [ffff8881298d9400, ffff8881298d9600)
    
    Fix it by having chan->conn hold a reference to l2cap_conn (via
    l2cap_conn_get) when the channel is added to the connection, and
    releasing it in the channel destructor. This ensures the l2cap_conn
    remains alive as long as the channel exists.
    
    A new FLAG_DEL channel flag is introduced to indicate that the channel
    has been deleted from its connection. l2cap_chan_del() atomically sets
    this flag using test_and_set_bit() instead of setting chan->conn to
    NULL. All asynchronous workers (l2cap_chan_timeout, l2cap_ack_timeout,
    l2cap_monitor_timeout, l2cap_retrans_timeout) and l2cap_chan_send()
    check FLAG_DEL to determine whether the channel has been torn down,
    rather than testing chan->conn for NULL.
    
    Fixes: 8c8e620467a7 ("Bluetooth: L2CAP: use chan timer to close channels in cleanup_listen()")
    Cc: <stable@vger.kernel.org>
    Cc: Siwei Zhang <oss@fourdim.xyz>
    Cc: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Assisted-by: Gemini:gemini-3.1-pro-preview
    Reported-by: https://sashiko.dev/#/patchset/20260521021249.3258069-1-oss%40fourdim.xyz
    Signed-off-by: Marco Elver <elver@google.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: L2CAP: validate option length before reading conf opt value [+ + +]
Author: Muhammad Bilal <meatuni001@gmail.com>
Date:   Sun Jun 21 00:56:35 2026 +0500

    Bluetooth: L2CAP: validate option length before reading conf opt value
    
    commit 687617555cedfb74c9e3cb85d759b908dcb17856 upstream.
    
    l2cap_get_conf_opt() derives the option length from the
    attacker-controlled opt->len field and immediately dereferences
    opt->val (as u8, get_unaligned_le16() or get_unaligned_le32(), or a
    raw pointer for the default case) before any caller has confirmed
    that opt->len bytes are present in the buffer. The callers
    (l2cap_parse_conf_req(), l2cap_parse_conf_rsp() and
    l2cap_conf_rfc_get()) only detect a malformed option afterwards, once
    the running length has gone negative, by which point the
    out-of-bounds read has already executed.
    
    An existing post-hoc length check keeps the garbage value from being
    consumed, so this is not a data leak in the current control flow. It
    is still a validate-after-use ordering bug: up to 4 bytes are read
    past the end of the buffer before it is known to contain them, and it
    is fragile to future changes in the callers.
    
    Fix it at the source. Pass the end of the buffer into
    l2cap_get_conf_opt() and refuse to touch opt->val unless the full
    option (header + value) fits. Each caller computes an end pointer
    once before the loop and checks the return value directly instead of
    inferring the error from a negative length.
    
    Fixes: 7c9cbd0b5e38 ("Bluetooth: Verify that l2cap_get_conf_opt provides large enough buffer")
    Cc: stable@vger.kernel.org
    Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: MGMT: Fix UAF of hci_conn_params in add_device_complete [+ + +]
Author: Samuel Page <sam@bynar.io>
Date:   Mon Jun 15 16:09:22 2026 +0100

    Bluetooth: MGMT: Fix UAF of hci_conn_params in add_device_complete
    
    commit fa85d985f614bc3feb343000f14a1072e99b0df1 upstream.
    
    add_device_complete() runs from the hci_cmd_sync_work kworker, which
    holds only hci_req_sync_lock and *not* hci_dev_lock.  It calls
    hci_conn_params_lookup() and then dereferences the returned object
    (params->flags) without taking hci_dev_lock:
    
            params = hci_conn_params_lookup(hdev, &cp->addr.bdaddr,
                                            le_addr_type(cp->addr.type));
            ...
            device_flags_changed(NULL, hdev, &cp->addr.bdaddr,
                                 cp->addr.type, hdev->conn_flags,
                                 params ? params->flags : 0);
    
    hci_conn_params_lookup() walks hdev->le_conn_params and is documented to
    require hdev->lock.  A concurrent MGMT_OP_REMOVE_DEVICE
    (remove_device()), which does run under hci_dev_lock, can call
    hci_conn_params_free() to list_del() and kfree() the very object the
    lookup returned, so the subsequent params->flags read touches freed
    memory [0].
    
    Hold hci_dev_lock() across the hci_conn_params_lookup() and the read of
    params->flags (and the matching event emission) so the lookup result
    cannot be freed by a concurrent remove_device() before it is used,
    honouring the locking contract of hci_conn_params_lookup().
    
    [0]: (trailing page/memory-state dump trimmed)
    BUG: KASAN: slab-use-after-free in add_device_complete+0x358/0x3d8 net/bluetooth/mgmt.c:7671
    Read of size 1 at addr ffff000017ab26c1 by task kworker/u9:8/388
    
    CPU: 1 UID: 0 PID: 388 Comm: kworker/u9:8 Not tainted 7.0.11 #20 PREEMPT
    Hardware name: linux,dummy-virt (DT)
    Workqueue: hci0 hci_cmd_sync_work
    Call trace:
     show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:499 (C)
     __dump_stack lib/dump_stack.c:94 [inline]
     dump_stack_lvl+0xb4/0xd4 lib/dump_stack.c:120
     print_address_description mm/kasan/report.c:378 [inline]
     print_report+0x118/0x5d8 mm/kasan/report.c:482
     kasan_report+0xb0/0xf4 mm/kasan/report.c:595
     __asan_report_load1_noabort+0x20/0x2c mm/kasan/report_generic.c:378
     add_device_complete+0x358/0x3d8 net/bluetooth/mgmt.c:7671
     hci_cmd_sync_work+0x14c/0x240 net/bluetooth/hci_sync.c:334
     process_one_work+0x628/0xd38 kernel/workqueue.c:3289
     process_scheduled_works kernel/workqueue.c:3372 [inline]
     worker_thread+0x7a8/0xac0 kernel/workqueue.c:3453
     kthread+0x39c/0x444 kernel/kthread.c:436
     ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860
    
    Allocated by task 3401:
     kasan_save_stack+0x3c/0x64 mm/kasan/common.c:57
     kasan_save_track+0x20/0x3c mm/kasan/common.c:78
     kasan_save_alloc_info+0x40/0x54 mm/kasan/generic.c:570
     poison_kmalloc_redzone mm/kasan/common.c:398 [inline]
     __kasan_kmalloc+0xd4/0xd8 mm/kasan/common.c:415
     kasan_kmalloc include/linux/kasan.h:263 [inline]
     __kmalloc_cache_noprof+0x1b0/0x458 mm/slub.c:5385
     kmalloc_noprof include/linux/slab.h:950 [inline]
     kzalloc_noprof include/linux/slab.h:1188 [inline]
     hci_conn_params_add+0x10c/0x4b0 net/bluetooth/hci_core.c:2279
     hci_conn_params_set net/bluetooth/mgmt.c:5162 [inline]
     add_device+0x5b4/0xa54 net/bluetooth/mgmt.c:7755
     hci_mgmt_cmd net/bluetooth/hci_sock.c:1721 [inline]
     hci_sock_sendmsg+0x10b4/0x1dd0 net/bluetooth/hci_sock.c:1841
     sock_sendmsg_nosec net/socket.c:727 [inline]
     __sock_sendmsg+0xe0/0x128 net/socket.c:742
     sock_write_iter+0x250/0x390 net/socket.c:1195
     new_sync_write fs/read_write.c:595 [inline]
     vfs_write+0x66c/0xab0 fs/read_write.c:688
     ksys_write+0x1fc/0x24c fs/read_write.c:740
     __do_sys_write fs/read_write.c:751 [inline]
     __se_sys_write fs/read_write.c:748 [inline]
     __arm64_sys_write+0x70/0xa4 fs/read_write.c:748
     __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline]
     invoke_syscall+0x84/0x2a8 arch/arm64/kernel/syscall.c:49
     el0_svc_common.constprop.0+0xe4/0x294 arch/arm64/kernel/syscall.c:132
     do_el0_svc+0x44/0x5c arch/arm64/kernel/syscall.c:151
     el0_svc+0x38/0xac arch/arm64/kernel/entry-common.c:724
     el0t_64_sync_handler+0xa0/0xe4 arch/arm64/kernel/entry-common.c:743
     el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:596
    
    Freed by task 3740:
     kasan_save_stack+0x3c/0x64 mm/kasan/common.c:57
     kasan_save_track+0x20/0x3c mm/kasan/common.c:78
     kasan_save_free_info+0x4c/0x74 mm/kasan/generic.c:584
     poison_slab_object mm/kasan/common.c:253 [inline]
     __kasan_slab_free+0x88/0xb8 mm/kasan/common.c:285
     kasan_slab_free include/linux/kasan.h:235 [inline]
     slab_free_hook mm/slub.c:2685 [inline]
     slab_free mm/slub.c:6170 [inline]
     kfree+0x14c/0x458 mm/slub.c:6488
     hci_conn_params_free+0x288/0x484 net/bluetooth/hci_core.c:2312
     remove_device+0x4b0/0x968 net/bluetooth/mgmt.c:7919
     hci_mgmt_cmd net/bluetooth/hci_sock.c:1721 [inline]
     hci_sock_sendmsg+0x10b4/0x1dd0 net/bluetooth/hci_sock.c:1841
     sock_sendmsg_nosec net/socket.c:727 [inline]
     __sock_sendmsg+0xe0/0x128 net/socket.c:742
     sock_write_iter+0x250/0x390 net/socket.c:1195
     new_sync_write fs/read_write.c:595 [inline]
     vfs_write+0x66c/0xab0 fs/read_write.c:688
     ksys_write+0x1fc/0x24c fs/read_write.c:740
     __do_sys_write fs/read_write.c:751 [inline]
     __se_sys_write fs/read_write.c:748 [inline]
     __arm64_sys_write+0x70/0xa4 fs/read_write.c:748
     __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline]
     invoke_syscall+0x84/0x2a8 arch/arm64/kernel/syscall.c:49
     el0_svc_common.constprop.0+0xe4/0x294 arch/arm64/kernel/syscall.c:132
     do_el0_svc+0x44/0x5c arch/arm64/kernel/syscall.c:151
     el0_svc+0x38/0xac arch/arm64/kernel/entry-common.c:724
     el0t_64_sync_handler+0xa0/0xe4 arch/arm64/kernel/entry-common.c:743
     el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:596
    
    Fixes: 1e2e3044c1bc ("Bluetooth: MGMT: Fix MGMT_OP_ADD_DEVICE invalid device flags")
    Cc: stable@vger.kernel.org
    Assisted-by: Bynario AI
    Signed-off-by: Samuel Page <sam@bynar.io>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
bpf: Allow LPM map access from sleepable BPF programs [+ + +]
Author: Vlad Poenaru <vlad.wing@gmail.com>
Date:   Tue Jun 9 06:55:57 2026 -0700

    bpf: Allow LPM map access from sleepable BPF programs
    
    commit 2f884d371fafea137afea504d49ee4a7c8d7985b upstream.
    
    trie_lookup_elem() annotates its rcu_dereference_check() walks with
    only rcu_read_lock_bh_held().  Because rcu_dereference_check(p, c)
    resolves to "c || rcu_read_lock_held()", this passes for XDP/NAPI and
    classic RCU readers but fails for sleepable BPF programs, which enter
    via __bpf_prog_enter_sleepable() and hold only rcu_read_lock_trace().
    
    trie_update_elem() and trie_delete_elem() have the same problem in a
    different form: they walk the trie with plain rcu_dereference(), which
    asserts rcu_read_lock_held() unconditionally.  Both are reachable from
    sleepable BPF programs via the bpf_map_update_elem / bpf_map_delete_elem
    helpers, and from the syscall path under classic rcu_read_lock().  In
    the writer paths the trie is actually protected by trie->lock (an
    rqspinlock taken across the walk); we never relied on the RCU read-side
    lock to keep nodes alive there.
    
    A sleepable LSM hook that ends up touching an LPM trie therefore
    triggers lockdep on debug kernels:
    
      =============================
      WARNING: suspicious RCU usage
      7.1.0-... Tainted: G            E
      -----------------------------
      kernel/bpf/lpm_trie.c:249 suspicious rcu_dereference_check() usage!
      1 lock held by net_tests/540:
       #0: (rcu_tasks_trace_srcu_struct){....}-{0:0},
           at: __bpf_prog_enter_sleepable+0x26/0x280
      Call Trace:
       dump_stack_lvl
       lockdep_rcu_suspicious
       trie_lookup_elem
       bpf_prog_..._enforce_security_socket_connect
       bpf_trampoline_...
       security_socket_connect
       __sys_connect
       do_syscall_64
    
    This is lockdep-only -- no UAF, since Tasks Trace RCU does serialize
    against the trie's reclaim path -- but it spams the console once per
    distinct callsite on every debug kernel running a sleepable BPF LSM
    that touches an LPM trie, which is increasingly common.
    
    For the lookup path, switch the rcu_dereference_check() annotation
    from rcu_read_lock_bh_held() to bpf_rcu_lock_held(), which accepts all
    three contexts (classic, BH, Tasks Trace).  Other map types already
    follow this convention.
    
    For trie_update_elem() and trie_delete_elem(), annotate the walks as
    rcu_dereference_protected(*p, 1) -- matching trie_free() in the same
    file -- since trie->lock is held across the walk.  rqspinlock has no
    lockdep_map, so the predicate degenerates to '1' rather than
    lockdep_is_held(&trie->lock); the protection is real but not
    machine-verifiable.  trie_get_next_key() also uses bare
    rcu_dereference() but is reachable only from the BPF syscall, which
    holds classic rcu_read_lock() before dispatching, so it is left
    untouched.
    
    Fixes: 694cea395fde ("bpf: Allow RCU-protected lookups to happen from bh context")
    Cc: stable@vger.kernel.org
    Signed-off-by: Vlad Poenaru <vlad.wing@gmail.com>
    Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
    Link: https://lore.kernel.org/r/20260609135558.193287-2-vlad.wing@gmail.com
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

bpf: Keep dynamic inner array lookups nullable [+ + +]
Author: Nuoqi Gui <gnq25@mails.tsinghua.edu.cn>
Date:   Sun Jun 7 21:24:13 2026 +0800

    bpf: Keep dynamic inner array lookups nullable
    
    commit 53040a81ae57cdca8af8ac36fe4e661730cf7c6b upstream.
    
    An ARRAY_OF_MAPS can use an array created with BPF_F_INNER_MAP as its
    inner map template. A concrete inner array with a different max_entries
    value can then replace the template.
    
    After a successful outer map lookup, the verifier represents the
    resulting map pointer using the inner map template. Const-key lookup
    nullness elision consequently uses the template max_entries even though
    the runtime helper uses the concrete inner map max_entries.
    
    Do not elide lookup result nullness for maps marked with BPF_F_INNER_MAP,
    because the template max_entries does not prove that the key is in bounds
    for the concrete runtime map.
    
    Fixes: d2102f2f5d75 ("bpf: verifier: Support eliding map lookup nullness")
    Signed-off-by: Nuoqi Gui <gnq25@mails.tsinghua.edu.cn>
    Acked-by: Eduard Zingerman <eddyz87@gmail.com>
    Acked-by: Jiri Olsa <jolsa@kernel.org>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/bpf/20260607-f01-v2-v2-1-da48453146e8@mails.tsinghua.edu.cn
    Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

bpf: Prefer dirty packs for eBPF allocations [+ + +]
Author: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Date:   Thu Jul 9 15:24:47 2026 -0700

    bpf: Prefer dirty packs for eBPF allocations
    
    commit b72e29e0f7ee329d89f86db8700c8ea99b4a370a upstream.
    
    The pack allocator only flushes predictors when reusing a dirty pack for
    cBPF, eBPF allocations never trigger a flush. Currently, eBPF picks the
    first free pack, which could be a clean pack. As an optimization, leaving
    a clean pack for cBPF can avoid flushes.
    
    Prefer dirty packs for eBPF and keep clean packs free for cBPF. This
    mirrors the existing cBPF preference for clean packs: each program kind
    prefers the pack that avoids an extra flush, and falls back to the other
    kind only when no preferred pack has room. eBPF reuse of a dirty pack is
    harmless since eBPF being privileged does not flush.
    
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Acked-by: Daniel Borkmann <daniel@iogearbox.net>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

bpf: Prefer packs that won't trigger an IBPB flush on allocation [+ + +]
Author: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Date:   Thu Jul 9 15:24:31 2026 -0700

    bpf: Prefer packs that won't trigger an IBPB flush on allocation
    
    commit a9b1f19a6a673ba06820898d0f1ad02883ea1639 upstream.
    
    Currently BPF pack allocator picks the chunks from the first available
    pack. While this is okay, it naturally leads to more frequent flushes
    when there are multiple packs in the system that weren't used since the
    last flush.
    
    As an optimization prefer allocating the new programs from packs that
    are unused since last flush. When all packs are dirty, allocation forces
    a flush and marks all packs clean.
    
    Below are some future optimizations ideas:
    
      1. Currently, the "dirty" tracking is only done at the pack-level.
         Flush frequency can further be reduced with chunk-level tracking.
         This requires a new bitmap per-pack to track the dirty state.
      2. IBPB flush is done on all CPUs, even if only a single CPU ran the
         BPF program. On a system with hundreds of CPUs this could be a
         major bottleneck forcing hundreds of IPIs to deliver the flush.
         The solution is to track the CPUs where a BPF program ran, and
         issue IBPB only on those CPUs.
      3. Avoid IBPB when flush is already done at other sources (e.g.
         context switch).
    
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Acked-by: Daniel Borkmann <daniel@iogearbox.net>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

bpf: Reject BPF_MAP_TYPE_INODE_STORAGE creation if BPF LSM is uninitialized [+ + +]
Author: Matt Bobrowski <mattbobrowski@google.com>
Date:   Sun Jun 28 20:11:03 2026 +0000

    bpf: Reject BPF_MAP_TYPE_INODE_STORAGE creation if BPF LSM is uninitialized
    
    commit a6f0643e4f63cfaa0d5d4a69de4f132eac4b8fe4 upstream.
    
    When CONFIG_BPF_LSM=y is set, BPF inode storage maps
    (BPF_MAP_TYPE_INODE_STORAGE) are compiled into the kernel. However,
    if the BPF LSM is not explicitly enabled at boot time (e.g. omitted
    from the "lsm=" boot parameter), lsm_prepare() is never executed for
    the BPF LSM.
    
    Consequently, the BPF inode security blob offset
    (bpf_lsm_blob_sizes.lbs_inode) is never initialized and remains at
    its default compiled size of 8 bytes instead of being updated to a
    valid offset past the reserved struct rcu_head (typically 16 bytes
    or more).
    
    When a privileged user creates and updates a BPF_MAP_TYPE_INODE_STORAGE
    map, bpf_inode() evaluates inode->i_security + 8. This erroneously
    aliases the struct rcu_head.func callback pointer at the beginning
    of the inode->i_security blob. During subsequent map element cleanup
    or inode destruction, writing NULL to owner_storage clears the queued
    RCU callback pointer. When rcu_do_batch() later executes the queued
    callback, it attempts an instruction fetch at address 0x0, triggering
    an immediate kernel panic.
    
    Fix this by introducing a global bpf_lsm_initialized boolean flag
    marked with __ro_after_init. Set this flag to true inside bpf_lsm_init()
    when the LSM framework successfully registers the BPF LSM. Gate map
    allocation in inode_storage_map_alloc() on this flag, returning
    -EOPNOTSUPP if the BPF LSM is in turn uninitialized.
    
    This fail-fast approach prevents userspace from allocating inode
    storage maps when the supporting BPF LSM infrastructure is absent,
    avoiding zombie map states.
    
    Fixes: 8ea636848aca ("bpf: Implement bpf_local_storage for inodes")
    Reported-by: oxsignal <awo@kakao.com>
    Signed-off-by: Matt Bobrowski <mattbobrowski@google.com>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
    Reviewed-by: Amery Hung <ameryhung@gmail.com>
    Link: https://lore.kernel.org/bpf/20260628201103.3624525-1-mattbobrowski@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

bpf: Reject fragmented frames in devmap [+ + +]
Author: Zhao Zhang <zzhan461@ucr.edu>
Date:   Tue Jun 2 16:43:33 2026 +0800

    bpf: Reject fragmented frames in devmap
    
    commit aa496720618f1a6054f1c870bf10b4f6c99bf656 upstream.
    
    Devmap broadcast redirects clone the packet for all but the last
    destination.
    
    For native XDP, that clone path copies only the linear xdp_frame data,
    while fragmented frames keep skb_shared_info in tailroom outside the
    linear area. Cloning such a frame leaves XDP_FLAGS_HAS_FRAGS set but
    without valid frag metadata, and the later free path can interpret
    uninitialized tail data as skb_shared_info, leading to an out-of-bounds
    access during frame return.
    
    Reject fragmented native XDP frames in dev_map_enqueue_clone().
    
    Add the same restriction to the generic XDP clone path in
    dev_map_redirect_clone(). Generic XDP represents fragmented packets as
    nonlinear skbs, and rejecting them here keeps clone-based broadcast
    support aligned between native and generic XDP.
    
    Fixes: e624d4ed4aa8 ("xdp: Extend xdp_redirect_map with broadcast support")
    Cc: stable@kernel.org
    Reported-by: Yuan Tan <yuantan098@gmail.com>
    Reported-by: Zhengchuan Liang <zcliangcn@gmail.com>
    Reported-by: Xin Liu <bird@lzu.edu.cn>
    Assisted-by: Codex:GPT-5.4
    Signed-off-by: Zhao Zhang <zzhan461@ucr.edu>
    Signed-off-by: Ren Wei <n05ec@lzu.edu.cn>
    Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
    Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com>
    Link: https://lore.kernel.org/r/21c2d153dd25603d359069a02bf06779b51f6423.1780385378.git.zzhan461@ucr.edu
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

bpf: Restore sysctl new-value from 1 to 0 [+ + +]
Author: Dawei Feng <dawei.feng@seu.edu.cn>
Date:   Wed Jun 3 18:53:17 2026 +0800

    bpf: Restore sysctl new-value from 1 to 0
    
    commit 2566c3b24219c5b30e35205cba029ff34ff7c78b upstream.
    
    Commit 4e63acdff864 ("bpf: Introduce bpf_sysctl_{get,set}_new_value
    helpers") changed the success return value to 0, but failed to update the
    corresponding check in __cgroup_bpf_run_filter_sysctl(). Since
    bpf_prog_run_array_cg() now returns 0 on success, the legacy ret == 1
    condition is never satisfied. As a result, the modified value is ignored,
    and bpf_sysctl_set_new_value() fails to replace the write buffer.
    
    Fix this by checking for a return value of 0 instead, so cgroup/sysctl
    programs can correctly replace the pending sysctl buffer.
    
    This bug was discovered during a manual code review. Tested via a
    cgroup/sysctl BPF reproducer overriding writes to a target sysctl.
    Pre-fix, bpf_sysctl_set_new_value("foo") was silently ignored: the write
    returned 8192 and the value remained "600". Post-fix, the BPF replacement
    buffer properly propagates: the write returns 3 and the value updates to
    "foo".
    
    Fixes: f10d05966196 ("bpf: Make BPF_PROG_RUN_ARRAY return -err instead of allow boolean")
    Cc: stable@vger.kernel.org
    
    Acked-by: Yonghong Song <yonghong.song@linux.dev>
    Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
    Signed-off-by: Dawei Feng <dawei.feng@seu.edu.cn>
    Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
    Acked-by: Xu Kuohai <xukuohai@huawei.com>
    Link: https://lore.kernel.org/r/20260603105317.944304-4-dawei.feng@seu.edu.cn
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

bpf: Restrict JIT predictor flush to cBPF [+ + +]
Author: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Date:   Thu Jul 9 15:23:41 2026 -0700

    bpf: Restrict JIT predictor flush to cBPF
    
    commit 0bb99f2cfaae6822d734d69722de30af823efdf3 upstream.
    
    Currently predictor flush on memory reuse is done for all BPF JIT
    allocations, but only cBPF programs can be loaded by an unprivileged user.
    eBPF is privileged by default, and flushing predictors for all CPUs on
    every eBPF reuse penalizes the common case for no security benefit.
    
    eBPF allocations can be frequent on busy systems, only flush predictors
    for cBPF programs. Trampoline and dispatcher allocations also skip the
    flush as they are eBPF-only.
    
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Acked-by: Daniel Borkmann <daniel@iogearbox.net>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

bpf: Skip redundant IBPB in pack allocator [+ + +]
Author: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Date:   Thu Jul 9 15:23:56 2026 -0700

    bpf: Skip redundant IBPB in pack allocator
    
    commit a23c1c5396a91680703360d1ee28a44657c503c4 upstream.
    
    bpf_prog_pack_alloc() issues IBPB on all CPUs on every cBPF allocation,
    even when reusing chunks from an existing pack where no new memory was
    touched since the last IBPB.
    
    Since IBPB on all CPUs is heavy, Dave Hansen suggested to track allocation
    since last IBPB, and only issue IBPB at reuse for the chunks that have not
    seen an IBPB since they were last freed.
    
    Track per-pack whether an IBPB is needed via arch_flush_needed. Set it when
    allocating a chunk, reset on IBPB flush. On reuse, conditionally issue the
    flush. Since IBPB invalidates all BTB entries, clear the flag on all packs
    after flushing.
    
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Acked-by: Daniel Borkmann <daniel@iogearbox.net>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

bpf: Support for hardening against JIT spraying [+ + +]
Author: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Date:   Thu Jul 9 15:23:10 2026 -0700

    bpf: Support for hardening against JIT spraying
    
    commit 96cce16e26dd02a8678f1e87f88a4b5cdb63b995 upstream.
    
    The BPF JIT allocator packs many small programs into larger executable
    allocations and reuses space within those allocations as programs are
    loaded and freed. When fresh code is written into space that a previous
    program occupied, an indirect jump into the new program can reuse a branch
    prediction left behind by the old one.
    
    Flush the indirect branch predictors before reusing JIT memory so that
    indirect jumps into a newly written program don't reuse predictions from an
    old program that occupied the same space.
    
    Introduce bpf_arch_pred_flush_enabled static key and bpf_arch_pred_flush
    static call for flushing the branch predictors on JIT memory reuse.
    Architectures that need a flush, can update it to a predictor flush
    function. By default, its a NOP and does not emit any CALL.
    
    Allocations larger than a pack are not covered by this flush. That is safe
    because cBPF programs (the unprivileged attack surface) are bounded well
    below a pack size. Issue a warning if this assumption is ever violated
    while the flush is active.
    
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Acked-by: Daniel Borkmann <daniel@iogearbox.net>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

bpf: Validate BTF repeated field counts before expansion [+ + +]
Author: Paul Moses <p@1g4.org>
Date:   Fri Jun 5 23:43:09 2026 +0000

    bpf: Validate BTF repeated field counts before expansion
    
    commit b9452b594fd3aecbfd4aa0a6a1f741330a37dab7 upstream.
    
    btf_parse_struct_metas() walks user-supplied BTF during BPF_BTF_LOAD,
    and btf_repeat_fields() expands repeatable fields from array elements
    into the fixed BTF_FIELDS_MAX scratch array used by btf_parse_fields().
    
    The remaining-capacity check performs the expanded field count calculation
    in u32. A malformed BTF can wrap that calculation, causing the check to
    pass even when the expanded field count exceeds the scratch array
    capacity. The following memcpy() can then write past the end of the
    array.
    
    Use checked addition and multiplication before copying repeated fields
    and reject impossible counts.
    
    Fixes: 797d73ee232d ("bpf: Check the remaining info_cnt before repeating btf fields")
    Cc: stable@vger.kernel.org
    Signed-off-by: Paul Moses <p@1g4.org>
    Acked-by: Eduard Zingerman <eddyz87@gmail.com>
    Link: https://lore.kernel.org/bpf/20260605234301.1109063-1-p@1g4.org
    Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
btrfs: check and set EXTENT_DELALLOC_NEW before clearing EXTENT_DELALLOC [+ + +]
Author: Qu Wenruo <wqu@suse.com>
Date:   Mon Apr 20 18:32:49 2026 +0930

    btrfs: check and set EXTENT_DELALLOC_NEW before clearing EXTENT_DELALLOC
    
    commit 95ee2231896d5f2a31760411429075a99d6045a7 upstream.
    
    [WARNING]
    When running test cases with injected errors or shutdown, e.g.
    generic/388 or generic/475, there is a chance that the following kernel
    warning is triggered:
    
      BTRFS info (device dm-2): first mount of filesystem d8a19a28-3232-4809-b0df-38df83e71bff
      BTRFS info (device dm-2): using crc32c checksum algorithm
      BTRFS info (device dm-2): checking UUID tree
      BTRFS info (device dm-2): turning on async discard
      BTRFS info (device dm-2): enabling free space tree
      BTRFS critical (device dm-2 state E): emergency shutdown
      ------------[ cut here ]------------
      WARNING: extent_io.c:1742 at extent_writepage_io+0x437/0x520 [btrfs], CPU#2: kworker/u43:2/651591
      CPU: 2 UID: 0 PID: 651591 Comm: kworker/u43:2 Tainted: G        W  OE       7.0.0-rc6-custom+ #365 PREEMPT(full)  5804053f02137e627472d94b5128cc9fcb110e88
      RIP: 0010:extent_writepage_io+0x437/0x520 [btrfs]
      Call Trace:
       <TASK>
       extent_write_cache_pages+0x2a5/0x820 [btrfs 70299925d0856939e93b17d480651713b3cbba58]
       btrfs_writepages+0x74/0x130 [btrfs 70299925d0856939e93b17d480651713b3cbba58]
       do_writepages+0xd0/0x160
       __writeback_single_inode+0x42/0x340
       writeback_sb_inodes+0x22d/0x580
       wb_writeback+0xc6/0x360
       wb_workfn+0xbd/0x470
       process_one_work+0x198/0x3b0
       worker_thread+0x1c8/0x330
       kthread+0xee/0x120
       ret_from_fork+0x2a6/0x330
       ret_from_fork_asm+0x11/0x20
       </TASK>
      ---[ end trace 0000000000000000 ]---
      BTRFS error (device dm-2 state E): root 5 ino 259 folio 1323008 is marked dirty without notifying the fs
      BTRFS error (device dm-2 state E): failed to submit blocks, root=5 inode=259 folio=1323008 submit_bitmap=0: -117
      BTRFS info (device dm-2 state E): last unmount of filesystem d8a19a28-3232-4809-b0df-38df83e71bff
    
    [CAUSE]
    Inside btrfs we have the following pattern in several locations, for
    example inside btrfs_dirty_folio():
    
            btrfs_clear_extent_bit(&inode->io_tree, start_pos, end_of_last_block,
                                   EXTENT_DELALLOC | EXTENT_DO_ACCOUNTING | EXTENT_DEFRAG,
                                   cached);
    
            ret = btrfs_set_extent_delalloc(inode, start_pos, end_of_last_block,
                                            extra_bits, cached);
            if (ret)
                    return ret;
    
    However btrfs_set_extent_delalloc() can return IO errors other than -ENOMEM
    through the following callchain:
    
     btrfs_set_extent_delalloc()
     \- btrfs_find_new_delalloc_bytes()
        \- btrfs_get_extent()
           \- btrfs_lookup_file_extent()
              \- btrfs_search_slot()
    
    When such IO error happened, the previous btrfs_clear_extent_bit() has
    cleared the EXTENT_DELALLOC for the range, and we're expecting
    btrfs_set_extent_delalloc() to re-set EXTENT_DELALLOC.
    
    But since btrfs_set_extent_delalloc() failed before
    btrfs_set_extent_bit(), EXTENT_DELALLOC flag is no longer present.
    
    And if the folio range is dirty before entering
    btrfs_set_extent_delalloc(), we got a dirty folio but no EXTENT_DELALLOC
    flag now.
    
    Then we hit the folio writeback:
    
      extent_writepage()
      |- writepage_delalloc()
      |  No ordered extent is created, as there is no EXTENT_DELALLOC set
      |  for the folio range.
      |  This also means the folio has no ordered flag set.
      |
      |- extent_writepage_io()
         \- if (unlikely(!folio_test_ordered(folio))
            Now we hit the warning.
    
    [FIX]
    Introduce a new helper, btrfs_reset_extent_delalloc() to replace the
    currently open-coded btrfs_clear_extent_bit() +
    btrfs_set_extent_delalloc() combination.
    
    Instead of calling btrfs_clear_extent_bit() first, update
    EXTENT_DELALLOC_NEW first, as that part can fail due to metadata IO,
    meanwhile btrfs_clear_extent_bit() and btrfs_set_extent_bit() won't
    return any error but retry memory allocation until succeeded.
    
    This allows us to fail early without clearing EXTENT_DELALLOC bit, so
    even if that new btrfs_reset_extent_delalloc() failed before touching
    EXTENT_DELALLOC, the existing dirty range will still have their old
    EXTENT_DELALLOC flag present, thus avoid the warning.
    
    CC: stable@vger.kernel.org # 6.1+
    Reviewed-by: Filipe Manana <fdmanana@suse.com>
    Signed-off-by: Qu Wenruo <wqu@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

btrfs: do not trim a device which is not writeable [+ + +]
Author: Qu Wenruo <wqu@suse.com>
Date:   Tue Jun 2 13:34:46 2026 +0930

    btrfs: do not trim a device which is not writeable
    
    commit 1b1937eb08f51319bf71575484cde2b8c517aedc upstream.
    
    [BUG]
    There is a bug report that btrfs/242 can randomly fail with the
    following NULL pointer dereference:
    
      run fstests btrfs/242 at 2026-06-01 10:25:08
      BTRFS: device fsid d4d7f234-487c-4787-88e4-47a8b68c9874 devid 1 transid 9 /dev/sdc (8:32) scanned by mount (122609)
      BTRFS info (device sdc): first mount of filesystem d4d7f234-487c-4787-88e4-47a8b68c9874
      BTRFS info (device sdc): using crc32c checksum algorithm
      BTRFS warning (device sdc): devid 2 uuid fbe72d72-3272-482d-80fb-ab88ed398192 is missing
      BTRFS warning (device sdc): devid 2 uuid fbe72d72-3272-482d-80fb-ab88ed398192 is missing
      BTRFS info (device sdc): allowing degraded mounts
      BTRFS info (device sdc): turning on async discard
      BTRFS info (device sdc): enabling free space tree
      Unable to handle kernel NULL pointer dereference at virtual address 0000000000000018
      user pgtable: 4k pages, 48-bit VAs, pgdp=000000013fd6b000
      CPU: 4 UID: 0 PID: 122625 Comm: fstrim Not tainted 7.0.10-2-default #1 PREEMPT(full) openSUSE Tumbleweed e9a5f6b24978fba3bf015a992f865837fdfff3dd
      Hardware name: QEMU KVM Virtual Machine, BIOS edk2-20250812-19.fc42 08/12/2025
      pstate: 01400005 (nzcv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--)
      pc : btrfs_trim_fs+0x34c/0xa00 [btrfs]
      lr : btrfs_trim_fs+0x1f0/0xa00 [btrfs]
      Call trace:
       btrfs_trim_fs+0x34c/0xa00 [btrfs f02c1d570ceea621c69d302ba75dd61868083840] (P)
       btrfs_ioctl_fitrim+0xe8/0x178 [btrfs f02c1d570ceea621c69d302ba75dd61868083840]
       btrfs_ioctl+0xdd4/0x2bd8 [btrfs f02c1d570ceea621c69d302ba75dd61868083840]
       __arm64_sys_ioctl+0xac/0x108
       invoke_syscall.constprop.0+0x5c/0xd0
       el0_svc_common.constprop.0+0x40/0xf0
       do_el0_svc+0x24/0x40
       el0_svc+0x40/0x1d0
       el0t_64_sync_handler+0xa0/0xe8
       el0t_64_sync+0x1b0/0x1b8
      Code: 17ffff83 f94017e0 f9002be0 f9402ea0 (f9400c00)
      ---[ end trace 0000000000000000  ]---
    
    Also the reporter is very kind to test the following ASSERT() added to
    btrfs_trim_free_extents_throttle():
    
            ASSERT(device->bdev,
                   "devid=%llu path=%s dev_state=0x%lx\n",
                   device->devid, btrfs_dev_name(device), device->dev_state);
    
    And it shows the following output:
    
      assertion failed: device->bdev, in extent-tree.c:6630 (devid=2 path=/dev/sdd dev_state=0x82)
    
    Which means the device->bdev is NULL, and the dev_state is
    BTRFS_DEV_STATE_IN_FS_METADATA | BTRFS_DEV_STATE_ITEM_FOUND, without
    BTRFS_DEV_STATE_WRITEABLE flag set.
    
    [CAUSE]
    The pc points to the following call chain:
    
      btrfs_trim_fs()
      |- btrfs_trim_free_extents()
         |- btrfs_trim_free_extents_throttle()
            |- bdev_max_discard_sectors(device->bdev)
    
    So the NULL pointer dereference is caused by device->bdev being NULL.
    
    This looks impossible by a quick glance, as just before calling
    btrfs_trim_free_extents_throttle(), we have skipped any device that has
    BTRFS_DEV_STATE_MISSING flag set.
    
    However in this particular case, there is a window where the missing
    device is later re-scanned, causing btrfs to remove the
    BTRFS_DEV_STATE_MISSING flag:
    
      btrfs_control_ioctl()
      |- btrfs_scan_one_device()
         |- device_list_add()
            |- rcu_assign_pointer(device->name, name);
            |  This updates the missing device's path to the new good path.
            |
            |- clear_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state)
               This removes the BTRFS_DEV_STATE_MISSING flag.
    
    This allows the missing device to re-appear and clear the
    BTRFS_DEV_STATE_MISSING flag.  However the device still does not have
    the BTRFS_DEV_STATE_WRITEABLE flag set, nor is its bdev pointer updated.
    
    The bdev pointer remains NULL, triggering the crash later.
    
    [FIX]
    This is a big de-synchronization between BTRFS_DEV_STATE_MISSING and
    device->bdev pointer, and shows a gap in btrfs's re-appearing-device
    handling.
    
    The proper handling of re-appearing device will need quite some extra
    work, which is out of the context of this small fix.
    
    Thankfully the regular bbio submission path has already handled it well
    by checking if the device->bdev is NULL before submitting.
    
    So here we just fix the crash by checking if the device is writeable and
    has a bdev pointer before calling bdev_max_discard_sectors().
    
    Reported-by: Su Yue <glass.su@suse.com>
    Link: https://lore.kernel.org/linux-btrfs/wlwir19t.fsf@damenly.org/
    Fixes: 499f377f49f0 ("btrfs: iterate over unused chunk space in FITRIM")
    CC: stable@vger.kernel.org # 5.10+
    Reviewed-by: Filipe Manana <fdmanana@suse.com>
    Signed-off-by: Qu Wenruo <wqu@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

btrfs: fix false IO failure after falling back to buffered write [+ + +]
Author: Qu Wenruo <wqu@suse.com>
Date:   Thu Jun 4 09:59:46 2026 +0930

    btrfs: fix false IO failure after falling back to buffered write
    
    commit 66ff4d366e7eb4d31813d2acabf3af512ce03aa5 upstream.
    
    [BUG]
    The test case generic/362 will fail with "nodatasum" mount option (*):
    
     MOUNT_OPTIONS -- -o nodatasum /dev/mapper/test-scratch1 /mnt/scratch
    
    # generic/362  0s ... - output mismatch (see /home/adam/xfstests/results//generic/362.out.bad)
    #    --- tests/generic/362.out  2024-08-24 15:31:37.200000000 +0930
    #    +++ /home/adam/xfstests/results//generic/362.out.bad       2026-05-27 10:21:17.574771567 +0930
    #    @@ -1,2 +1,3 @@
    #     QA output created by 362
    #    +First write failed: Input/output error
    #     Silence is golden
    #    ...
    
    *: If the test case has been executed before with default data checksum,
    the failure will not reproduce. Need the following fix to make it
    reliably reproducible:
    https://lore.kernel.org/linux-btrfs/20260528111659.87113-1-wqu@suse.com/
    
    [CAUSE]
    Inside __iomap_dio_rw(), the -EFAULT/-ENOTBLK error is not directly returned.
    Thus we never got an error pointer from __iomap_dio_rw().
    
    The call chain looks like this:
    
     btrfs_direct_write()
     |- btrfs_dio_write()
     |-  __iomap_dio_rw()
     |  |- iomap_iter()
     |  |  |- btrfs_dio_iomap_begin()
     |  |     Now an ordered extent is allocated for the 4K write.
     |  |
     |  |- iomi.status = iomap_dio_iter()
     |  |  Where iomap_dio_iter() returned -EFAULT.
     |  |
     |  |- ret = iomap_iter()
     |  |  |- btrfs_dio_iomap_end()
     |  |  |  |- btrfs_finish_ordered_extent(uptodate = false)
     |  |  |  |  |- can_finish_ordered_extent()
     |  |  |  |     |- btrfs_mark_ordered_extent_error()
     |  |  |  |        |- mapping_set_error()
     |  |  |  |           Now the address space is marked error.
     |  |  |  | return -ENOTBLK
     |  |  |- return -ENOTBLK
     |  |- if (ret == -ENOTBLK) { ret = 0; }
     |     Now the return value is reset to 0.
     |     Thus no error pointer will be returned.
     |
     |- ret = iomap_dio_complete()
     |  Since no byte is submitted, @ret is 0.
     |
     |- Fallback to buffered IO
     |  And the buffered write finished without error
     |
     |- filemap_fdatawait_range()
        |- filemap_check_errors()
           The previous error is recorded, thus an error is returned
    
    However the buffered write is properly submitted and finished, the error
    is from the btrfs_finish_ordered_extent() call with @uptodate = false.
    
    [FIX]
    When a short dio write happened, any range that is submitted will have
    btrfs_extract_ordered_extent() to be called, thus the submitted range
    will always have an OE just covering the submitted range.
    
    The remaining OE range is never submitted, thus they should be treated
    as truncated, not an error. So that we can properly reclaim and not
    insert an unnecessary file extent item, without marking the mapping as
    error.
    
    Extract a helper, btrfs_mark_ordered_extent_truncated(), and utilize
    that helper to mark the direct IO ordered extent as truncated, so it
    won't cause failure for the later buffered fallback.
    
    [REASON FOR NO FIXES TAG]
    The bug itself is pretty old, at commit f85781fb505e ("btrfs: switch to
    iomap for direct IO") we're already passing @uptodate=false finishing
    the OE.
    But at that time OE with IOERR won't call mapping_set_error(), so it's
    not exposed.
    Later commit d61bec08b904 ("btrfs: mark ordered extent and inode with
    error if we fail to finish") finally exposed the bug, but that commit
    is doing a correct job, not the root cause.
    
    Anyway the bug is very old, dating back to 5.1x days, thus only CC to
    stable.
    
    CC: stable@vger.kernel.org # 5.15+
    Reviewed-by: Boris Burkov <boris@bur.io>
    Signed-off-by: Qu Wenruo <wqu@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

btrfs: fix incorrect buffered IO fallback for append direct writes [+ + +]
Author: Qu Wenruo <wqu@suse.com>
Date:   Thu Jun 4 09:59:47 2026 +0930

    btrfs: fix incorrect buffered IO fallback for append direct writes
    
    commit ff66fe6662330226b3f486014c375538d91c44aa upstream.
    
    [BUG]
    With the previous bug of short direct writes fixed, test case
    generic/362 (*) still fails with the following error with nodatasum
    mount option:
    
    # generic/362  0s ... - output mismatch (see /home/adam/xfstests/results//generic/362.out.bad)
    # - output mismatch (see /home/adam/xfstests/results//generic/362.out.bad)
    #    --- tests/generic/362.out  2024-08-24 15:31:37.200000000 +0930
    #    +++ /home/adam/xfstests/results//generic/362.out.bad       2026-05-27 10:13:09.072485767 +0930
    #    @@ -1,2 +1,3 @@
    #     QA output created by 362
    #    +Wrong file size after first write, got 8192 expected 4096
    #     Silence is golden
    #    ...
    
    *: If the test case has been executed before with default data checksum,
    the failure will not reproduce. Need the following fix to make it
    reliably reproducible:
    https://lore.kernel.org/linux-btrfs/20260528111659.87113-1-wqu@suse.com/
    
    [CAUSE]
    Inside btrfs_dio_iomap_begin() for a direct write, we increase the isize
    if it's beyond the current isize.
    
    But if the direct io finished short, we do not revert the isize to the
    previous value nor to the short write end.
    
    Then if we need to fall back to buffered writes, and the write has
    IOCB_APPEND flag, then the buffered write will be positioned at the
    incorrect isize.
    
    The call chain looks like this:
    
     btrfs_direct_write(pos=0, length=4K)
     |- __iomap_dio_rw()
     |  |- iomap_iter()
     |  |  |- btrfs_dio_iomap_begin()
     |  |     |- btrfs_get_blocks_direct_write()
     |  |        |- i_size_write()
     |  |           Which updates the isize to the write end (4K).
     |  |
     |  |- iomap_dio_iter()
     |  |  Failed with -EFAULT on the first page.
     |  |
     |  |- iomap_iter()
     |  |  |- btrfs_dio_iomap_end()
     |  |     Detects a short write, return -ENOTBLK
     |  |- if (ret == -ENOTBLK) { ret = 0;}
     |     Which resets the return value.
     |
     |- ret = iomap_dio_complet()
     |  Which returns 0.
     |
     |- btrfs_buffered_write(iocb, from);
        |- generic_write_checks()
           |- iocb->ki_pos = i_size_read()
              Which is still the new size (4K), other than the original
              isize 0.
    
    [FIX]
    Introduce the following btrfs_dio_data members:
    
    - old_isize
    
    - updated_isize
      If the direct write has enlarged the isize.
    
    Then if we got a short write, and btrfs_dio_data::updated_isize is set,
    revert to the correct isize based on old_isize and current file
    position.
    
    And here we call i_size_write() without holding an extent lock, which is
    a very special case that we're safe to do:
    
     - Only a single writer can be enlarging isize
       Enlarging isize will take the exclusive inode lock.
    
     - Buffered readers need to wait for the OE we're holding
       Buffered readers will lock extent and wait for OE of the folio range.
       Sometimes we can skip the OE wait, but since all page cache is
       invalidated, the OE wait can not be skipped.
    
    But I do not think this is the most elegant solution, nor covers all
    cases. E.g. if the bio is submitted but IO failed, we are unable to do
    the revert.
    
    I believe the more elegant one would be extend the EXTENT_DIO_LOCKED
    lifespan for direct writes, so that we can update the isize when a
    write beyond EOF finished successfully.
    
    However that change is too huge for a small bug fix.
    So only implement the minimal partial fix for now.
    
    [REASON FOR NO FIXES TAG]
    The bug is again very old, before commit f85781fb505e ("btrfs: switch to
    iomap for direct IO") we are already increasing isize without a
    proper rollback for short writes.
    
    Thus only a CC to stable.
    
    CC: stable@vger.kernel.org # 5.15+
    Reviewed-by: Boris Burkov <boris@bur.io>
    Signed-off-by: Qu Wenruo <wqu@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
clocksource/drivers/timer-tegra186: Fix support for multiple watchdog instances [+ + +]
Author: Kartik Rajput <kkartik@nvidia.com>
Date:   Thu May 7 21:15:54 2026 +0530

    clocksource/drivers/timer-tegra186: Fix support for multiple watchdog instances
    
    commit ca57bf46e7a94f8c53d05c376df9fcfdcb482100 upstream.
    
    Tegra SoCs support multiple watchdogs; currently only one (WDT0) is
    used. When multiple watchdogs are registered, tegra186_wdt_enable()
    overwrites the TKEIE(x) register, discarding any existing watchdog
    interrupt enable bits. As a result, enabling one watchdog inadvertently
    disables interrupts for the others.
    
    Fix this by preserving the existing TKEIE(x) value and updating it
    using a read-modify-write sequence.
    
    Fixes: 42cee19a9f83 ("clocksource: Add Tegra186 timers support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Kartik Rajput <kkartik@nvidia.com>
    Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org>
    Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
    Link: https://patch.msgid.link/20260507154557.2082697-2-kkartik@nvidia.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
coresight: etb10: restore atomic_t for shared reading state [+ + +]
Author: Runyu Xiao <runyu.xiao@seu.edu.cn>
Date:   Fri May 29 00:52:01 2026 +0800

    coresight: etb10: restore atomic_t for shared reading state
    
    commit fa09f08ede3db3050ae16ae1ed92c902d0cada23 upstream.
    
    The etb10 miscdevice uses drvdata->reading as a shared exclusivity gate
    for userspace buffer access. etb_open() claims that gate with
    local_cmpxchg(), and etb_release() clears it with local_set().
    
    That gate is shared per-device state rather than CPU-local state. A
    running system can reach it whenever /dev/<etb> is opened, closed, and
    reopened by different tasks while the device remains registered, so the
    same drvdata->reading variable may be claimed on one CPU and later
    cleared on another.
    
    This code used to use atomic_t for the same gate, but commit
    27b10da8fff2 ("coresight: etb10: moving to local atomic operations")
    changed it to local_t even though the access pattern remained cross-task
    and cross-CPU. Restore atomic_t together with atomic_cmpxchg() and
    atomic_set() so the exclusivity gate again uses a primitive intended
    for shared state.
    
    The issue was found on Linux v6.18.21 by our static analysis tool while
    scanning surviving local_t-on-shared-state sites, and then manually
    reviewed against the live etb10 file-op path.
    
    It was runtime-validated with a reproducible QEMU no-device KCSAN PoC
    that kept the same report-local contract:
    
      1. use one shared struct etb_drvdata carrier and its
         drvdata->reading gate;
      2. call etb_open() and etb_release() sequentially on that gate to
         confirm the original claim/clear path;
      3. bind the open side to CPU0 and the release side to CPU1 for the
         same gate to show cross-CPU ownership;
      4. run bound workers that repeatedly race etb_open() and
         etb_release() on the same gate until KCSAN reports a target hit.
    
    The harness recorded:
    
      L1 passed open=1 release=1
      reading_after_open=1 reading_after_release=0
      L2 passed open_cpu=0 release_cpu=1
      cross_cpu_release=1 reading_after=0 open_ret=0
    
    Representative KCSAN excerpt from the no-device validation run:
    
      BUG: KCSAN: data-race in etb_open.constprop.0.isra.0 [vuln_msv]
    
      write to 0xffffffffc0003810 of 4 bytes by task 216 on cpu 1:
       etb_open.constprop.0.isra.0+0x38/0x80 [vuln_msv]
       l3_worker_thread_fn+0x4f/0xf0 [vuln_msv]
       kthread+0x17e/0x1c0
       ret_from_fork+0x22/0x30
    
      read to 0xffffffffc0003810 of 4 bytes by task 215 on cpu 0:
       etb_open.constprop.0.isra.0+0x18/0x80 [vuln_msv]
       l3_worker_thread_fn+0x4f/0xf0 [vuln_msv]
       kthread+0x17e/0x1c0
       ret_from_fork+0x22/0x30
    
      value changed: 0x00000000 -> 0x00000001
    
      Reported by Kernel Concurrency Sanitizer on:
      CPU: 0 PID: 215 Comm: etb10_l3_a Tainted: G           O       6.1.66 #2
    
    This no-device harness is not a real ETB10 hardware end-to-end run, but
    it preserves the same shared drvdata->reading gate and the same
    etb_open()/etb_release() claim/clear contract. No real ETB10 hardware
    was available for runtime testing.
    
    Build-tested with:
      make olddefconfig
      make -j"$(nproc)" drivers/hwtracing/coresight/coresight-etb10.o
    
    Fixes: 27b10da8fff2 ("coresight: etb10: moving to local atomic operations")
    Cc: stable@vger.kernel.org
    Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
    Reviewed-by: James Clark <james.clark@linaro.org>
    Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
    Link: https://lore.kernel.org/r/20260528165201.319452-1-runyu.xiao@seu.edu.cn
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

coresight: ultrasoc-smb: Fix OOB write in smb_sync_perf_buffer() [+ + +]
Author: Junrui Luo <moonafterrain@outlook.com>
Date:   Thu Jun 4 15:34:25 2026 +0800

    coresight: ultrasoc-smb: Fix OOB write in smb_sync_perf_buffer()
    
    commit 98495b5a4d77dd22e106f462b76e1093a55b29a7 upstream.
    
    When the SMB sink is used as a perf AUX sink, smb_update_buffer() calls
    smb_sync_perf_buffer() to copy hardware trace data into the perf AUX ring
    buffer pages. It derives pg_idx = head >> PAGE_SHIFT from @head, which is
    handle->head, and indexes dst_pages[pg_idx]. The pg_idx %= nr_pages
    normalization is only applied after the first loop iteration.
    
    This leaves the initial page index underived from the buffer size, which
    can result in an out-of-bounds write past dst_pages[] when head exceeds
    the AUX buffer size.
    
    Normalize head modulo the AUX buffer size before deriving the page index
    and offset, mirroring tmc_etr_sync_perf_buffer().
    
    Fixes: 06f5c2926aaa ("drivers/coresight: Add UltraSoc System Memory Buffer driver")
    Reported-by: Yuhao Jiang <danisjiang@gmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Junrui Luo <moonafterrain@outlook.com>
    Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
    Link: https://lore.kernel.org/r/SYBPR01MB788156B3380A36835DB22290AF102@SYBPR01MB7881.ausprd01.prod.outlook.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
cpufreq: Fix hotplug-suspend race during reboot [+ + +]
Author: Tianxiang Chen <nanmu@xiaomi.com>
Date:   Wed Apr 8 22:19:14 2026 +0800

    cpufreq: Fix hotplug-suspend race during reboot
    
    commit a9029dd55696c651ee46912afa2a166fa456bb3e upstream.
    
    During system reboot, cpufreq_suspend() is called via the
    kernel_restart() -> device_shutdown() path. Unlike the normal system
    suspend path, the reboot path does not call freeze_processes(), so
    userspace processes and kernel threads remain active.
    
    This allows CPU hotplug operations to run concurrently with
    cpufreq_suspend(). The original code has no synchronization with CPU
    hotplug, leading to a race condition where governor_data can be freed
    by the hotplug path while cpufreq_suspend() is still accessing it,
    resulting in a null pointer dereference:
    
      Unable to handle kernel NULL pointer dereference
      Call Trace:
       do_kernel_fault+0x28/0x3c
       cpufreq_suspend+0xdc/0x160
       device_shutdown+0x18/0x200
       kernel_restart+0x40/0x80
       arm64_sys_reboot+0x1b0/0x200
    
    Fix this by adding cpus_read_lock()/cpus_read_unlock() to
    cpufreq_suspend() to block CPU hotplug operations while suspend is in
    progress.
    
    Fixes: 65650b35133f ("cpufreq: Avoid cpufreq_suspend() deadlock on system shutdown")
    Signed-off-by: Tianxiang Chen <nanmu@xiaomi.com>
    Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
    Cc: All applicable <stable@vger.kernel.org>
    [ rjw: Changelog edits ]
    Link: https://patch.msgid.link/20260408141914.35281-1-nanmu@xiaomi.com
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

cpufreq: intel_pstate: Sync policy->cur during CPU offline [+ + +]
Author: Fushuai Wang <wangfushuai@baidu.com>
Date:   Wed May 20 11:21:19 2026 +0800

    cpufreq: intel_pstate: Sync policy->cur during CPU offline
    
    commit bcbdaa1086c25a8a5d48e04e1b82fdfb0682b681 upstream.
    
    When a CPU goes offline with HWP disabled, intel_pstate_set_min_pstate()
    sets the MSR_IA32_PERF_CTL to minimum frequency to prevent SMT siblings
    from being restricted. However, the policy->cur value was not updated,
    leaving it at the previous value.
    
    When the CPU comes back online, governor->limits() checks if target_freq
    equals policy->cur and skips the frequency adjustment if they match. Since
    policy->cur still holds the previous value, the governor does not call
    cpufreq_driver->target to update MSR_IA32_PERF_CTL.
    
    Fix this by synchronizing policy->cur with the hardware state when setting
    minimum pstate during CPU offline.
    
    Fixes: bb18008f8086 ("intel_pstate: Set core to min P state during core offline")
    Cc: stable@vger.kernel.org # 3.15+
    Suggested-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    Signed-off-by: Fushuai Wang <wangfushuai@baidu.com>
    [ rjw: Subject refinement ]
    Link: https://patch.msgid.link/20260520032119.30615-1-fushuai.wang@linux.dev
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

cpufreq: pcc: fix use-after-free and double free in _OSC evaluation [+ + +]
Author: Yuho Choi <dbgh9129@gmail.com>
Date:   Thu Apr 16 10:46:21 2026 -0400

    cpufreq: pcc: fix use-after-free and double free in _OSC evaluation
    
    commit 266d3dd8b757b48a576e90f018b51f7b7563cc32 upstream.
    
    pcc_cpufreq_do_osc() calls acpi_evaluate_object() twice for the
    two-phase _OSC negotiation. Between the two calls it freed
    output.pointer but left output.length unchanged. Since
    acpi_evaluate_object() treats a non-zero length with a non-NULL
    pointer as an existing buffer to write into, the second call wrote
    into freed memory (use-after-free). The subsequent kfree(output.pointer)
    at out_free then freed the same pointer a second time (double free).
    
    Reset output.pointer to NULL and output.length to ACPI_ALLOCATE_BUFFER
    after freeing the first result, so ACPICA allocates a fresh buffer for
    each phase independently.
    
    Fixes: 0f1d683fb35d ("[CPUFREQ] Processor Clocking Control interface driver")
    Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
    Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
    Cc: All applicable <stable@vger.kernel.org>
    Link: https://patch.msgid.link/20260416144621.93964-1-dbgh9129@gmail.com
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

cpufreq: qcom-cpufreq-hw: Fix possible double free [+ + +]
Author: Guangshuo Li <lgs201920130244@gmail.com>
Date:   Sat May 2 03:00:05 2026 +0800

    cpufreq: qcom-cpufreq-hw: Fix possible double free
    
    commit bcb8889c4981fdde42d4fd2c29a77d510fe21da2 upstream.
    
    qcom_cpufreq.data is allocated with devm_kzalloc() in probe() as an
    array of per-domain data. qcom_cpufreq_hw_cpu_init() stores a pointer to
    one element of this array in policy->driver_data.
    
    qcom_cpufreq_hw_cpu_exit() currently calls kfree() on policy->driver_data.
    This is not valid because the memory is devm-managed. For the first
    domain, this can free the devm-managed allocation while the devres entry
    is still active, leading to a possible double free when the platform
    device is later detached. For other domains, the pointer may refer to an
    element inside the array rather than the allocation base.
    
    Remove the kfree(data) call and let devres release qcom_cpufreq.data.
    
    This issue was found by a static analysis tool I am developing.
    
    Fixes: 054a3ef683a1 ("cpufreq: qcom-hw: Allocate qcom_cpufreq_data during probe")
    Cc: stable@vger.kernel.org
    Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
    Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
    Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
crypto: af_alg - Remove zero-copy support from skcipher and aead [+ + +]
Author: Eric Biggers <ebiggers@kernel.org>
Date:   Mon May 4 15:53:28 2026 -0700

    crypto: af_alg - Remove zero-copy support from skcipher and aead
    
    commit ffdd2bc378953b525aca61902534e753f1f8e734 upstream.
    
    The zero-copy support is one of the riskiest aspects of AF_ALG.  It
    allows userspace to request cryptographic operations directly on
    pagecache pages of files like the 'su' binary.  It also allows userspace
    to concurrently modify the memory which is being operated on, a recipe
    for TOCTOU vulnerabilities.
    
    While zero-copy support is more valuable in other areas of the kernel
    like the frequently used networking and file I/O code, it has far less
    value in AF_ALG, which is a niche UAPI.  AF_ALG primarily just exists
    for backwards compatibility with a small set of userspace programs such
    as 'iwd' that haven't yet been fixed to use userspace crypto code.
    
    Originally AF_ALG was intended to be used to access hardware crypto
    accelerators.  However, it isn't an efficient interface for that anyway,
    and it turned out to be rarely used in this way in practice.
    
    Thus, the risks of the zero-copy support in AF_ALG vastly outweigh its
    benefits.  Let's just remove it.
    
    This commit removes it from the "skcipher" and "aead" algorithm types.
    "hash" will be handled separately.
    
    This is a soft break, not a hard break.  Even after this commit, it
    still works to use splice() or sendfile() to transfer data to an AF_ALG
    request socket from a pipe or any file, respectively.  What changes is
    just that the kernel now makes an internal, stable copy of the data
    before doing the crypto operation.  So performance is slightly reduced,
    but the UAPI isn't broken.  And, very importantly, it's much safer.
    
    Tested with libkcapi/test.sh.  All its test cases still pass.  I also
    verified that this would have prevented the copy.fail exploit as well.
    I also used a custom test program to verify that sendfile() still works.
    
    Fixes: 8ff590903d5f ("crypto: algif_skcipher - User-space interface for skcipher operations")
    Fixes: 400c40cf78da ("crypto: algif - add AEAD support")
    Reported-by: Taeyang Lee <0wn@theori.io>
    Link: https://copy.fail/
    Reported-by: Feng Ning <feng@innora.ai>
    Closes: https://lore.kernel.org/r/afYcc-tZFwvZZo76@ans-MacBook-Pro.local
    Reviewed-by: Demi Marie Obenour <demiobenour@gmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Eric Biggers <ebiggers@kernel.org>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: amlogic - avoid double cleanup in meson_crypto_probe() [+ + +]
Author: Dawei Feng <dawei.feng@seu.edu.cn>
Date:   Fri May 8 12:24:16 2026 +0800

    crypto: amlogic - avoid double cleanup in meson_crypto_probe()
    
    commit 6d827ade51a24e18d81afb9f32756d339520a14c upstream.
    
    When meson_allocate_chanlist() fails after a partial allocation, it already
    unwinds the allocated chanlist state through its local error path.
    meson_crypto_probe() then jump to error_flow and calls
    meson_free_chanlist() again, causing the same per-flow resources to be torn
    down twice. In the reproduced failure path, the second teardown
    re-entered crypto_engine_exit() on an already destroyed worker and KASAN
    reported a slab-use-after-free in kthread_destroy_worker().
    
    Prevent double-free by handling partial allocation failures locally within
    meson_allocate_chanlist() and skipping the outer cleanup path.
    
    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.
    
    The bug was reproduced in a QEMU x86_64 guest booted with KASAN on v7.1,
    using the reproducer under tools/testing/meson_crypto_probe. The reproducer
    forces the second dma_alloc_attrs() call in the gxl-crypto probe path to
    return NULL, making meson_allocate_chanlist() fail after partial
    initialization. On the unpatched kernel this reliably triggered a
    slab-use-after-free. With this fix applied, the same reproducer no longer
    emits any KASAN report and the probe fails cleanly with -ENOMEM.
    
        ==================================================================
        BUG: KASAN: slab-use-after-free in kthread_destroy_worker+0xb2/0xd0
        Read of size 8 at addr ff1100010c057a68 by task insmod/265
    
        CPU: 1 UID: 0 PID: 265 Comm: insmod Tainted: G           O        7.1.0-rc2-00376-g810af9adc907-dirty #10 PREEMPT(lazy)
        Tainted: [O]=OOT_MODULE
        Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.15.0-1 04/01/2014
        Call Trace:
         <TASK>
         dump_stack_lvl+0x68/0xa0
         print_report+0xcb/0x5e0
         ? __virt_addr_valid+0x21d/0x3f0
         ? kthread_destroy_worker+0xb2/0xd0
         ? kthread_destroy_worker+0xb2/0xd0
         kasan_report+0xca/0x100
         ? kthread_destroy_worker+0xb2/0xd0
         kthread_destroy_worker+0xb2/0xd0
         meson_crypto_probe+0x4d0/0xc10 [amlogic_gxl_crypto]
         platform_probe+0x99/0x140
         really_probe+0x1c6/0x6a0
         ? __pfx___device_attach_driver+0x10/0x10
         __driver_probe_device+0x248/0x310
         ? acpi_driver_match_device+0xb0/0x100
         driver_probe_device+0x48/0x210
         ? __pfx___device_attach_driver+0x10/0x10
         __device_attach_driver+0x160/0x320
         bus_for_each_drv+0x104/0x190
         ? __pfx_bus_for_each_drv+0x10/0x10
         ? _raw_spin_unlock_irqrestore+0x2c/0x50
         __device_attach+0x19d/0x3b0
         ? __pfx___device_attach+0x10/0x10
         ? do_raw_spin_unlock+0x53/0x220
         device_initial_probe+0x78/0xa0
         bus_probe_device+0x5b/0x130
         device_add+0xcfd/0x1430
         ? __pfx_device_add+0x10/0x10
         ? insert_resource+0x34/0x50
         ? lock_release+0xc9/0x290
         platform_device_add+0x24e/0x590
         ? __pfx_meson_crypto_probe_repro_init+0x10/0x10 [meson_crypto_probe_repro]
         meson_crypto_probe_repro_init+0x330/0xff0 [meson_crypto_probe_repro]
         do_one_initcall+0xc0/0x450
         ? __pfx_do_one_initcall+0x10/0x10
         ? _raw_spin_unlock_irqrestore+0x2c/0x50
         ? __create_object+0x59/0x80
         ? kasan_unpoison+0x27/0x60
         do_init_module+0x27b/0x7d0
         ? __pfx_do_init_module+0x10/0x10
         ? kasan_quarantine_put+0x84/0x1d0
         ? kfree+0x32c/0x510
         ? load_module+0x561e/0x5ff0
         load_module+0x54fe/0x5ff0
         ? __pfx_load_module+0x10/0x10
         ? security_file_permission+0x20/0x40
         ? kernel_read_file+0x23d/0x6e0
         ? mmap_region+0x235/0x4a0
         ? __pfx_kernel_read_file+0x10/0x10
         ? __file_has_perm+0x2c0/0x3e0
         init_module_from_file+0x158/0x180
         ? __pfx_init_module_from_file+0x10/0x10
         ? __lock_acquire+0x45a/0x1ba0
         ? idempotent_init_module+0x315/0x610
         ? lock_release+0xc9/0x290
         ? lockdep_init_map_type+0x4b/0x220
         ? do_raw_spin_unlock+0x53/0x220
         idempotent_init_module+0x330/0x610
         ? __pfx_idempotent_init_module+0x10/0x10
         ? __pfx_cred_has_capability.isra.0+0x10/0x10
         ? ksys_mmap_pgoff+0x385/0x520
         __x64_sys_finit_module+0xbe/0x120
         do_syscall_64+0x115/0x690
         entry_SYSCALL_64_after_hwframe+0x77/0x7f
        RIP: 0033:0x7f7d6d31690d
        Code: 5b 41 5c c3 66 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d f3 b4 0f 00 f7 d8 >
        RSP: 002b:00007fffc027ac68 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
        RAX: ffffffffffffffda RBX: 000055f7b81967c0 RCX: 00007f7d6d31690d
        RDX: 0000000000000000 RSI: 000055f79a0d6cd2 RDI: 0000000000000003
        RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
        R10: 0000000000000003 R11: 0000000000000246 R12: 000055f79a0d6cd2
        R13: 000055f7b8196790 R14: 000055f79a0d5888 R15: 000055f7b81968e0
         </TASK>
    
    Fixes: 48fe583fe541 ("crypto: amlogic - Add crypto accelerator for amlogic GXL")
    Cc: stable@vger.kernel.org
    Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
    Signed-off-by: Dawei Feng <dawei.feng@seu.edu.cn>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: atmel-sha204a - drop hwrng quality reduction for ATSHA204A [+ + +]
Author: Thorsten Blum <thorsten.blum@linux.dev>
Date:   Tue Apr 28 12:14:32 2026 +0200

    crypto: atmel-sha204a - drop hwrng quality reduction for ATSHA204A
    
    commit ea5e57cc97185329dcc5ebdcaae7e1500bf0ad0b upstream.
    
    Commit 8006aff15516 ("crypto: atmel-sha204a - Set hwrng quality to
    lowest possible") reduced the hwrng quality to 1 based on a review by
    Bill Cox [1]. However, despite its title, the review only tested the
    ATSHA204, not the ATSHA204A.
    
    In the same thread, Atmel engineer Landon Cox wrote "this behavior has
    been eliminated entirely"[2] in the ATSHA204A and "this problem does not
    affect the ATECC108 or the ATECC108A (or the ATSHA204A)"[3].
    
    According to the official ATSHA204A datasheet [4], the device contains a
    high-quality hardware RNG that combines its output with an internal seed
    value stored in EEPROM or SRAM to generate random numbers. The device
    also implements all security functions using SHA-256, and the driver
    uses the chip's Random command in seed-update mode.
    
    Keep 'quality = 1' for ATSHA204, but drop the explicit hwrng quality
    reduction for ATSHA204A and fall back to the hwrng core default.
    
    [1] https://www.metzdowd.com/pipermail/cryptography/2014-December/023858.html
    [2] https://www.metzdowd.com/pipermail/cryptography/2014-December/023852.html
    [3] https://www.metzdowd.com/pipermail/cryptography/2014-December/023886.html
    [4] https://ww1.microchip.com/downloads/en/DeviceDoc/ATSHA204A-Data-Sheet-40002025A.pdf
    
    Fixes: 8006aff15516 ("crypto: atmel-sha204a - Set hwrng quality to lowest possible")
    Cc: stable@vger.kernel.org
    Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
    Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: atmel-sha204a - fail on hwrng registration error in probe path [+ + +]
Author: Thorsten Blum <thorsten.blum@linux.dev>
Date:   Sun May 17 18:27:40 2026 +0200

    crypto: atmel-sha204a - fail on hwrng registration error in probe path
    
    commit 49e05bb00f2e8168695f7af4d694c39e1423e8a2 upstream.
    
    Commit 13909a0c8897 ("crypto: atmel-sha204a - provide the otp content")
    overwrote the hwrng registration return value when creating the sysfs
    group, which allowed atmel_sha204a_probe() to succeed even if
    devm_hwrng_register() failed.
    
    Return immediately when devm_hwrng_register() fails, and report both
    hwrng and sysfs registration errors with dev_err(). Adjust the sysfs
    error log message for consistency.
    
    Fixes: 13909a0c8897 ("crypto: atmel-sha204a - provide the otp content")
    Cc: stable@vger.kernel.org
    Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: caam - use print_hex_dump_devel to guard key hex dumps [+ + +]
Author: Thorsten Blum <thorsten.blum@linux.dev>
Date:   Mon Apr 27 18:39:37 2026 +0200

    crypto: caam - use print_hex_dump_devel to guard key hex dumps
    
    commit 3f57657b6ea23f933371f2c2846322f441773cee upstream.
    
    Use print_hex_dump_devel() for dumping sensitive key material in
    *_setkey() and gen_split_key() to avoid leaking secrets at runtime when
    CONFIG_DYNAMIC_DEBUG is enabled.
    
    Fixes: 6e005503199b ("crypto: caam - print debug messages at debug level")
    Cc: stable@vger.kernel.org
    Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: caam - use print_hex_dump_devel to guard key hex dumps again [+ + +]
Author: Thorsten Blum <thorsten.blum@linux.dev>
Date:   Mon Apr 27 18:39:39 2026 +0200

    crypto: caam - use print_hex_dump_devel to guard key hex dumps again
    
    commit 8005dc808bcce7d6cc2ae015a3cde1683bee602d upstream.
    
    Use print_hex_dump_devel() for dumping sensitive key material in
    *_setkey() to avoid leaking secrets at runtime when CONFIG_DYNAMIC_DEBUG
    is enabled.
    
    Fixes: 8d818c105501 ("crypto: caam/qi2 - add DPAA2-CAAM driver")
    Fixes: 226853ac3ebe ("crypto: caam/qi2 - add skcipher algorithms")
    Cc: stable@vger.kernel.org
    Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: ccp - Do not initialize SNP for ioctl(SNP_COMMIT) [+ + +]
Author: Tycho Andersen (AMD) <tycho@kernel.org>
Date:   Mon May 4 10:51:45 2026 -0600

    crypto: ccp - Do not initialize SNP for ioctl(SNP_COMMIT)
    
    commit 5a1364da2f04217a36e2fdfa2db4ee025b383a20 upstream.
    
    Sashiko notes:
    
    > if SEV initialization fails and KVM is actively running normal VMs, could a
    > userspace process trigger this code path via /dev/sev ioctls (e.g.,
    > SEV_PDH_GEN) and zero out MSR_VM_HSAVE_PA globally? Would the next VMRUN
    > execution for an active VM trigger a general protection fault and crash the
    > host?
    
    The SNP_COMMIT command does not require the firmware to be in any
    particular state. Skip initializing it if it was previously uninitialized.
    
    The SEV-SNP firmware specification doc 56860 does not mention SNP_COMMIT in
    Table 5 as a command that is allowed in the UNINIT state, but it is in fact
    allowed and a future documentation update will reflect that.
    
    Fixes: ceac7fb89e8d ("crypto: ccp - Ensure implicit SEV/SNP init and shutdown in ioctls")
    Reported-by: Sashiko
    Assisted-by: Gemini:gemini-3.1-pro-preview
    Link: https://sashiko.dev/#/patchset/20260324161301.1353976-1-tycho%40kernel.org
    CC: <stable@vger.kernel.org>
    Signed-off-by: Tycho Andersen (AMD) <tycho@kernel.org>
    Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: ccp - Do not initialize SNP for ioctl(SNP_CONFIG) [+ + +]
Author: Tycho Andersen (AMD) <tycho@kernel.org>
Date:   Mon May 4 10:51:47 2026 -0600

    crypto: ccp - Do not initialize SNP for ioctl(SNP_CONFIG)
    
    commit 08f0e65e784c4b20e6e620dd4f68d8636073a3d2 upstream.
    
    Sashiko notes:
    
    > if SEV initialization fails and KVM is actively running normal VMs, could a
    > userspace process trigger this code path via /dev/sev ioctls (e.g.,
    > SEV_PDH_GEN) and zero out MSR_VM_HSAVE_PA globally? Would the next VMRUN
    > execution for an active VM trigger a general protection fault and crash the
    > host?
    
    Refuse to re-try initialization if SNP is not already initialized for
    SNP_CONFIG.
    
    This is technically an ABI break: before if SNP initialization failed it
    could be transparently retriggered by this ioctl, and if no VMs were
    running, everything worked fine. Hopefully this is enough of a corner case
    that nobody will notice, but someone does, there are a few options:
    
    * do something like symbol_get() for kvm and refuse to initialize if KVM is
      loaded
    * check each cpu's HSAVE_PA for non-zero data before re-initializing
    * once initialization has failed, continue to refuse to initialize until
      the ccp module is unloaded
    
    Fixes: ceac7fb89e8d ("crypto: ccp - Ensure implicit SEV/SNP init and shutdown in ioctls")
    Reported-by: Sashiko
    Assisted-by: Gemini:gemini-3.1-pro-preview
    Link: https://sashiko.dev/#/patchset/20260324161301.1353976-1-tycho%40kernel.org
    CC: <stable@vger.kernel.org>
    Signed-off-by: Tycho Andersen (AMD) <tycho@kernel.org>
    Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: ccp - Do not initialize SNP for ioctl(SNP_VLEK_LOAD) [+ + +]
Author: Tycho Andersen (AMD) <tycho@kernel.org>
Date:   Mon May 4 10:51:46 2026 -0600

    crypto: ccp - Do not initialize SNP for ioctl(SNP_VLEK_LOAD)
    
    commit f91e9dbb5845d1e5abf1028e6df57dcf61583e1b upstream.
    
    Sashiko notes:
    
    > if SEV initialization fails and KVM is actively running normal VMs, could a
    > userspace process trigger this code path via /dev/sev ioctls (e.g.,
    > SEV_PDH_GEN) and zero out MSR_VM_HSAVE_PA globally? Would the next VMRUN
    > execution for an active VM trigger a general protection fault and crash the
    > host?
    
    The SEV firmware docs for SNP_VLEK_LOAD note:
    
    > On SNP_SHUTDOWN, the VLEK is deleted.
    
    That is, the initialization/shutdown wrapper here is pointless, because the
    firmware immediately throws away the key anyway. Instead, refuse to do
    anything if SNP has not been previously initialized.
    
    This is an ABI break: before, this was a no-op and almost certainly a
    mistake by userspace, and now it returns -ENODEV. ABI compatibility could be
    maintained here by simply returning 0 in the check instead.
    
    Fixes: ceac7fb89e8d ("crypto: ccp - Ensure implicit SEV/SNP init and shutdown in ioctls")
    Reported-by: Sashiko
    Assisted-by: Gemini:gemini-3.1-pro-preview
    Link: https://sashiko.dev/#/patchset/20260324161301.1353976-1-tycho%40kernel.org
    CC: <stable@vger.kernel.org>
    Signed-off-by: Tycho Andersen (AMD) <tycho@kernel.org>
    Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: ccp - Do not initialize SNP for SEV ioctls [+ + +]
Author: Tycho Andersen (AMD) <tycho@kernel.org>
Date:   Mon May 4 10:51:44 2026 -0600

    crypto: ccp - Do not initialize SNP for SEV ioctls
    
    commit fb1758e74b8061aacfbce7bbb7a7cc650537e167 upstream.
    
    Sashiko notes:
    
    > if SEV initialization fails and KVM is actively running normal VMs, could a
    > userspace process trigger this code path via /dev/sev ioctls (e.g.,
    > SEV_PDH_GEN) and zero out MSR_VM_HSAVE_PA globally? Would the next VMRUN
    > execution for an active VM trigger a general protection fault and crash the
    > host?
    
    sev_move_to_init_state() is called for ioctls requiring only SEV firmware:
    SEV_PEK_GEN, SEV_PDH_GEN, SEV_PEK_CSR, SEV_PEK_CERT_IMPORT, and
    SEV_PDH_CERT_EXPORT. After the firmware command, it does SEV_SHUTDOWN on
    the SEV firmware. Since these commands do not require SNP to be
    initialized, skip it by calling __sev_platform_init_locked() which only
    initializes the SEV firmware. This way SNP is not Initialized at all, and
    HSAVE_PA is not cleared.
    
    The previous code saved any SEV initialization firmware error to
    init_args.error and then threw it away and hardcoded the return value of
    INVALID_PLATFORM_STATE regardless of the real firmware error. This patch
    changes it to surface the underlying error, which is hopefully both more
    useful and doesn't cause any problems.
    
    Note that it is still safe to call __sev_firmware_shutdown() directly: it
    calls __sev_snp_shutdown_locked(), which skips SNP shutdown if SNP was not
    initialized.
    
    Fixes: ceac7fb89e8d ("crypto: ccp - Ensure implicit SEV/SNP init and shutdown in ioctls")
    Reported-by: Sashiko
    Assisted-by: Gemini:gemini-3.1-pro-preview
    Link: https://sashiko.dev/#/patchset/20260324161301.1353976-1-tycho%40kernel.org
    CC: <stable@vger.kernel.org>
    Signed-off-by: Tycho Andersen (AMD) <tycho@kernel.org>
    Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: chacha20poly1305 - validate poly1305 template argument [+ + +]
Author: Xiaonan Zhao <ngochuongbui67@gmail.com>
Date:   Tue May 26 18:11:43 2026 +0800

    crypto: chacha20poly1305 - validate poly1305 template argument
    
    commit 265b861bece38318b8e0fc8fac0643d4ef906d31 upstream.
    
    chachapoly_create() still accepts the compatibility poly1305 parameter
    in the template name, but it assumes the second template argument is
    always present and immediately passes it to strcmp().
    
    When the argument is missing, crypto_attr_alg_name() returns an error
    pointer. Check for that before comparing the name so malformed template
    instantiations fail with an error instead of dereferencing the error
    pointer in strcmp().
    
    This matches the surrounding Crypto API template pattern where
    crypto_attr_alg_name() results are validated before string-specific use.
    
    Fixes: a298765e28ad ("crypto: chacha20poly1305 - Use lib/crypto poly1305")
    Cc: stable@kernel.org
    Reported-by: Yuan Tan <yuantan098@gmail.com>
    Reported-by: Zhengchuan Liang <zcliangcn@gmail.com>
    Reported-by: Xin Liu <bird@lzu.edu.cn>
    Co-developed-by: Luxing Yin <tr0jan@lzu.edu.cn>
    Signed-off-by: Luxing Yin <tr0jan@lzu.edu.cn>
    Signed-off-by: Xiaonan Zhao <ngochuongbui67@gmail.com>
    Signed-off-by: Ren Wei <n05ec@lzu.edu.cn>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: crypto4xx - Remove insecure and unused rng_alg [+ + +]
Author: Eric Biggers <ebiggers@kernel.org>
Date:   Fri May 29 15:04:30 2026 -0700

    crypto: crypto4xx - Remove insecure and unused rng_alg
    
    commit 7811ec9e973d2c9e465083699f0c8240b98cb8c4 upstream.
    
    Remove crypto4xx_rng, as it is insecure and unused:
    
    - It has only a 64-bit security strength, which is highly inadequate.
      This can be seen by the fact that crypto4xx_hw_init() seeds it with
      only 64 bits of entropy, and the fact that the original commit
      mentions that it implements ANSI X9.17 Annex C.
    
      Another issue was that this driver didn't implement the crypto_rng API
      correctly, as crypto4xx_prng_generate() didn't return 0 on success.
    
    - No user of this code is known.  It's usable only theoretically via the
      "rng" algorithm type of AF_ALG.  But userspace actually just uses the
      actual Linux RNG (/dev/random etc) instead.  And rng_algs don't
      contribute entropy to the actual Linux RNG either.  (This may have
      been confused with hwrng, which does contribute entropy.)
    
    Fixes: d072bfa48853 ("crypto: crypto4xx - add prng crypto support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Eric Biggers <ebiggers@kernel.org>
    Acked-by: Christian Lamparter <chunkeey@gmail.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: drbg - Fix drbg_max_addtl() on 64-bit kernels [+ + +]
Author: Eric Biggers <ebiggers@kernel.org>
Date:   Sun Apr 19 23:33:48 2026 -0700

    crypto: drbg - Fix drbg_max_addtl() on 64-bit kernels
    
    commit 6f49f00c981bbb9ef602966f19bfdbef46b681d2 upstream.
    
    On 64-bit kernels, drbg_max_addtl() returns 2**35 bytes.  That's too
    large, for two reasons:
    
    1. SP800-90A says the maximum limit is 2**35 *bits*, not 2**35 bytes.
       So the implemented limit has confused bits and bytes.
    
    2. When drbg_kcapi_hash() calls crypto_shash_update() on the additional
       information string, the length is implicitly cast to 'unsigned int'.
       That truncates the additional information string to U32_MAX bytes.
    
    Fix the maximum additional information string length to always be
    U32_MAX - 1, causing an error to be returned for any longer lengths.
    
    Fixes: 541af946fe13 ("crypto: drbg - SP800-90A Deterministic Random Bit Generator")
    Cc: stable@vger.kernel.org
    Signed-off-by: Eric Biggers <ebiggers@kernel.org>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: drbg - Fix ineffective sanity check [+ + +]
Author: Eric Biggers <ebiggers@kernel.org>
Date:   Sun Apr 19 23:33:47 2026 -0700

    crypto: drbg - Fix ineffective sanity check
    
    commit 040ad83b0e8aa065fd2fc641cacba8491a8b186d upstream.
    
    Fix drbg_healthcheck_sanity() to correctly check the return value of
    drbg_generate().  drbg_generate() returns 0 on success, or a negative
    errno value on failure.  drbg_healthcheck_sanity() incorrectly assumed
    that it returned a positive value on success.
    
    This didn't make the sanity check fail, but it made it ineffective.
    
    Fixes: cde001e4c3c3 ("crypto: rng - RNGs must return 0 in success case")
    Cc: stable@vger.kernel.org
    Signed-off-by: Eric Biggers <ebiggers@kernel.org>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: drbg - Fix misaligned writes in CTR_DRBG and HASH_DRBG [+ + +]
Author: Eric Biggers <ebiggers@kernel.org>
Date:   Sun Apr 19 23:33:46 2026 -0700

    crypto: drbg - Fix misaligned writes in CTR_DRBG and HASH_DRBG
    
    commit ddc4dedb9ba3c8eecbc8c050fffd46d1b7e75c21 upstream.
    
    drbg_cpu_to_be32() is being used to do a plain write to a byte array,
    which doesn't have any alignment guarantee.  This can cause a misaligned
    write.  Replace it with the correct function, put_unaligned_be32().
    
    Fixes: 72f3e00dd67e ("crypto: drbg - replace int2byte with cpu_to_be")
    Cc: stable@vger.kernel.org
    Signed-off-by: Eric Biggers <ebiggers@kernel.org>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: drbg - Fix returning success on failure in CTR_DRBG [+ + +]
Author: Eric Biggers <ebiggers@kernel.org>
Date:   Sun Apr 19 23:33:45 2026 -0700

    crypto: drbg - Fix returning success on failure in CTR_DRBG
    
    commit 39a31ad9e2a5ed7e9c9c6f711dca96c8c8f5f26b upstream.
    
    drbg_ctr_generate() sometimes returns success when it fails, leaving the
    output buffer uninitialized.  Fix it.
    
    Fixes: cde001e4c3c3 ("crypto: rng - RNGs must return 0 in success case")
    Cc: stable@vger.kernel.org
    Signed-off-by: Eric Biggers <ebiggers@kernel.org>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: drbg - Fix the fips_enabled priority boost [+ + +]
Author: Eric Biggers <ebiggers@kernel.org>
Date:   Sun Apr 19 23:33:49 2026 -0700

    crypto: drbg - Fix the fips_enabled priority boost
    
    commit a8a1f93080efc83a9ff8452954429ae379e9e614 upstream.
    
    When fips_enabled=1, it seems to have been intended for one of the
    algorithms defined in crypto/drbg.c to be the highest priority "stdrng"
    algorithm, so that it is what is used by "stdrng" users.
    
    However, the code only boosts the priority to 400, which is less than
    the priority 500 used in drivers/crypto/caam/caamprng.c.  Thus, the CAAM
    RNG could be used instead.
    
    Fix this by boosting the priority by 2000 instead of 200.
    
    Fixes: 541af946fe13 ("crypto: drbg - SP800-90A Deterministic Random Bit Generator")
    Cc: stable@vger.kernel.org
    Signed-off-by: Eric Biggers <ebiggers@kernel.org>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: ecc - Fix carry overflow in vli multiplication [+ + +]
Author: Anastasia Tishchenko <sv3iry@gmail.com>
Date:   Wed May 13 13:57:40 2026 +0300

    crypto: ecc - Fix carry overflow in vli multiplication
    
    commit 27b536a2ec8e2f85a0380c2d13c9ecbc7aaab406 upstream.
    
    The carry flag calculation fails when r01.m_high is saturated
    (0xFFFFFFFFFFFFFFFF) and addition of lower bits overflows.
    
    The condition (r01.m_high < product.m_high) doesn't handle the case
    where r01.m_high == product.m_high and an additional carry exists
    from lower-bit overflow.
    
    When commit 3c4b23901a0c ("crypto: ecdh - Add ECDH software support")
    introduced crypto/ecc.c, it split the muladd() function in the
    micro-ecc library into separate mul_64_64() and add_128_128() helpers.
    It seems the check got lost in translation.
    
    Add proper handling for this boundary by accounting for the carry
    from the lower addition.
    
    Fixes: 3c4b23901a0c ("crypto: ecdh - Add ECDH software support")
    Signed-off-by: Anastasia Tishchenko <sv3iry@gmail.com>
    Cc: stable@vger.kernel.org # v4.8+
    Reviewed-by: Lukas Wunner <lukas@wunner.de>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: hisi-trng - Remove crypto_rng interface [+ + +]
Author: Eric Biggers <ebiggers@kernel.org>
Date:   Sat May 30 13:26:23 2026 -0700

    crypto: hisi-trng - Remove crypto_rng interface
    
    commit 216a7795ec210bdabd5dad42323eee70bbfc8d90 upstream.
    
    drivers/crypto/hisilicon/trng/trng.c exposes the same hardware through
    two completely separate interfaces, crypto_rng and hwrng.  However, the
    implementation of this is buggy because it permits generation operations
    from these interfaces to run concurrently with each other, accessing the
    same registers.  That is, hisi_trng_generate() synchronizes with itself
    but not with hisi_trng_read().  This results in potential repetition of
    output from the RNG, output of non-random values, etc.
    
    Fortunately, there's actually no point in hardware RNG drivers
    implementing the crypto_rng interface.  It's not actually used by
    anything besides the "rng" algorithm type of AF_ALG, which in turn is
    not actually used in practice.  Other crypto_rng hardware drivers are
    likewise being phased out, leaving just the hwrng support.
    
    Thus, remove it to simplify the code and avoid conflict (and confusion)
    with the hwrng interface which is the one that actually matters.
    
    Fixes: e4d9d10ef4be ("crypto: hisilicon/trng - add support for PRNG")
    Cc: stable@vger.kernel.org
    Signed-off-by: Eric Biggers <ebiggers@kernel.org>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: krb5 - filter out async aead implementations at alloc [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
Date:   Sun May 10 19:24:55 2026 -0400

    crypto: krb5 - filter out async aead implementations at alloc
    
    commit 6c9dddeb582fde005360f4fe02c760d45ca05fb5 upstream.
    
    krb5_aead_encrypt(), krb5_aead_decrypt() in rfc3961_simplified.c and
    rfc8009_encrypt(), rfc8009_decrypt() in rfc8009_aes2.c set a NULL
    completion callback and treat any negative return from
    crypto_aead_{encrypt,decrypt}() as terminal, falling through to
    kfree_sensitive(buffer).  When the encrypt_name resolves to an
    async AEAD instance the request returns -EINPROGRESS, the buffer
    is freed while the backend's worker still holds a pointer, and the
    worker dereferences the freed slab on completion.
    
    KASAN report under UML+SLUB with a synthetic async aead backend
    bound to krb5->encrypt_name:
    
      BUG: KASAN: slab-use-after-free in t5_stub_complete+0x7d/0xc7
    
    The helpers were written synchronously, so filter the async
    instances out at allocation time instead of plumbing
    crypto_wait_req() through every call site.
    
    Reachable via net/rxrpc/rxgk.c, fs/afs/cm_security.c and
    net/ceph/crypto.c on systems with an async AEAD provider bound to
    the krb5 enctype name.
    
    Fixes: 00244da40f78 ("crypto/krb5: Implement the Kerberos5 rfc3961 encrypt and decrypt functions")
    Fixes: 6c3c0e86c2ac ("crypto/krb5: Implement the AES enctypes from rfc8009")
    Cc: stable@vger.kernel.org
    Suggested-by: Herbert Xu <herbert@gondor.apana.org.au>
    Assisted-by: Claude:claude-opus-4-7
    Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: loongson - Remove broken and unused loongson-rng [+ + +]
Author: Eric Biggers <ebiggers@kernel.org>
Date:   Fri May 29 16:32:08 2026 -0700

    crypto: loongson - Remove broken and unused loongson-rng
    
    commit af3d1bb9a09daf928fc3f173689fb7904d6a6d4f upstream.
    
    The loongson-rng rng_alg has several vulnerabilities, including not
    providing forward security, and a use-after-free bug due to the use of
    wait_for_completion_interruptible().
    
    Meanwhile, the rng_alg framework doesn't really have any purpose in the
    first place other than to access the software algorithms crypto/drbg.c
    and crypto/jitterentropy.c.  Hardware-specific rng_algs have no
    in-kernel user, and unlike hwrng there's no feed into the actual Linux
    RNG.  As such, there's really no point to this code.  There are of
    course other rng_alg drivers that are similarly unused, but they're
    similarly in the process of being phased out, e.g.
    https://lore.kernel.org/r/20260529193648.18172-1-ebiggers@kernel.org and
    https://lore.kernel.org/r/20260529220430.34135-1-ebiggers@kernel.org
    
    Given that, there's no point in fixing forward these vulnerabilities,
    and it makes much more sense to simply roll back the addition of this
    driver.  If this platform provides TRNG (not PRNG) functionality, it
    could make sense to add a hwrng driver, but it would be quite different.
    
    Link: https://lore.kernel.org/linux-crypto/20260525145939.GC2018@quark/
    Fixes: 766b2d724c8d ("crypto: loongson - add Loongson RNG driver support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Eric Biggers <ebiggers@kernel.org>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: loongson - Select CRYPTO_RNG [+ + +]
Author: Eric Biggers <ebiggers@kernel.org>
Date:   Thu May 21 21:25:25 2026 -0500

    crypto: loongson - Select CRYPTO_RNG
    
    commit 4c600ab0d8cfc9d75b92f3426dbcb2ad85eac91d upstream.
    
    This driver registers a rng_alg, so it requires CRYPTO_RNG.
    
    Fixes: 766b2d724c8d ("crypto: loongson - add Loongson RNG driver support")
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202605201622.qWOiiZTV-lkp@intel.com/
    Cc: stable@vger.kernel.org
    Signed-off-by: Eric Biggers <ebiggers@kernel.org>
    Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: pcrypt - restore callback for non-parallel fallback [+ + +]
Author: Ruijie Li <ruijieli51@gmail.com>
Date:   Mon May 25 19:45:21 2026 +0800

    crypto: pcrypt - restore callback for non-parallel fallback
    
    commit ed459fe319376e876de433d12b6c6772e612ca36 upstream.
    
    pcrypt installs pcrypt_aead_done() on the child AEAD request before
    trying to submit it through padata.  If padata_do_parallel() returns
    -EBUSY, pcrypt falls back to calling the child AEAD directly.
    
    That fallback must not keep the padata completion callback.  Otherwise
    an asynchronous completion runs pcrypt_aead_done() even though the
    request was never enrolled in padata.
    
    Restore the original request callback and callback data before calling
    the child AEAD directly.  This keeps the fallback path aligned with a
    direct AEAD request while leaving the parallel path unchanged.
    
    Fixes: 662f2f13e66d ("crypto: pcrypt - Call crypto layer directly when padata_do_parallel() return -EBUSY")
    Cc: stable@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: Zhengchuan Liang <zcliangcn@gmail.com>
    Reported-by: Xin Liu <bird@lzu.edu.cn>
    Assisted-by: Codex:gpt-5.4
    Signed-off-by: Ruijie Li <ruijieli51@gmail.com>
    Signed-off-by: Ren Wei <n05ec@lzu.edu.cn>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: qat - centralize bus master enable [+ + +]
Author: Ahsan Atta <ahsan.atta@intel.com>
Date:   Wed May 13 17:16:56 2026 +0200

    crypto: qat - centralize bus master enable
    
    commit e5712ff82947dd02d118cee119ed36cec671d814 upstream.
    
    QAT driver currently toggles PCI bus mastering in multiple places
    (probe paths, and reset callbacks). This makes BME state depend on
    call ordering and on what PCI command bits were captured in saved PCI
    config state.
    
    Make BME control explicit and deterministic:
    - remove pci_set_master() from device-specific probe paths
    - add adf_set_bme() and call it from adf_dev_init() so BME is enabled
      at one point before device bring-up
    - drop redundant pci_set_master() and pci_clear_master from adf_aer.c
      and rely on the unified init path for BME enablement
    
    This is in preparation for adding reset_prepare() and reset_done()
    hooks. In the PCI reset callback flow, the PCI core saves and
    restores device configuration state around reset_prepare() and
    reset_done(). This change is needed to ensure that we are able to
    properly shutdown or reinitialize the device post sysfs triggered
    resets.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Ahsan Atta <ahsan.atta@intel.com>
    Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: qat - factor out AER reset helpers [+ + +]
Author: Ahsan Atta <ahsan.atta@intel.com>
Date:   Wed May 13 17:16:58 2026 +0200

    crypto: qat - factor out AER reset helpers
    
    commit 56707afb92fee371c0f2e04332c9aa03cdb89793 upstream.
    
    Move the shutdown and recovery sequences out of adf_error_detected()
    and adf_slot_reset() into reset_prepare() and reset_done() helpers.
    
    This makes the AER recovery path easier to follow and prepares the
    common reset flow for reuse by additional PCI reset callbacks without
    duplicating the logic.
    
    No functional change intended.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Ahsan Atta <ahsan.atta@intel.com>
    Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Reviewed-by: Damian Muszynski <damian.muszynski@intel.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: qat - fix restarting state leak on allocation failure [+ + +]
Author: Ahsan Atta <ahsan.atta@intel.com>
Date:   Wed May 20 13:33:00 2026 +0100

    crypto: qat - fix restarting state leak on allocation failure
    
    commit 7d3ed20f7e46b3e991936fedd7a28f3ff4aec8d2 upstream.
    
    In adf_dev_aer_schedule_reset(), ADF_STATUS_RESTARTING is set before
    allocating reset_data. If the allocation fails, the function returns
    -ENOMEM without queuing reset work, so nothing ever clears the bit.
    This leaves the device permanently stuck in the restarting state,
    causing all subsequent reset attempts to be silently skipped.
    
    Fix this by using test_and_set_bit() to atomically claim the
    RESTARTING state, preventing duplicate reset scheduling races under
    concurrent fatal error reporting. If the subsequent allocation fails,
    clear the bit to restore clean state so future reset attempts can
    proceed.
    
    Cc: stable@vger.kernel.org
    Fixes: d8cba25d2c68 ("crypto: qat - Intel(R) QAT driver framework")
    Signed-off-by: Ahsan Atta <ahsan.atta@intel.com>
    Co-developed-by: Maksim Lukoshkov <maksim.lukoshkov@intel.com>
    Signed-off-by: Maksim Lukoshkov <maksim.lukoshkov@intel.com>
    Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: qat - fix VF2PF work teardown race in adf_disable_sriov() [+ + +]
Author: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Date:   Wed May 13 15:47:32 2026 +0100

    crypto: qat - fix VF2PF work teardown race in adf_disable_sriov()
    
    commit 277281c10c63791067d24d421f7c43a15faa9096 upstream.
    
    The VF2PF interrupt handler queues PF-side response work that stores a
    raw pointer to per-VF state (struct adf_accel_vf_info). Currently,
    adf_disable_sriov() destroys per-VF mutexes and frees vf_info without
    stopping new VF2PF work or waiting for in-flight workers to complete. A
    concurrently scheduled or already queued worker can then dereference
    freed memory.
    
    This manifests as a use-after-free when KASAN is enabled:
    
      BUG: KASAN: null-ptr-deref in mutex_lock+0x76/0xe0
      Write of size 8 at addr 0000000000000260 by task kworker/24:2/...
      Workqueue: qat_pf2vf_resp_wq adf_iov_send_resp [intel_qat]
      Call Trace:
        kasan_report+0x119/0x140
        mutex_lock+0x76/0xe0
        adf_gen4_pfvf_send+0xd4/0x1f0 [intel_qat]
        adf_recv_and_handle_vf2pf_msg+0x290/0x360 [intel_qat]
        adf_iov_send_resp+0x8c/0xe0 [intel_qat]
        process_one_work+0x6ac/0xfd0
        worker_thread+0x4dd/0xd30
        kthread+0x326/0x410
        ret_from_fork+0x33b/0x670
    
    Add a PF-local flag, vf2pf_disabled, that gates work queueing, worker
    processing, and interrupt re-enabling during teardown. Set this flag
    atomically with the hardware interrupt mask inside
    adf_disable_all_vf2pf_interrupts(). After masking, synchronize the AE
    cluster MSI-X interrupt and flush the PF response workqueue before
    tearing down per-VF locks and state so all in-flight work completes
    before vf_info is destroyed.
    
    Introduce adf_enable_all_vf2pf_interrupts() to clear the flag and
    unmask all VF2PF interrupts under the same lock when SR-IOV is
    re-enabled. This ensures the software flag and hardware state transition
    atomically on both the enable and disable paths.
    
    Cc: stable@vger.kernel.org
    Fixes: ed8ccaef52fa ("crypto: qat - Add support for SRIOV")
    Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Reviewed-by: Ahsan Atta <ahsan.atta@intel.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: qat - handle sysfs-triggered reset callbacks [+ + +]
Author: Ahsan Atta <ahsan.atta@intel.com>
Date:   Wed May 13 17:16:59 2026 +0200

    crypto: qat - handle sysfs-triggered reset callbacks
    
    commit 4627ef7019bc532f992c0723e881811ce12f0a02 upstream.
    
    A reset requested through /sys/bus/pci/devices/.../reset invokes the
    driver reset_prepare() and reset_done() callbacks. The QAT driver does
    not implement those callbacks today, so the reset proceeds without
    quiescing the device or bringing it back up afterward, which leaves
    the device unusable.
    
    Hook reset_prepare() and reset_done() into adf_err_handler so the
    common shutdown and recovery flow also runs for reset. Skip device
    quiesce if the device is already in a down state.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Ahsan Atta <ahsan.atta@intel.com>
    Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Reviewed-by: Damian Muszynski <damian.muszynski@intel.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: qat - keep VFs enabled during reset [+ + +]
Author: Ahsan Atta <ahsan.atta@intel.com>
Date:   Wed May 13 17:16:54 2026 +0200

    crypto: qat - keep VFs enabled during reset
    
    commit 57518500053987672050dc2f7bf8a774d5d52fd9 upstream.
    
    When a reset is triggered via sysfs, the PCI core invokes the
    reset_prepare() callback while holding pci_dev_lock(), which includes
    the PCI configuration space access semaphore. If reset_prepare() calls
    adf_dev_down(), the call chain adf_dev_stop() -> adf_disable_sriov()
    -> pci_disable_sriov() attempts to acquire the same semaphore,
    resulting in a deadlock.
    
    Avoid this by skipping pci_disable_sriov() when ADF_STATUS_RESTARTING
    is set. During reset the PCI topology is preserved, so VF devices
    remain valid and enumerated across the reset. VF notification and the
    quiesce handshake via adf_pf2vf_notify_restarting() are still
    performed unconditionally so that VFs stop submitting work before the
    PF shuts down.
    
    Correspondingly, skip pci_enable_sriov() in adf_enable_sriov() when
    VFs are already present, since their PCI devices were preserved from
    before the restart.
    
    This is in preparation for adding reset_prepare() and reset_done()
    callbacks in adf_aer.c.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Ahsan Atta <ahsan.atta@intel.com>
    Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Reviewed-by: Damian Muszynski <damian.muszynski@intel.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: qat - notify fatal error before AER reset preparation [+ + +]
Author: Ahsan Atta <ahsan.atta@intel.com>
Date:   Wed May 13 17:16:55 2026 +0200

    crypto: qat - notify fatal error before AER reset preparation
    
    commit 6931835f2fdd0cb9b1c7791748d7e67d0749056a upstream.
    
    Send fatal error notifications to subsystems and VFs as soon as
    AER error detection starts, before entering the reset preparation
    shutdown sequence.
    
    This reduces notification latency and ensures peers are informed
    immediately on fatal detection, rather than after restart-state setup
    and arbitration teardown.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Ahsan Atta <ahsan.atta@intel.com>
    Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Reviewed-by: Damian Muszynski <damian.muszynski@intel.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: qat - protect service table iterations with service_lock [+ + +]
Author: Ahsan Atta <ahsan.atta@intel.com>
Date:   Wed May 20 13:41:55 2026 +0100

    crypto: qat - protect service table iterations with service_lock
    
    commit 5c6f845e77ec35f9b7b047cc8f9789bf397cdd3e upstream.
    
    The service_table list is protected by service_lock when entries are
    added or removed (in adf_service_add() and adf_service_remove()), but
    several functions iterate over the list without holding this lock.
    
    A concurrent adf_service_register() or adf_service_unregister() call
    could modify the list during traversal, leading to list corruption or
    a use-after-free.
    
    Fix this by holding service_lock across all list_for_each_entry()
    iterations of service_table in adf_dev_init(), adf_dev_start(),
    adf_dev_stop(), adf_dev_shutdown(), adf_dev_restarting_notify(),
    adf_dev_restarted_notify(), and adf_error_notifier().
    
    The lock ordering is safe: callers of the static helpers (adf_dev_up()
    and adf_dev_down()) acquire state_lock before service_lock, and no
    event_hld callback or service_lock holder ever acquires state_lock in
    the reverse order.
    
    Cc: stable@vger.kernel.org
    Fixes: d8cba25d2c68 ("crypto: qat - Intel(R) QAT driver framework")
    Signed-off-by: Ahsan Atta <ahsan.atta@intel.com>
    Co-developed-by: Maksim Lukoshkov <maksim.lukoshkov@intel.com>
    Signed-off-by: Maksim Lukoshkov <maksim.lukoshkov@intel.com>
    Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: qat - skip restart for down devices [+ + +]
Author: Ahsan Atta <ahsan.atta@intel.com>
Date:   Wed May 13 17:16:57 2026 +0200

    crypto: qat - skip restart for down devices
    
    commit 9676657117b79f88c22875680c36d7da84b75eca upstream.
    
    Skip the shutdown and restart flow when adf_slot_reset() is entered
    for a device that is already down. In that case, leave
    ADF_STATUS_RESTARTING clear and let adf_slot_reset() restore PCI
    function state without calling adf_dev_up(), re-enabling SR-IOV, or
    sending restarted notifications.
    
    This is in preparation for adding reset_prepare() and reset_done()
    callbacks in adf_aer.c.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Ahsan Atta <ahsan.atta@intel.com>
    Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: qat - validate RSA CRT component lengths [+ + +]
Author: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Date:   Thu May 28 16:57:44 2026 +0100

    crypto: qat - validate RSA CRT component lengths
    
    commit b3ac78756588059729b9195fcc9f4b37d54057a5 upstream.
    
    The generic RSA key parser (rsa_helper.c) bounds each CRT component (p,
    q, dp, dq, qinv) by the modulus size n_sz, but qat_rsa_setkey_crt()
    allocates half-size DMA buffers (key_sz / 2) and right-aligns each
    component with:
    
        memcpy(dst + half_key_sz - len, src, len)
    
    When a CRT component is larger than half_key_sz the subtraction
    underflows and memcpy writes past the DMA buffer, causing memory
    corruption.
    
    Add a len > half_key_sz check next to the existing !len check for each
    of the five CRT components so the driver falls back to the non-CRT path
    instead of writing out of bounds.
    
    Fixes: 879f77e9071f ("crypto: qat - Add RSA CRT mode")
    Cc: stable@vger.kernel.org
    Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Reviewed-by: Ahsan Atta <ahsan.atta@intel.com>
    Reviewed-by: Laurent M Coquerel <laurent.m.coquerel@intel.com>
    Tested-by: Laurent M Coquerel <laurent.m.coquerel@intel.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: talitos - add chaining of arbitrary number of descriptor for the SEC1 [+ + +]
Author: Paul Louvel <paul.louvel@bootlin.com>
Date:   Thu May 7 16:41:48 2026 +0200

    crypto: talitos - add chaining of arbitrary number of descriptor for the SEC1
    
    commit f126384ed55279c3b676f89d5ab547b8de8df782 upstream.
    
    The SEC1 hardware can process a chain of descriptors without host
    intervention. Only the hash implementation currently use this feature,
    but with a chain of at most 2 descriptors added in commit 37b5e8897eb5
    ("crypto: talitos - chain in buffered data for ahash on SEC1").
    
    Add supports for chaining an arbitrary number of descriptors in a chain.
    
    Adapt the ahash implementation to make it compatible.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Paul Louvel <paul.louvel@bootlin.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: talitos - move code in current_desc_hdr() into a standalone function [+ + +]
Author: Paul Louvel <paul.louvel@bootlin.com>
Date:   Thu May 7 16:41:51 2026 +0200

    crypto: talitos - move code in current_desc_hdr() into a standalone function
    
    commit f8713d9e6091755dd30f7f1cfa25f8440cddf81b upstream.
    
    Previously added code in current_desc_hdr() in order to add support for
    searching an offending descriptor inside a descriptor chain.
    
    Move that code into a standalone function to improve readability.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Paul Louvel <paul.louvel@bootlin.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: talitos - move dma mapping code in talitos_submit() into a standalone dma_map_request() function [+ + +]
Author: Paul Louvel <paul.louvel@bootlin.com>
Date:   Thu May 7 16:41:50 2026 +0200

    crypto: talitos - move dma mapping code in talitos_submit() into a standalone dma_map_request() function
    
    commit 5c0aa8cad7745505297103f05dda3fa06e8ac670 upstream.
    
    Previously added code to talitos_submit() in order to map an entire
    descriptor chain.
    
    Move that code into a standalone function to improve readability.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Paul Louvel <paul.louvel@bootlin.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: talitos - move dma unmapping code in flush_channel() into a standalone dma_unmap_request() function [+ + +]
Author: Paul Louvel <paul.louvel@bootlin.com>
Date:   Thu May 7 16:41:49 2026 +0200

    crypto: talitos - move dma unmapping code in flush_channel() into a standalone dma_unmap_request() function
    
    commit 4d9b0b7415b9e79a3d54d18b5ff230974ea78740 upstream.
    
    Previously added code to flush_channel() in order to unmap an entire
    descriptor.
    
    Move that code into a standalone function to improve readability.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Paul Louvel <paul.louvel@bootlin.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: talitos - use dma_sync_single_for_cpu() before reading descriptor header [+ + +]
Author: Paul Louvel <paul.louvel@bootlin.com>
Date:   Thu May 7 16:41:47 2026 +0200

    crypto: talitos - use dma_sync_single_for_cpu() before reading descriptor header
    
    commit e17ff3d6ff907dc8406261e8fd3e1fc8a908f0f6 upstream.
    
    In order to know if a descriptor has been processed by the device,
    the driver polls the FIFO to see if DESC_HDR_DONE is set on a descriptor
    header to confirm completion.
    The current code does not make sure that the CPU gets up to date data
    before reading the descriptor.
    
    Fix this by calling dma_sync_single_for_cpu() before reading memory
    written by the device.
    
    Cc: stable@vger.kernel.org
    Fixes: 58cdbc6d2263 ("crypto: talitos - fix hash on SEC1.")
    Signed-off-by: Paul Louvel <paul.louvel@bootlin.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: talitos/hash - drop workqueue mechanism for SEC1 [+ + +]
Author: Paul Louvel <paul.louvel@bootlin.com>
Date:   Thu May 7 16:41:54 2026 +0200

    crypto: talitos/hash - drop workqueue mechanism for SEC1
    
    commit be4802afb1700534e48cb776d0d1e772c27de130 upstream.
    
    Now that SEC1 hash uses hardware descriptor chaining instead of a
    workqueue to process requests exceeding TALITOS1_MAX_DATA_LEN, the
    workqueue code is no longer needed.
    
    Remove sec1_ahash_process_remaining(), the related fields from
    talitos_ahash_req_ctx (request_bufsl, areq, request_sl,
    remaining_ahash_request_bytes, current_ahash_request_bytes,
    sec1_ahash_process_remaining), the dead code in ahash_done(), and
    simplify ahash_process_req() to call ahash_process_req_one() directly
    with the original areq->src and areq->nbytes.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Paul Louvel <paul.louvel@bootlin.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: talitos/hash - fix SEC2 64k - 1 ahash request limitation [+ + +]
Author: Paul Louvel <paul.louvel@bootlin.com>
Date:   Thu May 7 16:41:57 2026 +0200

    crypto: talitos/hash - fix SEC2 64k - 1 ahash request limitation
    
    commit 6e12daff6ec125102a6fdcafc5aa7199f7ce8933 upstream.
    
    The problem described in commit 655ef638a2bc ("crypto: talitos - fix
    SEC1 32k ahash request limitation") also apply for the SEC2 hardware,
    but with a limitation of 64k - 1 bytes.
    
    Split ahash_done() into SEC1 and SEC2 paths: SEC1 continues to free the
    whole descriptor list at once, while SEC2 now iterates through
    descriptors one by one, submitting the next only after the previous
    completes, which is required since SEC2 cannot chain descriptors in
    hardware.
    
    Cc: stable@vger.kernel.org
    Fixes: c662b043cdca ("crypto: af_alg/hash: Support MSG_SPLICE_PAGES")
    Signed-off-by: Paul Louvel <paul.louvel@bootlin.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: talitos/hash - prepare SEC1 descriptor chaining, remove additional descriptor [+ + +]
Author: Paul Louvel <paul.louvel@bootlin.com>
Date:   Thu May 7 16:41:52 2026 +0200

    crypto: talitos/hash - prepare SEC1 descriptor chaining, remove additional descriptor
    
    commit 59b5d899e33701665f18abe6bebf987427876e3e upstream.
    
    Currently, when SEC1 has buffered data (nbuf != 0), the ahash code
    creates an additional descriptor on the fly inside
    common_nonsnoop_hash() to handle the remainder of the data. This
    approach is incompatible with the arbitrary-length descriptor chaining
    that follows.
    
    Remove the "additional descriptor" logic from common_nonsnoop_hash()
    and common_nonsnoop_hash_unmap().
    
    Also remove the nbytes adjustment for SEC1 in ahash_edesc_alloc()
    that subtracted nbuf.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Paul Louvel <paul.louvel@bootlin.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: talitos/hash - remove useless wrapper [+ + +]
Author: Paul Louvel <paul.louvel@bootlin.com>
Date:   Thu May 7 16:41:56 2026 +0200

    crypto: talitos/hash - remove useless wrapper
    
    commit 907ae6088c82c9abae2d26477fddd60df6ad003b upstream.
    
    ahash_process_req() was a wrapper used in commit 655ef638a2bc ("crypto:
    talitos - fix SEC1 32k ahash request limitation"). Rename
    ahash_process_req_one() to ahash_process_req() and remove the wrapper.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Paul Louvel <paul.louvel@bootlin.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: talitos/hash - rename first_desc/last_desc to first_request/last_request [+ + +]
Author: Paul Louvel <paul.louvel@bootlin.com>
Date:   Thu May 7 16:41:55 2026 +0200

    crypto: talitos/hash - rename first_desc/last_desc to first_request/last_request
    
    commit 8bcf00671400ac3b3a4cc3011e6c1496dbd880fd upstream.
    
    In talitos_ahash_req_ctx and talitos_export_state, the fields
    first_desc and last_desc describe request-level (not descriptor-level)
    state.  Rename them to first_request and last_request for clarity.
    last_desc is also removed from talitos_ahash_req_ctx as it is no
    longer used.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Paul Louvel <paul.louvel@bootlin.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: talitos/hash - use descriptor chaining for SEC1 instead of workqueue [+ + +]
Author: Paul Louvel <paul.louvel@bootlin.com>
Date:   Thu May 7 16:41:53 2026 +0200

    crypto: talitos/hash - use descriptor chaining for SEC1 instead of workqueue
    
    commit f1ede6d95d8ad3b32c6a552d2baab805bd00fc38 upstream.
    
    Rework the SEC1 ahash implementation to build a chain of hardware
    descriptors, replacing the previous approach of submitting one
    descriptor at a time via a workqueue, introduced by commit 655ef638a2bc
    ("crypto: talitos - fix SEC1 32k ahash request limitation").
    
    Introduce ahash_process_req_prepare() which iterates over the request
    data, allocating enough descriptors to cover the entire ahash request.
    The new fields (bufsl, src, first, last) are added to talitos_edesc for
    this purpose.
    
    common_nonsnoop_hash() no longer calls talitos_submit(); it only
    maps and sets up the descriptor.  Submission is now done by the caller
    after the chain is built.
    
    ahash_free_desc_list_from() takes over calling
    common_nonsnoop_hash_unmap() for each descriptor during cleanup.
    
    Compared to the workqueue based solution, request are slightly faster
    since there is no more scheduling latency induced by the workqueue, and
    only one interrupt is generated by the device at the end of a chain.
    
    Commit 655ef638a2bc ("crypto: talitos - fix SEC1 32k ahash request
    limitation") :
    
    $ /usr/libexec/libkcapi/sha256sum ./test_5M.bin
    013c5609d63c...  ./test_5M.bin
    real 0m 0.41s
    user 0m 0.01s
    sys  0m 0.07s
    
    Now :
    
    $ /usr/libexec/libkcapi/sha256sum ./test_5M.bin
    013c5609d63c...  ./test_5M.bin
    real 0m 0.33s
    user 0m 0.01s
    sys  0m 0.20s
    
    Tested on a system with an MPC885 SoC featuring the SEC1 Lite.
    
    The increase in sys time is due to the fact that commit 37b5e8897eb5
    ("crypto: talitos - chain in buffered data for ahash on SEC1") can no
    longer be applied.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Paul Louvel <paul.louvel@bootlin.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: tegra - fix refcount leak in tegra_se_host1x_submit() [+ + +]
Author: Wentao Liang <vulab@iscas.ac.cn>
Date:   Thu Jun 4 10:27:06 2026 +0000

    crypto: tegra - fix refcount leak in tegra_se_host1x_submit()
    
    commit 6ea0ce3a19f9c37a014099e2b0a46b27fa164564 upstream.
    
    The timeout error path in tegra_se_host1x_submit() returns without
    calling host1x_job_put(), while all other paths (success, submit
    error, pin error) properly release the job reference through the
    job_put label.  Since host1x_job_alloc() initializes the reference
    count and host1x_job_put() is required to drop it, omitting it on
    timeout causes a permanent refcount leak.
    
    Fix this by redirecting the timeout return to the existing job_put
    label, ensuring the job reference and any associated syncpt
    references are consistently released.
    
    Cc: stable@vger.kernel.org
    Fixes: 0880bb3b00c8 ("crypto: tegra - Add Tegra Security Engine driver")
    Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
    Reviewed-by: Akhil R <akhilrajeev@nvidia.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
debugobjects: Plug race against a concurrent OOM disable [+ + +]
Author: Thomas Gleixner <tglx@kernel.org>
Date:   Sun Jun 21 16:47:44 2026 +0200

    debugobjects: Plug race against a concurrent OOM disable
    
    commit b81dde13cc163450dcb402dcc915ef13ba241e01 upstream.
    
    syzbot reported a puzzling splat:
    
       WARNING: kernel/time/hrtimer.c:443 at stub_timer+0xa/0x20
    
    stub_timer() is installed as timer callback function in
    hrtimer_fixup_assert_init(), which is invoked when
    debug_object_assert_init() can't find a shadow object. In that case debug
    objects emits a warning about it before invoking the fixup.
    
    Though the provided console log lacks this warning and instead has the
    following a few seconds before the splat:
    
         ODEBUG: Out of memory. ODEBUG disabled
    
    So the object was looked up in debug_object_assert_init() and the lookup
    failed due a concurrent out of memory situation which disabled debug
    objects and freed the shadow objects:
    
    debug_object_assert_init()
            if (!debug_objects_enabled)
                    return;                         obj = alloc();
                                                    if (!obj) {
                                                            // Out of memory
                                                            debug_objects_enabled = false;
                                                            free_objects();
            obj = lookup_or_alloc();
    
            // The lookup failed because the other side
            // removed the objects, so this returns
            // an error code as the object in question
            // is not statically initialized
    
            if (!IS_ERR_OR_NULL(obj))
                    return;
            if (!obj) {
                    debug_oom();
                    return;
            }
    
            print(...)
               if (!debug_objects_enabled)
                    return;
    
            fixup(...)
    
    The debug object splat is skipped because debug_objects_enabled is false,
    but the fixup callback is invoked unconditionally, which makes the timer
    disfunctional.
    
    This is only a problem in debug_object_assert_init() and
    debug_object_activate() as both have to handle statically initialized
    objects and therefore must handle the error pointer return case
    gracefully. All other places only handle the found/not found case and the
    NULL pointer return is a signal for OOM. Otherwise they get a valid shadow
    object.
    
    Plug the hole by checking whether debug objects are still enabled before
    invoking the print and fixup function in those two places.
    
    Fixes: b84d435cc228 ("debugobjects: Extend to assert that an object is initialized")
    Reported-by: syzbot+5e8dda76ca21dae314b6@syzkaller.appspotmail.com
    Signed-off-by: Thomas Gleixner <tglx@kernel.org>
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/874iiwlzlb.ffs@fw13
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
dm-ioctl: report an error if a device has no table [+ + +]
Author: Mikulas Patocka <mpatocka@redhat.com>
Date:   Mon May 11 13:04:16 2026 +0200

    dm-ioctl: report an error if a device has no table
    
    commit 457e32348d606a77f9b20e25e989734189834c07 upstream.
    
    When we send a message to a device that has no table, the return code was
    not set. The code would return "2", which is not considered a valid return value.
    
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Cc: stable@vger.kernel.org
    Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
dma-buf/udmabuf: skip redundant cpu sync to fix cacheline EEXIST warning [+ + +]
Author: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Date:   Tue Mar 31 11:16:57 2026 +0500

    dma-buf/udmabuf: skip redundant cpu sync to fix cacheline EEXIST warning
    
    commit 504e2b4ab97a51d56d966cd36d0997ad30b65b2d upstream.
    
    When CONFIG_DMA_API_DEBUG_SG is enabled, importing a udmabuf into a DRM
    driver (e.g. amdgpu for video playback in GNOME Videos / Showtime)
    triggers a spurious warning:
    
      DMA-API: amdgpu 0000:03:00.0: cacheline tracking EEXIST, \
          overlapping mappings aren't supported
      WARNING: kernel/dma/debug.c:619 at add_dma_entry+0x473/0x5f0
    
    The call chain is:
    
      amdgpu_cs_ioctl
       -> amdgpu_ttm_backend_bind
        -> dma_buf_map_attachment
         -> [udmabuf] map_udmabuf -> get_sg_table
          -> dma_map_sgtable(dev, sg, direction, 0)  // attrs=0
           -> debug_dma_map_sg -> add_dma_entry -> EEXIST
    
    This happens because udmabuf builds a per-page scatter-gather list via
    sg_set_folio().  When begin_cpu_udmabuf() has already created an sg
    table mapped for the misc device, and an importer such as amdgpu maps
    the same pages for its own device via map_udmabuf(), the DMA debug
    infrastructure sees two active mappings whose physical addresses share
    cacheline boundaries and warns about the overlap.
    
    The DMA_ATTR_SKIP_CPU_SYNC flag suppresses this check in
    add_dma_entry() because it signals that no CPU cache maintenance is
    performed at map/unmap time, making the cacheline overlap harmless.
    
    All other major dma-buf exporters already pass this flag:
      - drm_gem_map_dma_buf() passes DMA_ATTR_SKIP_CPU_SYNC
      - amdgpu_dma_buf_map() passes DMA_ATTR_SKIP_CPU_SYNC
    
    The CPU sync at map/unmap time is also redundant for udmabuf:
    begin_cpu_udmabuf() and end_cpu_udmabuf() already perform explicit
    cache synchronization via dma_sync_sgtable_for_cpu/device() when CPU
    access is requested through the dma-buf interface.
    
    Pass DMA_ATTR_SKIP_CPU_SYNC to dma_map_sgtable() and
    dma_unmap_sgtable() in udmabuf to suppress the spurious warning and
    skip the redundant sync.
    
    Fixes: 284562e1f348 ("udmabuf: implement begin_cpu_access/end_cpu_access hooks")
    Cc: stable@vger.kernel.org
    Signed-off-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
    Acked-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
    Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
    Link: https://patch.msgid.link/20260331061657.79983-1-mikhail.v.gavrilov@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
EDAC/i10nm: Don't fail probing if ADXL is missing [+ + +]
Author: Vasily Khoruzhick <vasilykh@arista.com>
Date:   Tue Apr 14 11:17:16 2026 -0700

    EDAC/i10nm: Don't fail probing if ADXL is missing
    
    commit e360a6d65bb46c527a5909430a31d640cdd5036e upstream.
    
    ADXL is not present in Coreboot- or Slimbootloader-based BIOSes and as
    result, the driver fails to probe there.
    
    Since commit 2738c69a8813 ("EDAC/i10nm: Add driver decoder for Ice Lake
    and Tremont CPUs"), i10nm_edac supports driver decoder. Switch to driver
    decoding when ADXL is not present.
    
    Signed-off-by: Vasily Khoruzhick <vasilykh@arista.com>
    Signed-off-by: Tony Luck <tony.luck@intel.com>
    Reviewed-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
    Cc: stable@vger.kernel.org # v6.1+
    Link: https://patch.msgid.link/20260414181735.87023-1-anarsoul@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
exfat: bound uniname advance in exfat_find_dir_entry() [+ + +]
Author: Bryam Vargas <hexlabsecurity@proton.me>
Date:   Fri Jun 12 14:29:06 2026 -0500

    exfat: bound uniname advance in exfat_find_dir_entry()
    
    commit 3a1230e7b043c62737b05a3e9275ca83a43ad20a upstream.
    
    In exfat_find_dir_entry(), each TYPE_EXTEND (file name) entry advances the
    output pointer by a fixed amount while the loop guard only tracks the
    accumulated name length:
    
            if (++order == 2)
                    uniname = p_uniname->name;
            else
                    uniname += EXFAT_FILE_NAME_LEN;
            len = exfat_extract_uni_name(ep, entry_uniname);
            name_len += len;
            unichar = *(uniname+len);
            *(uniname+len) = 0x0;
    
    uniname grows by EXFAT_FILE_NAME_LEN (15) per name entry, but name_len
    grows only by the actual extracted length, which is shorter when a name
    fragment contains an early NUL.  The only guard is
    `name_len >= MAX_NAME_LENGTH`, so a crafted directory with many short
    name fragments lets uniname run far past the
    p_uniname->name[MAX_NAME_LENGTH + 3] buffer while name_len stays small,
    causing an out-of-bounds read and write at *(uniname+len).
    
    The sibling extractor exfat_get_uniname_from_ext_entry() already stops
    on a short fragment (the lockstep `len != EXFAT_FILE_NAME_LEN` guard
    added in commit d42334578eba ("exfat: check if filename entries exceeds
    max filename length")); exfat_find_dir_entry() never got the
    equivalent.  Track the per-entry write offset as a count and reject a
    fragment once the offset, or the offset plus the extracted length, would
    exceed MAX_NAME_LENGTH, before forming the output pointer.
    
    Fixes: ca06197382bd ("exfat: add directory operations")
    Cc: stable@vger.kernel.org
    Suggested-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>
    Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

exfat: preserve benign secondary entries during rename and move [+ + +]
Author: Rochan Avlur <rochan.avlur@gmail.com>
Date:   Thu May 28 07:21:37 2026 -0700

    exfat: preserve benign secondary entries during rename and move
    
    commit 942296784b2a9439651750c42f540bf2579b330f upstream.
    
    Commit 8258ef28001a ("exfat: handle unreconized benign secondary
    entries") added cluster freeing for benign secondary entries inside
    exfat_remove_entries().  However, exfat_remove_entries() is also called
    from the rename and move paths (exfat_rename_file and exfat_move_file),
    where the old entry set is being relocated rather than deleted.  This
    causes benign secondary entries such as vendor extension entries to be
    silently destroyed on rename or cross-directory move, violating the
    exFAT spec requirement (section 8.2) that implementations preserve
    unrecognized benign secondary entries.
    
    Fix this by adding a free_benign parameter to exfat_remove_entries()
    so callers can suppress cluster freeing during relocation, and
    extending exfat_init_ext_entry() to copy trailing benign secondary
    entries from the old entry set into the new one internally.  Also
    clean up the error paths to delete newly allocated entries on failure.
    
    Fixes: 8258ef28001a ("exfat: handle unreconized benign secondary entries")
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/linux-fsdevel/CAG7tbBV--waov7XVu2FHQEc6paR92dufS=em9DW5Kzsrpu3iQg@mail.gmail.com/
    Signed-off-by: Rochan Avlur <rochan.avlur@gmail.com>
    Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
    Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
firmware_loader: fix device reference leak in firmware_upload_register() [+ + +]
Author: Guangshuo Li <lgs201920130244@gmail.com>
Date:   Tue May 5 17:12:31 2026 +0800

    firmware_loader: fix device reference leak in firmware_upload_register()
    
    commit 896df22ee57648b0c505bd76ddbc6b2341834696 upstream.
    
    firmware_upload_register()
      -> fw_create_instance()
         -> device_initialize()
    
    After fw_create_instance() succeeds, the lifetime of the embedded struct
    device is expected to be managed through the device core reference
    counting, since fw_create_instance() has already called
    device_initialize().
    
    In firmware_upload_register(), if alloc_lookup_fw_priv() fails after
    fw_create_instance() succeeds, the code reaches free_fw_sysfs and frees
    fw_sysfs directly instead of releasing the device reference with
    put_device(). This may leave the reference count of the embedded struct
    device unbalanced, resulting in a refcount leak.
    
    The issue was identified by a static analysis tool I developed and
    confirmed by manual review. Fix this by using put_device(fw_dev) in the
    failure path and letting fw_dev_release() handle the final cleanup,
    instead of freeing the instance directly from the error path.
    
    Fixes: 97730bbb242c ("firmware_loader: Add firmware-upload support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
    Link: https://patch.msgid.link/20260505091231.607089-1-lgs201920130244@gmail.com
    Signed-off-by: Danilo Krummrich <dakr@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
fpga: dfl-afu: validate DMA mapping length in afu_dma_map_region() [+ + +]
Author: Sebastian Alba Vives <sebasjosue84@gmail.com>
Date:   Mon May 18 13:07:41 2026 -0600

    fpga: dfl-afu: validate DMA mapping length in afu_dma_map_region()
    
    commit fc3b071a7c8dc0f5d56defddf6e6fd5aaa3e1e27 upstream.
    
    afu_ioctl_dma_map() accepts a 64-bit length from userspace via
    DFL_FPGA_PORT_DMA_MAP ioctl without an upper bound check. The value
    is passed to afu_dma_pin_pages() where npages is derived as
    length >> PAGE_SHIFT and passed to pin_user_pages_fast() which takes
    int nr_pages, causing implicit truncation if length is very large.
    
    Validate map.length at the ioctl entry point before calling
    afu_dma_map_region(), rejecting values whose page count exceeds
    INT_MAX.
    
    Fixes: fa8dda1edef9 ("fpga: dfl: afu: add DFL_FPGA_PORT_DMA_MAP/UNMAP ioctls support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Sebastian Alba Vives <sebasjosue84@gmail.com>
    Reviewed-by: Xu Yilun <yilun.xu@intel.com>
    Link: https://lore.kernel.org/r/20260518190742.61426-3-sebasjosue84@gmail.com
    Signed-off-by: Xu Yilun <yilun.xu@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
fs/ntfs3: validate Dirty Page Table capacity in log_replay copy_lcns [+ + +]
Author: Yunpeng Tian <shionthanatos@gmail.com>
Date:   Mon May 4 07:19:43 2026 -0700

    fs/ntfs3: validate Dirty Page Table capacity in log_replay copy_lcns
    
    commit 57382ec6ac63b63dce2789e835fded28b698ae79 upstream.
    
    In the analysis pass of $LogFile journal replay, log_replay() copies
    LCNs from each action log record into an existing Dirty Page Table
    (DPT) entry without bounding the destination index. A crafted NTFS
    image with DPT entry lcns_follow=1 and an action log record with
    lcns_follow=2 produces a kernel slab out-of-bounds write at mount
    time:
    
      BUG: KASAN: slab-out-of-bounds in log_replay+0x654c/0xdb60
      Write of size 8 at addr ffff8880095e1040 by task mount
    
    Two attacker-controlled fields can drive j+i past the allocated
    page_lcns[] array:
    
      1. dp->lcns_follow (capacity) can be smaller than lrh->lcns_follow.
      2. lrh->target_vcn may be smaller than dp->vcn, making the u64
         subtraction wrap to a huge size_t.
    
    Validate target VCN delta and per-record LCN count against the
    DPT entry capacity, bail via the existing out: cleanup label with
    -EINVAL.
    
    This mirrors the bounds-check pattern added in commit b2bc7c44ed17
    ("fs/ntfs3: Fix slab-out-of-bounds read in DeleteIndexEntryRoot")
    and commit 0ca0485e4b2e ("fs/ntfs3: validate rec->used in
    journal-replay file record check").
    
    Fixes: b46acd6a6a62 ("fs/ntfs3: Add NTFS journal")
    Reported-by: Yunpeng Tian <shionthanatos@gmail.com>
    Reported-by: Mingda Zhang <npczmd@qq.com>
    Reported-by: Gongming Wang <gmwgg05@gmail.com>
    Reported-by: Peiyuan Xu <paulbucket12@gmail.com>
    Reported-by: Qinrun Dai <jupmouse@gmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Yunpeng Tian <shionthanatos@gmail.com>
    Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
fuse-uring: Avoid queue->stopped races and set/read that value under lock [+ + +]
Author: Bernd Schubert <bernd@bsbernd.com>
Date:   Mon Jun 8 23:03:44 2026 +0200

    fuse-uring: Avoid queue->stopped races and set/read that value under lock
    
    commit b70a3aca16934c196f92abb17b01c1647b9bb63c upstream.
    
    There are several readers of queue->stopped that check the value
    under lock, but fuse_uring_commit_fetch() did not and actually
    the value was not set under the lock in fuse_uring_abort_end_requests()
    either. Especially in fuse_uring_commit_fetch it is important
    to check under a lock, because due to races 'struct fuse_req'
    might be freed with fuse_request_end, but another thread/cpu
    might already do teardown work.
    
    Cc: stable@kernel.org # 6.14
    Fixes: 4a9bfb9b6850fec ("fuse: {io-uring} Handle teardown of ring entries")
    Reported-by: Berkant Koc <me@berkoc.com>
    Reported-by: xlabai <xlabai@tencent.com>
    Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
    Reviewed-by: Joanne Koong <joannelkoong@gmail.com>
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

fuse-uring: Avoid use-after-free in fuse_uring_async_stop_queues [+ + +]
Author: Bernd Schubert <bernd@bsbernd.com>
Date:   Mon Jun 8 23:03:43 2026 +0200

    fuse-uring: Avoid use-after-free in fuse_uring_async_stop_queues
    
    commit d351da75066955144515cb2f9aa959f24a04287a upstream.
    
    fuse_uring_async_stop_queues() might run when the last reference
    on ring->queue_refs was already dropped.
    
    In order to avoid an early destruction a reference on struct fuse_conn
    is now taken before starting fuse_uring_async_stop_queues() and that
    reference is only released when that delayed work queue terminates.
    
    Fixes: 4a9bfb9b6850 ("fuse: {io-uring} Handle teardown of ring entries")
    Cc: stable@kernel.org # 6.14
    Reported-by: Berkant Koc <me@berkoc.com>
    Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
    Reviewed-by: Joanne Koong <joannelkoong@gmail.com>
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

fuse-uring: end fuse_req on io-uring cancel task work [+ + +]
Author: Chris Mason <clm@meta.com>
Date:   Mon Jun 8 17:28:55 2026 -0700

    fuse-uring: end fuse_req on io-uring cancel task work
    
    commit bea4fe98204b6ce7eb8e29f7bf867dd7619b3ddd upstream.
    
    When io_uring delivers task work with tw.cancel set (PF_EXITING,
    PF_KTHREAD fallback, or percpu_ref_is_dying on the ring context),
    fuse_uring_send_in_task() takes the cancel branch, assigns
    -ECANCELED, and falls through to fuse_uring_send(). That path only
    flips the entry to FRRS_USERSPACE and completes the io_uring cmd;
    it never discharges the ring entry's owning reference to the
    fuse_req that fuse_uring_add_req_to_ring_ent() handed it at
    dispatch time.
    
        fuse_uring_send_in_task()
          tw.cancel == true
            err = -ECANCELED
          fuse_uring_send(ent, cmd, err, issue_flags)
            ent->state = FRRS_USERSPACE
            list_move(&ent->list, &queue->ent_in_userspace)
            ent->cmd = NULL
            io_uring_cmd_done(-ECANCELED)
            /* ent->fuse_req still set, req still hashed */
    
    The fuse_req stays linked on fpq->processing[hash] and
    fuse_request_end() is never invoked. The originating syscall
    thread blocks in D-state in request_wait_answer() until
    fuse_abort_conn() runs, which can be the entire connection
    lifetime. For FR_BACKGROUND requests fc->num_background is never
    decremented either, so repeated cancels inflate the counter until
    max_background is hit and all later background ops stall. tw.cancel does
    not imply a connection abort (e.g. a single io_uring worker thread exits
    while the fuse connection stays up), so this cannot be left for
    fuse_abort_conn() to clean up.
    
    Ending the req but still routing the entry through fuse_uring_send()
    is not enough: that leaves a req-less entry on ent_in_userspace, and
    ent_list_request_expired() dereferences ent->fuse_req unconditionally
    on the head of that list, which would then NULL-deref.
    
    Fix the cancel branch to release the entry directly. Remove it from the
    queue, complete the io_uring cmd, end the fuse_req, free the entry, and
    drop its queue_refs (waking the teardown waiter if it was the last).
    
    Fixes: c2c9af9a0b13 ("fuse: Allow to queue fg requests through io-uring")
    Cc: stable@vger.kernel.org
    Reviewed-by: Joanne Koong <joannelkoong@gmail.com>
    Assisted-by: kres (claude-opus-4-7)
    Signed-off-by: Chris Mason <clm@meta.com>
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

fuse-uring: fix data races on ring->ready [+ + +]
Author: Chris Mason <clm@meta.com>
Date:   Fri Jun 5 12:27:07 2026 -0700

    fuse-uring: fix data races on ring->ready
    
    commit 46725a0056c884cf58a6897f222892807327d82d upstream.
    
    On weakly-ordered architectures, the store to fiq->ops can be
    reordered past the store to ring->ready, allowing a CPU that sees
    ring->ready == true via fuse_uring_ready() to dispatch requests
    through a stale fiq->ops pointer. Upgrade the store to
    smp_store_release() and the load in fuse_uring_ready() to
    smp_load_acquire() so that the preceding WRITE_ONCE(fiq->ops, ...)
    is visible to any CPU that observes ring->ready == true.
    
    Additionally, fuse_uring_do_register() publishes ring->ready with
    WRITE_ONCE() but the fast-path check reads it with a plain load.
    This is a marked-vs-unmarked access that KCSAN will flag. Wrap it in
    READ_ONCE() to mark it without adding unnecessary ordering.
    
    Also wrap the fc->ring load in fuse_uring_ready() in READ_ONCE() to
    prevent the compiler from reloading it between the NULL check and the
    dereference.
    
    Fixes: c2c9af9a0b13 ("fuse: Allow to queue fg requests through io-uring")
    Cc: stable@vger.kernel.org
    Reviewed-by: Joanne Koong <joannelkoong@gmail.com>
    Assisted-by: kres (claude-opus-4-7)
    Signed-off-by: Chris Mason <clm@meta.com>
    Reviewed-by: Bernd Schubert <bernd@bsbernd.com>
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

fuse-uring: fix EFAULT clobber in fuse_uring_commit [+ + +]
Author: Chris Mason <clm@meta.com>
Date:   Fri Jun 5 12:27:06 2026 -0700

    fuse-uring: fix EFAULT clobber in fuse_uring_commit
    
    commit 3a0a8bc51a13951c5141262bf770eeea3e0b6228 upstream.
    
    copy_from_user() returns the number of bytes not copied as an unsigned
    residual on failure (1..sizeof(struct fuse_out_header)). fuse_uring_commit
    stores that residual in ssize_t err, sets req->out.h.error to -EFAULT,
    then jumps to out: with err still holding the positive residual.
    
        err = copy_from_user(&req->out.h, &ent->headers->in_out,
                             sizeof(req->out.h));
        if (err) {
            req->out.h.error = -EFAULT;
            goto out;          /* err is the positive residual */
        }
        ...
        out:
            fuse_uring_req_end(ent, req, err);
    
    fuse_uring_req_end() then runs
    
        if (error)
            req->out.h.error = error;
    
    which overwrites the just-assigned -EFAULT with the positive residual.
    FUSE callers such as fuse_simple_request() test err < 0 to detect
    failure, so the positive value is interpreted as success and the
    caller proceeds with an uninitialised or partial req->out.args.
    
    Fix by assigning err = -EFAULT in the failure branch before jumping
    to out, so fuse_uring_req_end() receives a negative errno and sets
    req->out.h.error to -EFAULT.
    
    Fixes: c090c8abae4b ("fuse: Add io-uring sqe commit and fetch support")
    Cc: stable@vger.kernel.org
    Reviewed-by: Joanne Koong <joannelkoong@gmail.com>
    Assisted-by: kres (claude-opus-4-7)
    Signed-off-by: Chris Mason <clm@meta.com>
    Reviewed-by: Bernd Schubert <bernd@bsbernd.com>
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

fuse-uring: fix moving cancelled entry to ent_in_userspace list [+ + +]
Author: Joanne Koong <joannelkoong@gmail.com>
Date:   Mon Jun 8 12:21:49 2026 -0700

    fuse-uring: fix moving cancelled entry to ent_in_userspace list
    
    commit 198f45eeb9f78b2a2d6d8be95e4e43468eb2c6bc upstream.
    
    fuse_uring_cancel() moves entries that are available (these have no reqs
    attached) to the ent_in_userspace list. ent_list_request_expired()
    checks the first entry on ent_in_userspace and dereferences
    ent->fuse_req unconditionally, which will crash on a cancelled entry
    that was moved to this list.
    
    Fix this by freeing the entry and dropping queue_refs directly in
    fuse_uring_cancel(). This is safe because cancel is the cancel handler
    itself - after io_uring_cmd_done(), no more cancels will be dispatched
    for this command, and teardown serializes with cancel via queue->lock.
    
    Since cancel now decrements queue_refs, fuse_uring_abort() must no
    longer gate fuse_uring_abort_end_requests() on queue_refs > 0, as
    cancelled entries may have already dropped queue_refs while requests are
    still queued. Remove the gate so abort always flushes requests and stops
    queues.
    
    Reported-by: Heechan Kang <gganji11@naver.com>
    Tested-by: Heechan Kang <gganji11@naver.com>
    Reviewed-by: Bernd Schubert <bernd@bsbernd.com>
    Fixes: 4fea593e625c ("fuse: optimize over-io-uring request expiration check")
    Cc: stable@vger.kernel.org
    Suggested-by: Jian Huang Li <ali@ddn.com>
    Suggested-by: Horst Birthelmer <horst@birthelmer.de>
    Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

fuse-uring: make a fuse_req on SQE commit only findable after memcpy [+ + +]
Author: Bernd Schubert <bernd@bsbernd.com>
Date:   Mon Jun 8 23:03:45 2026 +0200

    fuse-uring: make a fuse_req on SQE commit only findable after memcpy
    
    commit 1efd3d474fc0ba74dfd984249bca78807d739812 upstream.
    
    Bad userspace might try to trick us and send commit SQEs request
    unique / commit-id of requests that are not even send to
    fuse-server (io_uring_cmd_done() not called) yet.
    
    fuse_uring_commit_fetch() ends the fuse request when the ring entry
    has a wrong state, but that could have caused a use-after-free
    with the memcpy operations in fuse_uring_send_in_task().
    In order to avoid such races the call of fuse_uring_add_to_pq()
    is moved after the copy operations and just before completing
    the io-uring request - malicious userspace cannot find the request
    anymore until all prepration work in fuse-client/kernel is completed.
    
    This also moves fuse_uring_add_to_pq() a bit up in the code to
    avoid a forward declaration. Also not with a preparation commit,
    to make it easier to back port to older kernels.
    
    Reported-by: xlabai <xlabai@tencent.com>
    Reported-by: Berkant Koc <me@berkoc.com>
    Fixes: c090c8abae4b6b ("fuse: Add io-uring sqe commit and fetch support")
    Cc: stable@kernel.org # 6.14
    Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
    Reviewed-by: Joanne Koong <joannelkoong@gmail.com>
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

fuse-uring: remove request-less entries from ent_w_req_queue to fix NULL deref [+ + +]
Author: Joanne Koong <joannelkoong@gmail.com>
Date:   Tue Jun 9 14:36:58 2026 -0700

    fuse-uring: remove request-less entries from ent_w_req_queue to fix NULL deref
    
    commit 1c57a69be962d459c5e705f5cb4355b841b3461c upstream.
    
    If a copy into the userspace ring buffer fails, a request will be
    terminated and fuse_uring_req_end() will set ent->fuse_req to NULL but
    it will leave the entry on ent_w_req_queue in FRRS_FUSE_REQ state. This
    can lead to a NULL deref if the request expiration logic scans
    ent_w_req_queue in the window before the entry is moved off it.
    
    Fix this by taking the entry off ent_w_req_queue and changing its state
    from FRRS_FUSE_REQ to FRRS_INVALID before terminating the request.
    
    Fixes: 4fea593e625c ("fuse: optimize over-io-uring request expiration check")
    Cc: stable@kernel.org
    Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
fuse: avoid 32-bit prune notification count wrap [+ + +]
Author: Samuel Moelius <sam.moelius@trailofbits.com>
Date:   Wed Jun 10 00:37:18 2026 +0000

    fuse: avoid 32-bit prune notification count wrap
    
    commit 54243797cedf55447b4c5d560e8cd709900061ae upstream.
    
    FUSE_NOTIFY_PRUNE validates the nodeid payload length with:
    
        size - sizeof(outarg) != outarg.count * sizeof(u64)
    
    On 32-bit kernels, size_t is also 32 bits, so the daemon-controlled
    count multiplication can wrap.  A prune notification with count
    0x20000000 and no nodeid payload passes the check, enters the copy
    loop, and asks the device copy path to read nodeids that are not
    present in the userspace write buffer.  In QEMU this reaches the
    fuse_copy_fill() BUG_ON(!err) path.
    
    Validate the payload length with array_size() instead.  That accepts
    exactly the same valid messages, but avoids wrapping arithmetic before
    the copy loop consumes the count.
    
    Assisted-by: Codex:gpt-5.5-cyber-preview
    Fixes: 3f29d59e92a9 ("fuse: add prune notification")
    Cc: stable@vger.kernel.org
    Signed-off-by: Samuel Moelius <sam.moelius@trailofbits.com>
    Reviewed-by: Joanne Koong <joannelkoong@gmail.com>
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

fuse: back uncached readdir buffers with pages [+ + +]
Author: Matthew R. Ochs <mochs@nvidia.com>
Date:   Tue May 26 08:20:21 2026 -0700

    fuse: back uncached readdir buffers with pages
    
    commit 4dd6f6d3085a84e74b0a1efec3a05ed0b5125dce upstream.
    
    Commit dabb90391028 ("fuse: increase readdir buffer size") changed
    fuse_readdir_uncached() to size its temporary buffer from ctx->count.
    This is useful for overlayfs and other in-kernel callers that use
    INT_MAX to indicate an unlimited directory read.
    
    The larger buffer is currently supplied as a kvec output argument. For
    virtiofs, kvec arguments are copied through req->argbuf, which is
    allocated with kmalloc(..., GFP_ATOMIC). A large uncached readdir buffer
    can therefore require a multi-megabyte contiguous atomic allocation
    before the request is queued.
    
    Avoid the large bounce-buffer allocation by backing uncached readdir
    output with pages and setting out_pages. Transports such as virtiofs can
    then pass the pages as scatter-gather entries instead of copying the
    output through argbuf.
    
    Map the pages with vm_map_ram() only while parsing the returned dirents.
    The existing parser can then continue to use a linear kernel mapping.
    
    [SzM: separate allocation of pages into a helper function]
    
    Fixes: dabb90391028 ("fuse: increase readdir buffer size")
    Cc: stable@vger.kernel.org
    Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

fuse: clear intr_entry in fuse_resend and fuse_remove_pending_req [+ + +]
Author: Ji'an Zhou <eilaimemedsnaimel@gmail.com>
Date:   Tue Jun 9 09:58:51 2026 +0000

    fuse: clear intr_entry in fuse_resend and fuse_remove_pending_req
    
    commit f8fce75fedf73ac72aa09163deb8f4291fdcaad2 upstream.
    
    When fuse_resend() moves a request from fpq->processing back to
    fiq->pending, it sets FR_PENDING and clears FR_SENT but does not
    remove the requests intr_entry from fiq->interrupts.  If the
    request had FR_INTERRUPTED set from a prior signal, intr_entry
    remains dangling on fiq->interrupts.  When the requesting task
    then receives a fatal signal, fuse_remove_pending_req() sees
    FR_PENDING=1, removes the request from fiq->pending and frees it
    via the refcount path, also without cleaning intr_entry.  The
    stale intr_entry causes use-after-free when fuse_read_interrupt()
    iterates fiq->interrupts:
      - list_del_init(&req->intr_entry) -> UAF write on freed slab
      - req->in.h.unique -> UAF read, data leaked to userspace
    
    Remove intr_entry from fiq->interrupts in fuse_resend() for
    interrupted requests before they are placed back on fiq->pending.
    
    Add a WARN_ON if the intr_entry is not empty on request destruction.
    
    Fixes: 760eac73f9f6 ("fuse: Introduce a new notification type for resend pending requests")
    Cc: stable@vger.kernel.org # 6.9
    Signed-off-by: Ji'an Zhou <eilaimemedsnaimel@gmail.com>
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

fuse: do not use start_removing_noperm() [+ + +]
Author: Miklos Szeredi <mszeredi@redhat.com>
Date:   Wed Jun 10 13:02:53 2026 +0200

    fuse: do not use start_removing_noperm()
    
    commit 6e1b235627bb1172d27c1b2ea7bf53e67dbced8d upstream.
    
    Revert the fuse part of commit c9ba789dad15 ("VFS: introduce
    start_creating_noperm() and start_removing_noperm()").
    
    Commit c9ba789dad15 ("VFS: introduce start_creating_noperm() and
    start_removing_noperm()") caused a regression in FUSE_NOTIFY_INVAL_ENTRY,
    which failed to invalidate negative dentries.
    
    This manifests in the filesystem returning -ENOENT for operations on an
    existing file.
    
    Fixing it properly while still keeping the start_removing* infrastructure
    would add much additional complexity.
    
    Instead revert to the original simple implementation.
    
    The start_removing* infrastructure is needed in VFS to abstract the
    filesystem locking.  However filesystem code can still safely use the raw
    locking primitives without affacting other filesystems.
    
    This is part two of the revert.
    
    Reported-by: Артем Лабазов <123321artyom@gmail.com>
    Closes: https://lore.kernel.org/all/CAFbF8N7++zopZuEcsKRxBV_sgOGCbzCY0hOyMw1SiGAtuzGhyQ@mail.gmail.com/
    Fixes: c9ba789dad15 ("VFS: introduce start_creating_noperm() and start_removing_noperm()")
    Cc: stable@vger.kernel.org # 6.19
    Cc: NeilBrown <neilb@ownmail.net>
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

fuse: don't block in fuse_get_dev() for non-sync_init case [+ + +]
Author: Joanne Koong <joannelkoong@gmail.com>
Date:   Wed Apr 22 09:31:23 2026 -0700

    fuse: don't block in fuse_get_dev() for non-sync_init case
    
    commit 9f6f44aa5a58aaae0838126dc09460c3e1f56ccb upstream.
    
    Commit a8dd5f1b73bc ("fuse: create fuse_dev on /dev/fuse open instead of
    mount") changed behavior so that fuse_get_dev() now unconditionally
    blocks waiting for a connection, even in the case where sync_init was
    not set. Previously, non-sync_init opens returned -EPERM immediately.
    
    Restore the previous behavior of returning -EPERM.
    
    Fixes: a8dd5f1b73bc ("fuse: create fuse_dev on /dev/fuse open instead of mount")
    Reported-by: Mark Brown <broonie@kernel.org>
    Closes: https://lore.kernel.org/all/3c9f8396-41f4-4c88-b883-34bede72b427@sirena.org.uk/
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
    Tested-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

fuse: fix device node leak in cuse_process_init_reply() [+ + +]
Author: Alberto Ruiz <aruiz@redhat.com>
Date:   Wed Apr 8 17:23:40 2026 +0200

    fuse: fix device node leak in cuse_process_init_reply()
    
    commit 9fa4f7a53406430ee9982f2f636a15b338185122 upstream.
    
    If device_add() succeeds during CUSE initialization but a subsequent
    step (cdev_alloc() or cdev_add()) fails, the error path calls
    put_device() without first calling device_del().  This leaks the
    devtmpfs entry created by device_add(), leaving a stale /dev/<name>
    node that persists until reboot.
    
    Since the cuse_conn is never linked into cuse_conntbl on the failure
    path, cuse_channel_release() sees cc->dev == NULL and skips
    device_unregister(), so no other code path cleans up the node.
    
    This has several consequences:
    
     - The device name is permanently poisoned: any subsequent attempt to
       create a CUSE device with the same name hits the stale sysfs entry,
       device_add() fails, and the new device is aborted.
    
     - The collision manifests as ENODEV returned to userspace with no
       dmesg diagnostic, making it very difficult to debug.
    
     - The failure is self-perpetuating: once a name is leaked, all future
       attempts with that name fail identically.
    
    Fix this by introducing an err_dev label that calls device_del() to
    undo device_add() before falling through to err_unlock.  The existing
    err_unlock path from a device_add() failure correctly skips device_del()
    since the device was never added.
    
    Testing instructions can be found at the lore link below.
    
    Link: https://lore.kernel.org/all/20260408-wip-cuse-leak-fix-v1-0-1c028d575e97@redhat.com/
    Signed-off-by: Alberto Ruiz <aruiz@redhat.com>
    Fixes: 151060ac1314 ("CUSE: implement CUSE - Character device in Userspace")
    Cc: stable@vger.kernel.org
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

fuse: fix io-uring background queue dispatch on request completion [+ + +]
Author: Joanne Koong <joannelkoong@gmail.com>
Date:   Wed Apr 8 10:25:10 2026 -0700

    fuse: fix io-uring background queue dispatch on request completion
    
    commit 31da059891bd3be9c6e59280b8e1777ead90db34 upstream.
    
    When a background request completes via the io_uring path, the
    background queue gets flushed to dispatch pending background requests,
    but this is done before the connection-level background counters
    (fc->num_background, fc->active_background) are properly accounted,
    which may reduce effective queue depth to one.
    
    The connection-level counters are decremented in fuse_request_end(), but
    flush_bg_queue() flushes the /dev/fuse path queue (fc->bg_queue), not
    the io_uring per-queue bg one, which means pending uring background
    requests on the queue are never dispatched in this path.
    
    Fix this by accounting the connection-level background counters first
    before flushing the queue's background queue. Since
    fuse_request_bg_finish() clears FR_BACKGROUND, fuse_request_end() will
    skip the background cleanup branch entirely, which avoids any
    double-decrements; it will call the wake_up(&req->waitq) branch but this
    is effectively a no-op as background requests have no waiters on
    req->waitq.
    
    Reviewed-by: Bernd Schubert <bernd@bsbernd.com>
    Fixes: 857b0263f30e ("fuse: Allow to queue bg requests through io-uring")
    Cc: stable@vger.kernel.org
    Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

fuse: re-lock request before returning from fuse_ref_folio() [+ + +]
Author: Joanne Koong <joannelkoong@gmail.com>
Date:   Mon May 18 22:28:07 2026 -0700

    fuse: re-lock request before returning from fuse_ref_folio()
    
    commit b5befa80fdbe287a98480effed9564712924add5 upstream.
    
    fuse_ref_folio() unlocks the request but does not re-lock it before
    returning. fuse_chan_abort() can end the request and the async end
    callback (eg fuse_writepage_free()) can free the args while the
    subsequent copy chain logic after fuse_ref_folio() accesses them,
    leading to use-after-free issues.
    
    Fix this by locking the request in fuse_ref_folio() before returning.
    
    Fixes: c3021629a0d8 ("fuse: support splice() reading from fuse device")
    Cc: stable@vger.kernel.org
    Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
futex/requeue: Revert "Prevent NULL pointer dereference in remove_waiter() on self-deadlock"" [+ + +]
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date:   Wed Jul 1 15:11:50 2026 +0200

    futex/requeue: Revert "Prevent NULL pointer dereference in remove_waiter() on self-deadlock""
    
    commit 39def6d250d370298f86c116f4ac60093cefadaa upstream.
    
    The commit cited below should not have been merged. It attemted to fix an
    existing problem ansd thereby introduced new problems by keeping the
    pi_state in state Q_REQUEUE_PI_IN_PROGRESS and leaking it.
    
    Based on the commit description the intention was to handle the case
    when task_blocks_on_rt_mutex() returns -EDEADLK and the following
    remove_waiter() dereferences the NULL pointer in waiter->task.
    
    That is already handled by Davidlohr in commit 40a25d59e85b3
    ("locking/rtmutex: Skip remove_waiter() when waiter is not enqueued") and
    requires no further acting.
    
    Revert the commit breaking the "waiter == owner" case again.
    
    Fixes: 74e144274af39 ("futex/requeue: Prevent NULL pointer dereference in remove_waiter() on self-deadlock")
    Reported-by: Michael Bommarito <michael.bommarito@gmail.com>
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Signed-off-by: Thomas Gleixner <tglx@kernel.org>
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20260701131150.0Ijhq4Dw@linutronix.de
    Closes: https://lore.kernel.org/all/20260629020049.2082397-1-michael.bommarito@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
gpio: eic-sprd: use raw_spinlock_t in the irq startup path [+ + +]
Author: Runyu Xiao <runyu.xiao@seu.edu.cn>
Date:   Wed Jun 17 23:40:35 2026 +0800

    gpio: eic-sprd: use raw_spinlock_t in the irq startup path
    
    commit 90f0109019e6817eb40a486671b7722d1544ae29 upstream.
    
    sprd_eic_irq_unmask() enables the GPIO IRQ and then updates controller
    state through sprd_eic_update(), which takes sprd_eic->lock with
    spin_lock_irqsave().  The callback can be reached from irq_startup()
    while setting up a requested IRQ.  That path is not sleepable, but on
    PREEMPT_RT a regular spinlock_t becomes a sleeping lock.
    
    This issue was found by our static analysis tool and then manually
    reviewed against the current tree.
    
    The grounded PoC kept the request_threaded_irq() -> __setup_irq() ->
    irq_startup() -> sprd_eic_irq_unmask() -> sprd_eic_update() carrier and
    used the original spin_lock_irqsave(&sprd_eic->lock) edge.  Lockdep
    reported:
    
      BUG: sleeping function called from invalid context
      hardirqs last disabled at ... __setup_irq.constprop.0 ... [vuln_msv]
      sprd_rt_spin_lock_irqsave+0x1c/0x30 [vuln_msv]
      sprd_eic_update.constprop.0+0x48/0x90 [vuln_msv]
      sprd_eic_irq_unmask.constprop.0+0x35/0x50 [vuln_msv]
      __setup_irq.constprop.0+0xd/0x30 [vuln_msv]
    
    Convert the Spreadtrum EIC controller lock to raw_spinlock_t.  The
    locked section only serializes MMIO register updates and does not contain
    sleepable operations, so keeping it non-sleeping is appropriate for the
    irqchip callbacks.
    
    Fixes: 25518e024e3a ("gpio: Add Spreadtrum EIC driver support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
    Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Link: https://patch.msgid.link/20260617154035.1199948-3-runyu.xiao@seu.edu.cn
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

gpio: sch: use raw_spinlock_t in the irq startup path [+ + +]
Author: Runyu Xiao <runyu.xiao@seu.edu.cn>
Date:   Wed Jun 17 23:40:34 2026 +0800

    gpio: sch: use raw_spinlock_t in the irq startup path
    
    commit 286533cb14a3c8a8bd39ff64ea2fc8e1aa0f638b upstream.
    
    sch_irq_unmask() enables the GPIO IRQ and then updates the controller
    state through sch_irq_mask_unmask(), which takes sch->lock with
    spin_lock_irqsave().  The callback can be reached from irq_startup()
    while setting up a requested IRQ.  That path is not sleepable, but on
    PREEMPT_RT a regular spinlock_t becomes a sleeping lock.
    
    This issue was found by our static analysis tool and then manually
    reviewed against the current tree.
    
    The grounded PoC kept the request_threaded_irq() -> __setup_irq() ->
    irq_startup() -> sch_irq_unmask() -> sch_irq_mask_unmask() carrier and
    used the original spin_lock_irqsave(&sch->lock) edge.  Lockdep reported:
    
      BUG: sleeping function called from invalid context
      hardirqs last disabled at ... __setup_irq.constprop.0 ... [vuln_msv]
      sch_rt_spin_lock_irqsave+0x1c/0x30 [vuln_msv]
      sch_irq_mask_unmask.constprop.0+0x31/0x70 [vuln_msv]
      __setup_irq.constprop.0+0xd/0x30 [vuln_msv]
    
    Convert the SCH controller lock to raw_spinlock_t.  The same lock is
    also used by the GPIO direction and value callbacks, but those critical
    sections only update MMIO-backed GPIO registers and do not 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.
    
    Fixes: 7a81638485c1 ("gpio: sch: Add edge event support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
    Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
    Link: https://patch.msgid.link/20260617154035.1199948-2-runyu.xiao@seu.edu.cn
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
hfs/hfsplus: fix u32 overflow in check_and_correct_requested_length [+ + +]
Author: Tristan Madani <tristan@talencesecurity.com>
Date:   Tue May 5 11:12:58 2026 +0000

    hfs/hfsplus: fix u32 overflow in check_and_correct_requested_length
    
    commit 966cb76fb2857a4242cab6ea2ea17acf818a3da7 upstream.
    
    check_and_correct_requested_length() compares (off + len) against
    node_size using u32 arithmetic.  When the caller passes a large len
    value (e.g. from an underflowed subtraction in hfs_brec_remove()),
    off + len can wrap past 2^32 and produce a small result, causing the
    bounds check to pass when it should fail.
    
    For example, with off=14 and len=0xFFFFFFF2 (underflowed from
    data_off - keyoffset - size in hfs_brec_remove), off + len wraps to 6,
    which is less than a typical node_size of 512, so the check passes and
    the subsequent memmove reads ~4GB past the node buffer.
    
    Fix this by widening the addition to u64 before comparing against
    node_size.  This prevents the u32 wrap while keeping the logic
    straightforward.
    
    Reported-by: syzbot+6df204b70bf3261691c5@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=6df204b70bf3261691c5
    Tested-by: syzbot+6df204b70bf3261691c5@syzkaller.appspotmail.com
    Reported-by: syzbot+e76bf3d19b85350571ac@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=e76bf3d19b85350571ac
    Tested-by: syzbot+e76bf3d19b85350571ac@syzkaller.appspotmail.com
    Fixes: a431930c9bac ("hfs: fix slab-out-of-bounds in hfs_bnode_read()")
    Cc: stable@vger.kernel.org
    Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
    Reviewed-by: Viacheslav Dubeyko <slava@dubeyko.com>
    Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
    Link: https://lore.kernel.org/r/20260505111300.3592757-2-tristmd@gmail.com
    Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

hfs/hfsplus: zero-initialize buffer in hfs_bnode_read [+ + +]
Author: Tristan Madani <tristan@talencesecurity.com>
Date:   Tue May 5 11:12:59 2026 +0000

    hfs/hfsplus: zero-initialize buffer in hfs_bnode_read
    
    commit d67aadee19ffdf3cc8520c5a4f4d5b2916d30baf upstream.
    
    hfs_bnode_read() can return early without writing to the output buffer
    when is_bnode_offset_valid() fails or when check_and_correct_requested_
    length() corrects the length to zero.  Callers such as hfs_bnode_read_
    u16() and hfs_bnode_read_u8() pass stack-allocated buffers and use the
    result unconditionally, leading to KMSAN uninit-value reports.
    
    Rather than initializing at each individual call site, zero the buffer
    at the start of hfs_bnode_read() before any validation checks.  This
    ensures all callers in both hfs and hfsplus get a deterministic zero
    value regardless of which early-return path is taken.
    
    Reported-by: syzbot+217eb327242d08197efb@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=217eb327242d08197efb
    Tested-by: syzbot+217eb327242d08197efb@syzkaller.appspotmail.com
    Fixes: a431930c9bac ("hfs: fix slab-out-of-bounds in hfs_bnode_read()")
    Cc: stable@vger.kernel.org
    Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
    Reviewed-by: Viacheslav Dubeyko <slava@dubeyko.com>
    Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
    Link: https://lore.kernel.org/r/20260505111300.3592757-3-tristmd@gmail.com
    Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
HID: appleir: fix UAF on pending key_up_timer in remove() [+ + +]
Author: Manish Khadka <maskmemanish@gmail.com>
Date:   Fri May 15 23:17:52 2026 +0545

    HID: appleir: fix UAF on pending key_up_timer in remove()
    
    commit 75fe87e19d8aff81eb2c64d15d244ab8da4de945 upstream.
    
    appleir_remove() runs hid_hw_stop() before timer_delete_sync().
    hid_hw_stop() synchronously unregisters the HID input device via
    hid_disconnect() -> hidinput_disconnect() -> input_unregister_device(),
    which drops the last reference and frees the underlying input_dev when
    no userspace handle holds it open.
    
    key_up_tick() reads appleir->input_dev and calls input_report_key() /
    input_sync() on it.  The timer is armed from appleir_raw_event() with
    a HZ/8 (~125 ms) timeout on every keydown and key-repeat report.  If a
    key was pressed shortly before the device is disconnected, the timer
    can fire after hid_hw_stop() has freed input_dev but before the
    teardown drains it.
    
    A simple reorder is not sufficient.  Putting the timer drain first
    still leaves a window where a USB URB completion (raw_event) running
    during hid_hw_stop() can call mod_timer() and re-arm the timer, which
    then fires after hidinput_disconnect() has freed input_dev.  The same
    URB-completion window also lets raw_event() reach key_up(), key_down()
    and battery_flat() directly, all of which dereference
    appleir->input_dev.
    
    Introduce a 'removing' flag on struct appleir, gated by the existing
    spinlock.  appleir_remove() sets the flag under the lock and then
    shuts down the timer with timer_shutdown_sync(), which both drains any
    in-flight callback and permanently disables further mod_timer() calls.
    appleir_raw_event() and key_up_tick() bail out early if the flag is
    set, so no path can arm or run the timer, or dereference
    appleir->input_dev, after remove() has started tearing down.
    
    The keyrepeat and flatbattery branches of appleir_raw_event()
    previously called into the input layer without holding the spinlock;
    take it now so the flag check is well-defined.  This incidentally
    closes a pre-existing read-side race on appleir->current_key in the
    keyrepeat branch.
    
    This bug is structurally a sibling of commit 4db2af929279 ("HID:
    appletb-kbd: fix UAF in inactivity-timer cleanup path") and has been
    present since the driver was introduced.
    
    Fixes: 9a4a5574ce42 ("HID: appleir: add support for Apple ir devices")
    Cc: stable@vger.kernel.org
    Signed-off-by: Manish Khadka <maskmemanish@gmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

HID: hid-goodix-spi: validate report size to prevent stack buffer overflow [+ + +]
Author: Tianchu Chen <flynnnchen@tencent.com>
Date:   Fri May 29 13:42:47 2026 +0000

    HID: hid-goodix-spi: validate report size to prevent stack buffer overflow
    
    commit db0a0768d09273aadadeb76730cd658d720333a4 upstream.
    
    goodix_hid_set_raw_report() builds a protocol frame in a 128-byte stack
    buffer (tmp_buf), writing an 11-12 byte header followed by the
    caller-supplied report data.  The HID core caps report size at
    HID_MAX_BUFFER_SIZE (16384) by default, while the driver does not set
    hid_ll_driver.max_buffer_size and performs no bounds checking before
    copying the payload:
    
        memcpy(tmp_buf + tx_len, buf, len);
    
    A hidraw SET_REPORT ioctl with a report larger than ~116 bytes
    overflows the stack buffer.
    
    Add a size check after constructing the header, rejecting reports that
    would exceed the buffer capacity.
    
    Discovered by Atuin - Automated Vulnerability Discovery Engine.
    
    Fixes: 75e16c8ce283 ("HID: hid-goodix: Add Goodix HID-over-SPI driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Tianchu Chen <flynnnchen@tencent.com>
    Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

HID: hid-lenovo-go: cancel cfg_setup work in hid_go_cfg_remove() [+ + +]
Author: Manish Khadka <maskmemanish@gmail.com>
Date:   Fri May 15 23:30:11 2026 +0545

    HID: hid-lenovo-go: cancel cfg_setup work in hid_go_cfg_remove()
    
    commit 73fde0cbff7d9d618591774a12c23434232752c1 upstream.
    
    hid_go_cfg_probe() initialises drvdata.go_cfg_setup and schedules it
    to run 2 ms later:
    
        INIT_DELAYED_WORK(&drvdata.go_cfg_setup, &cfg_setup);
        schedule_delayed_work(&drvdata.go_cfg_setup, msecs_to_jiffies(2));
    
    cfg_setup() dereferences drvdata.hdev to issue MCU command requests.
    hid_go_cfg_remove() tears down sysfs and stops the HID device, but
    never drains the delayed work.  If the device is unbound within the
    2 ms scheduling delay (a probe failure rolling back via remove, or a
    fast rmmod after probe), the work fires after hid_destroy_device()
    has dropped its reference and released the underlying hdev struct,
    leaving cfg_setup() with a stale drvdata.hdev pointer.
    
    Mirror the sibling driver hid-lenovo-go-s.c, whose hid_gos_cfg_remove()
    already calls cancel_delayed_work_sync() on its analogous work, and
    drain go_cfg_setup at the top of hid_go_cfg_remove().  The cancel
    must come before guard(mutex)(&drvdata.cfg_mutex) because cfg_setup()
    acquires that mutex; reversing the order would deadlock.
    
    Fixes: d69ccfcbc955 ("HID: hid-lenovo-go: Add Lenovo Legion Go Series HID Driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Manish Khadka <maskmemanish@gmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

HID: letsketch: fix UAF on inrange_timer at driver unbind [+ + +]
Author: Manish Khadka <maskmemanish@gmail.com>
Date:   Fri May 15 22:27:00 2026 +0545

    HID: letsketch: fix UAF on inrange_timer at driver unbind
    
    commit 46c8beeccd8ab2c863827254a85ea877654a3534 upstream.
    
    letsketch_driver does not provide a .remove callback, but
    letsketch_probe() arms a per-device timer:
    
        timer_setup(&data->inrange_timer, letsketch_inrange_timeout, 0);
    
    The timer is re-armed from letsketch_raw_event() with a 100 ms
    timeout on every pen-in-range report, and its callback dereferences
    data->input_tablet to deliver a synthetic BTN_TOOL_PEN release.
    
    letsketch_data is allocated with devm_kzalloc(), and its input_dev
    fields are devm-allocated via letsketch_setup_input_tablet().  On
    device unbind (USB unplug or rmmod), the HID core runs its default
    teardown and devm cleanup frees both letsketch_data and the input
    devices.  Because no .remove callback exists, nothing drains the
    timer first: if raw_event armed it within ~100 ms of the unbind,
    the pending timer fires on freed memory.  This is a UAF read of
    data and of data->input_tablet, followed by input_report_key() /
    input_sync() into the freed input_dev.
    
    The same problem can occur on the probe error path: if
    hid_hw_start() enabled I/O on an always-poll-quirk device and then
    failed, raw_event may have armed the timer before devm releases
    data.
    
    Fix by adding a .remove callback that calls hid_hw_stop() first.
    hid_hw_stop() synchronously kills the URBs that deliver raw_event(),
    so once it returns no path can re-arm the timer.  timer_shutdown_sync()
    then drains any in-flight callback and permanently disables further
    mod_timer() calls.  Apply the same timer_shutdown_sync() in the probe
    error path so the timer is guaranteed not to outlive data.
    
    Fixes: 33a5c2793451 ("HID: Add new Letsketch tablet driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Manish Khadka <maskmemanish@gmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

HID: lg-g15: cancel pending work on remove to fix a use-after-free [+ + +]
Author: Maoyi Xie <maoyixie.tju@gmail.com>
Date:   Thu Jun 18 15:06:35 2026 +0800

    HID: lg-g15: cancel pending work on remove to fix a use-after-free
    
    commit 7705b4140d188ce22656f6e541ae7ef834c7e11a upstream.
    
    lg_g15_data is allocated with devm and holds a work item. The report
    handlers schedule that work straight from device input.
    lg_g15_event() and lg_g15_v2_event() do it on the backlight cycle key,
    and lg_g510_leds_event() does it too. The worker dereferences the
    lg_g15_data back through container_of.
    
    The driver had no remove callback and never cancelled the work. So if a
    report scheduled the work and the keyboard was then unplugged, devres
    freed lg_g15_data while the work was still pending or running, and the
    worker touched freed memory. This is a use-after-free. It is reachable
    as a race on device unplug.
    
    Add a remove callback that cancels the work before devres frees the
    state. g15->work is only initialized for the models that schedule it
    (G15, G15 v2, G510). The G13 and Z-10 leave it zeroed, so guard the
    cancel on g15->work.func to avoid cancelling a work that was never set
    up. The g15 NULL test mirrors the one already in lg_g15_raw_event().
    
    Fixes: 97b741aba918 ("HID: lg-g15: Add keyboard and LCD backlight control")
    Cc: stable@vger.kernel.org
    Suggested-by: Hans de Goede <hansg@kernel.org>
    Signed-off-by: Maoyi Xie <maoyixie.tju@gmail.com>
    Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

HID: multitouch: fix out-of-bounds bit access on mt_io_flags [+ + +]
Author: Trung Nguyen <trungnh@cystack.net>
Date:   Thu Jul 2 00:13:19 2026 +0700

    HID: multitouch: fix out-of-bounds bit access on mt_io_flags
    
    commit 8813b0612275cc61fe9e6603d0ee019247ade6be upstream.
    
    mt_io_flags is a single unsigned long, but mt_process_slot(),
    mt_release_pending_palms() and mt_release_contacts() use it as a
    per-slot bitmap indexed by the slot number. That slot number is only
    bounded by td->maxcontacts, which is taken from the device's
    ContactCountMaximum feature report and can be up to 255, not by
    BITS_PER_LONG.
    
    As a result, a multitouch device that advertises a large contact count
    makes set_bit()/clear_bit() operate past the mt_io_flags word and
    corrupt the adjacent members of struct mt_device. The sticky-fingers
    release timer is the easiest way to reach this. mt_release_contacts()
    runs
    
            for (i = 0; i < mt->num_slots; i++)
                    clear_bit(i, &td->mt_io_flags);
    
    with num_slots == maxcontacts. For maxcontacts around 250 the loop
    clears the bits that overlap td->applications.next, zeroing that list
    head, and the list_for_each_entry() that immediately follows then
    dereferences NULL. The kernel panics from timer (softirq) context. On a
    KASAN build this shows up as a general protection fault in
    mt_release_contacts() with a null-ptr-deref at offset 0x58, which is
    offsetof(struct mt_application, num_received).
    
    The state is reachable from an untrusted USB or Bluetooth HID
    multitouch device; no local privileges are required.
    
    Store the per-slot active state in a separately allocated bitmap sized
    for maxcontacts, the same pattern already used for pending_palm_slots,
    and keep only MT_IO_FLAGS_RUNNING in mt_io_flags. The two
    "mt_io_flags & MT_IO_SLOTS_MASK" arming checks become
    bitmap_empty(td->active_slots, td->maxcontacts).
    
    Move MT_IO_FLAGS_RUNNING back to bit 0. It was bumped to bit 32 by the
    same commit to leave the low byte for the slot bits; with the slot bits
    gone it fits in bit 0 again, which also keeps it within the unsigned
    long on 32-bit.
    
    Fixes: 46f781e0d151 ("HID: multitouch: fix sticky fingers")
    Cc: stable@vger.kernel.org
    Signed-off-by: Trung Nguyen <trungnh@cystack.net>
    Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

HID: pidff: Use correct effect type in effect update [+ + +]
Author: Oleg Makarenko <oleg@makarenk.ooo>
Date:   Tue Jun 9 19:00:27 2026 +0300

    HID: pidff: Use correct effect type in effect update
    
    commit b251598b8bf37300510868f739a79e07800d41ce upstream.
    
    When updating an existing effect, the effect type from the last created
    effect was sent to the device instead of the updated one.
    This caused incorrect reports when a game creates multiple different
    effects and updates only one that is not the last created.
    
    Fixes FFB in multiple games that create multiple simultaneous effects
    (Forza Horizon 5/6).
    
    Fixes: 224ee88fe395 ("Input: add force feedback driver for PID devices")
    Cc: stable@vger.kernel.org
    Tested-by: Oliver Roundtree <oroundtree1@gmail.com>
    Co-developed-by: Ryno Kotzé <lemon.xah@gmail.com>
    Signed-off-by: Ryno Kotzé <lemon.xah@gmail.com>
    Signed-off-by: Oleg Makarenko <oleg@makarenk.ooo>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

HID: sensor-hub: Add sensor_hub_input_attr_read_values() for multi-byte reads [+ + +]
Author: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Date:   Wed Jun 10 16:29:09 2026 +0800

    HID: sensor-hub: Add sensor_hub_input_attr_read_values() for multi-byte reads
    
    commit f784fcea450617055d2d12eec5b2f6e0e38bf878 upstream.
    
    sensor_hub_input_attr_get_raw_value() is limited to returning a single
    32-bit value, which is insufficient for sensors that report data larger
    than 32 bits, such as a quaternion with four s16 elements.
    
    Add sensor_hub_input_attr_read_values() that accepts a caller-provided
    buffer and accumulates incoming data until the buffer is full. The two
    paths are distinguished in sensor_hub_raw_event() by pending.max_raw_size
    being non-zero, preserving backward compatibility.
    
    Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    Co-developed-by: Zhang Lixu <lixu.zhang@intel.com>
    Signed-off-by: Zhang Lixu <lixu.zhang@intel.com>
    Acked-by: Jiri Kosina <jkosina@suse.com>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

HID: uhid: convert to hid_safe_input_report() [+ + +]
Author: Carlos Llamas <cmllamas@google.com>
Date:   Sat Jun 6 18:15:52 2026 +0000

    HID: uhid: convert to hid_safe_input_report()
    
    commit 63a694c51bf120a37550890b8e7736b4888985e9 upstream.
    
    Commit 0a3fe972a7cb ("HID: core: Mitigate potential OOB by removing
    bogus memset()"), added a check in hid_report_raw_event() to reject
    reports if the received data size is smaller than expected. This was
    intended to prevent OOB errors by no longer allowing zeroing-out of
    shorter reports due to the lack of buffer size information.
    
    However, this leads to regressions in hid_report_raw_event(), where
    shorter than expected reports are rejected, even though their buffers
    are sufficiently large to be zero-padded.
    
    To solve this issue, Benjamin introduced a safer alternative in commit
    206342541fc8 ("HID: core: introduce hid_safe_input_report()"), which
    forwards the buffer size and allows hid_report_raw_event() to safely
    zero-pad the data.
    
    Convert uhid to use hid_safe_input_report() and pass UHID_DATA_MAX as
    the buffer size. This prevents the reported regressions [1], allowing
    hid core to zero-pad the shorter reports safely as expected.
    
    Cc: stable@vger.kernel.org
    Fixes: 0a3fe972a7cb ("HID: core: Mitigate potential OOB by removing bogus memset()")
    Closes: https://lore.kernel.org/all/ahsh0UtTX6e0ZeHa@google.com/ [1]
    Signed-off-by: Carlos Llamas <cmllamas@google.com>
    Reviewed-by: Lee Jones <lee@kernel.org>
    Closes: https://lore.kernel.org/all/ahsh0UtTX6e0ZeHa@google.com/
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

HID: wacom: fix slab-out-of-bounds write in wacom_wac_queue_insert [+ + +]
Author: Jinmo Yang <jinmo44.yang@gmail.com>
Date:   Fri May 29 02:59:45 2026 +0900

    HID: wacom: fix slab-out-of-bounds write in wacom_wac_queue_insert
    
    commit 6b3014ec0e9a390ca563030b2d7689921f0daef5 upstream.
    
    wacom_wac_queue_insert() calls kfifo_skip() in a loop when the kfifo
    doesn't have enough space for the incoming report. If the kfifo is
    empty, kfifo_skip() reads stale data left in the kmalloc'd buffer
    via __kfifo_peek_n() and interprets it as a record length, advancing
    fifo->out by that garbage value. This corrupts the internal kfifo
    state, causing kfifo_unused() to return a value much larger than the
    actual buffer size, which bypasses __kfifo_in_r()'s guard:
    
      if (len + recsize > kfifo_unused(fifo))
          return 0;
    
    kfifo_copy_in() then performs an out-of-bounds memcpy, writing up to
    3842 bytes past the 256-byte buffer.
    
    Add a !kfifo_is_empty() condition to the while loop so kfifo_skip()
    is never called on an empty fifo, and check the return value of
    kfifo_in() to reject reports that are too large for the fifo.
    
    Suggested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Fixes: 5e013ad20689 ("HID: wacom: Remove static WACOM_PKGLEN_MAX limit")
    Cc: stable@vger.kernel.org
    Signed-off-by: Jinmo Yang <jinmo44.yang@gmail.com>
    Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

HID: wacom: stop hardware after post-start probe failures [+ + +]
Author: Myeonghun Pak <mhun512@gmail.com>
Date:   Thu Jun 4 13:56:58 2026 +0900

    HID: wacom: stop hardware after post-start probe failures
    
    commit ec2612b8ad9e642596db011dd8b6568ef1edeaa1 upstream.
    
    wacom_parse_and_register() starts HID hardware before registering inputs
    and initializing pad LEDs/remotes. Those later steps can fail, but their
    error paths currently release Wacom resources without stopping the HID
    hardware.
    
    Route post-hid_hw_start() failures through hid_hw_stop() before
    releasing driver resources.
    
    This issue was identified during our ongoing static-analysis research while
    reviewing kernel code.
    
    Fixes: c1d6708bf0d3 ("HID: wacom: Do not register input devices until after hid_hw_start")
    Cc: stable@vger.kernel.org
    Co-developed-by: Ijae Kim <ae878000@gmail.com>
    Signed-off-by: Ijae Kim <ae878000@gmail.com>
    Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
    Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

HID: wacom: use GFP_ATOMIC in wacom_wac_queue_flush() [+ + +]
Author: Jinmo Yang <jinmo44.yang@gmail.com>
Date:   Mon Jun 1 22:41:23 2026 +0900

    HID: wacom: use GFP_ATOMIC in wacom_wac_queue_flush()
    
    commit 55f1ad573e34abf9a0443c34bc5a63d74edba7d7 upstream.
    
    wacom_wac_queue_flush() is called via the .raw_event callback
    (wacom_raw_event → wacom_wac_pen_serial_enforce → wacom_wac_queue_flush).
    For USB HID devices, this callback is invoked from hid_irq_in(), which
    is a URB completion handler running in atomic context. Using GFP_KERNEL
    in this path can sleep, leading to a "scheduling while atomic" bug.
    
    Use GFP_ATOMIC instead. The existing code already handles allocation
    failure by skipping the fifo entry and continuing.
    
    Reported-by: Sashiko-bot <sashiko-bot@kernel.org>
    Fixes: 5e013ad20689 ("HID: wacom: Remove static WACOM_PKGLEN_MAX limit")
    Cc: stable@vger.kernel.org
    Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Jinmo Yang <jinmo44.yang@gmail.com>
    Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
hwrng: jh7110 - fix refcount leak in starfive_trng_read() [+ + +]
Author: Wentao Liang <vulab@iscas.ac.cn>
Date:   Wed Jun 3 11:03:27 2026 +0000

    hwrng: jh7110 - fix refcount leak in starfive_trng_read()
    
    commit 8d13f7a8450206e3f820cdb26e33e91d181071b4 upstream.
    
    The starfive_trng_read() function acquires a runtime PM reference
    via pm_runtime_get_sync() but fails to release it on two error
    paths.  If starfive_trng_wait_idle() or starfive_trng_cmd() returns
    an error, the function exits without calling
    pm_runtime_put_sync_autosuspend(), leaving the runtime PM usage
    counter permanently elevated and preventing the device from entering
    runtime suspend.
    
    Refactor the function to use a unified error path that calls
    pm_runtime_put_sync_autosuspend() before returning.
    
    Cc: stable@vger.kernel.org
    Fixes: c388f458bc34 ("hwrng: starfive - Add TRNG driver for StarFive SoC")
    Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

hwrng: virtio: clamp device-reported used.len at copy_data() [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
Date:   Sun May 31 10:22:51 2026 -0400

    hwrng: virtio: clamp device-reported used.len at copy_data()
    
    commit e3046eeada299f917a8ad883af4434bfb86556b1 upstream.
    
    random_recv_done() stores the device-reported used.len directly into
    vi->data_avail.  copy_data() then indexes vi->data[] using
    vi->data_idx (advanced by previous copy_data() calls) and issues a
    memcpy() without re-validating either value against the posted
    buffer size sizeof(vi->data) (SMP_CACHE_BYTES bytes, typically 32
    or 64).
    
    A malicious or buggy virtio-rng backend can set used.len beyond
    sizeof(vi->data), steering the memcpy() past the end of the inline
    array into adjacent kmalloc-1k slab bytes.  hwrng_fillfn() mixes
    those bytes into the guest RNG, and guest root can also observe
    them directly via /dev/hwrng.
    
    Concrete impact is inside the guest:
    
     - Memory-safety / hardening: any virtio-rng backend that
       over-reports used.len causes the driver to read past vi->data
       into unrelated slab contents.  hwrng_fillfn() is a kernel thread
       that runs as soon as the device is probed; no guest userspace
       interaction is required to first-trigger the OOB.
    
     - Cross-boundary leak (confidential-compute threat model): a
       malicious hypervisor cooperating with a malicious or compromised
       guest root userspace can use /dev/hwrng as a leak channel for
       guest-kernel heap data.  The host sets a large used.len, guest
       root reads /dev/hwrng, and the returned bytes contain guest
       kernel slab contents that were adjacent to vi->data.  In
       practice, confidential-compute guests (SEV-SNP, TDX) usually
       disable virtio-rng entirely, so this path is narrow, but the
       fix is still worth carrying because the underlying
       memory-safety bug contaminates the guest RNG on any host.
    
    KASAN confirms the OOB on a 7.1-rc4 guest whose virtio-rng backend
    has been patched to report used.len = 0x10000:
    
      BUG: KASAN: slab-out-of-bounds in virtio_read+0x394/0x5d0
      Read of size 64 at addr ffff88800ae0ba20 by task hwrng/52
      Call Trace:
       __asan_memcpy+0x23/0x60
       virtio_read+0x394/0x5d0
       hwrng_fillfn+0xb2/0x470
       kthread+0x2cc/0x3a0
      Allocated by task 1:
       probe_common+0xa5/0x660
       virtio_dev_probe+0x549/0xbc0
      The buggy address belongs to the object at ffff88800ae0b800
       which belongs to the cache kmalloc-1k of size 1024
      The buggy address is located 0 bytes to the right of
       allocated 544-byte region [ffff88800ae0b800, ffff88800ae0ba20)
    
    Same class of bug as commit c04db81cd028 ("net/9p: Fix buffer
    overflow in USB transport layer"), which hardened
    usb9pfs_rx_complete() against unchecked device-reported length in
    the USB 9p transport.
    
    With the clamp at point of use and array_index_nospec() in place,
    the same harness boots cleanly: copy_data() returns zero for the
    bogus report, the device-supplied bytes after data_idx are
    discarded, and the driver issues a fresh request.
    
    Fixes: f7f510ec1957 ("virtio: An entropy device, as suggested by hpa.")
    Cc: stable@vger.kernel.org
    Suggested-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Message-ID: <20260531142251.2792061-1-michael.bommarito@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
i2c: core: fix adapter debugfs creation [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Mon May 11 16:37:10 2026 +0200

    i2c: core: fix adapter debugfs creation
    
    commit 07d5fb537928aad4369aaff0cbae73ba38a719af upstream.
    
    Clients can be registered from bus notifier callbacks so the debugfs
    directory needs to be created before registering the adapter as clients
    use that directory as their debugfs parent.
    
    Move debugfs creation before adapter registration to avoid having
    clients create their debugfs directories in the debugfs root (which is
    also more likely to fail due to name collisions).
    
    Note that failure to allocate the adapter name must now be handled
    explicitly as debugfs_create_dir() cannot handle a NULL name (unlike
    device_add() which returns an error).
    
    Fixes: 73febd775bdb ("i2c: create debugfs entry per adapter")
    Cc: stable@vger.kernel.org      # 6.8
    Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

i2c: core: fix adapter deregistration race [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Mon May 11 16:37:13 2026 +0200

    i2c: core: fix adapter deregistration race
    
    commit b1a58ed9eab146b36f41a55db8f5d7ce9fdedf3f upstream.
    
    Adapters can be looked up by their id using i2c_get_adapter() which
    takes a reference to the embedded struct device.
    
    Remove the adapter from the IDR before tearing it down during
    deregistration (and on registration failure) to make sure its resources
    are not accessed after having been freed (e.g. the device name).
    
    Fixes: 35fc37f81881 ("i2c: Limit core locking to the necessary sections")
    Cc: stable@vger.kernel.org      # 2.6.31
    Cc: Jean Delvare <khali@linux-fr.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

i2c: core: fix adapter probe deferral loop [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Mon May 11 16:37:09 2026 +0200

    i2c: core: fix adapter probe deferral loop
    
    commit 158efa411c57111d87bf265a3776614f32d70007 upstream.
    
    Drivers must not probe defer after having registered devices as that
    will trigger a probe loop if the devices bind to a driver (cf. commit
    fbc35b45f9f6 ("Add documentation on meaning of -EPROBE_DEFER")).
    
    Move the recovery initialisation, where the GPIO lookup may fail, before
    registering the adapter to prevent this.
    
    Fixes: 75820314de26 ("i2c: core: add generic I2C GPIO recovery")
    Cc: stable@vger.kernel.org      # 5.9
    Cc: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

i2c: core: fix hang on adapter registration failure [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Mon May 11 16:37:07 2026 +0200

    i2c: core: fix hang on adapter registration failure
    
    commit 3c7e164344e5bcf6f274bbf59a3274f5caad9bc1 upstream.
    
    Clients may be registered from bus notifier callbacks when the adapter
    is registered. On a subsequent error during registration, the adapter
    references taken by such clients prevent the wait for the references to
    be released from ever completing.
    
    Fix this by refactoring client deregistration and deregistering also on
    late adapter registration failures.
    
    Fixes: f8756c67b3de ("i2c: core: call of_i2c_setup_smbus_alert in i2c_register_adapter")
    Cc: stable@vger.kernel.org      # 4.15
    Cc: Phil Reid <preid@electromag.com.au>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

i2c: core: fix irq domain leak on adapter registration failure [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Mon May 11 16:37:06 2026 +0200

    i2c: core: fix irq domain leak on adapter registration failure
    
    commit 8ce19524e4cc2462685f596a6402fbd8fb984ab2 upstream.
    
    Make sure to tear down the host notify irq domain on adapter
    registration failure to avoid leaking it.
    
    This issue was flagged by Sashiko when reviewing another adapter
    registration fix.
    
    Fixes: 4d5538f5882a ("i2c: use an IRQ to report Host Notify events, not alert")
    Cc: stable@vger.kernel.org      # 4.10
    Cc: Benjamin Tissoires <bentiss@kernel.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

i2c: core: fix NULL-deref on adapter registration failure [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Mon May 11 16:37:08 2026 +0200

    i2c: core: fix NULL-deref on adapter registration failure
    
    commit 2295d2bb101faa663fbc45fadbb3fec45f107441 upstream.
    
    If adapter registration ever fails the release callback would trigger a
    NULL-pointer dereference as the completion struct has not been
    initialised.
    
    Note that before the offending commit this would instead have resulted
    in a minor memory leak of the adapter name.
    
    Fixes: 3f8c4f5e9a57 ("i2c: core: fix reference leak in i2c_register_adapter()")
    Cc: stable@vger.kernel.org
    Cc: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

i2c: davinci: Unregister cpufreq notifier on probe failure [+ + +]
Author: Haoxiang Li <haoxiang_li2024@163.com>
Date:   Wed Jun 10 11:05:13 2026 +0800

    i2c: davinci: Unregister cpufreq notifier on probe failure
    
    commit e43f32816a1b1fe5a86279411626fe3a9be56d45 upstream.
    
    davinci_i2c_probe() registers a cpufreq transition notifier before adding
    the I2C adapter.  If i2c_add_numbered_adapter() fails, the probe error path
    releases the device resources without unregistering the notifier.
    
    Add a dedicated error path to unregister the cpufreq notifier after
    i2c_add_numbered_adapter() fails.
    
    Fixes: 82c0de11b734 ("i2c: davinci: Add cpufreq support")
    Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
    Cc: <stable@vger.kernel.org> # v2.6.36+
    Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
    Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
    Link: https://lore.kernel.org/r/20260610030513.2651018-1-haoxiang_li2024@163.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

i2c: i801: fix hardware state machine corruption in error path [+ + +]
Author: Mingyu Wang <25181214217@stu.xidian.edu.cn>
Date:   Tue May 12 17:35:34 2026 +0800

    i2c: i801: fix hardware state machine corruption in error path
    
    commit 10dd1a736d557e310a77117832874729a0175d57 upstream.
    
    A severe livelock and subsequent Hung Task panic were observed in the
    i2c-i801 driver during concurrent Fuzzing. The crash is caused by an
    unconditional hardware register cleanup in the error handling path of
    i801_access().
    
    When i801_check_pre() fails (e.g., returning -EBUSY because the SMBus
    controller is actively used by BIOS/ACPI), the kernel does not actually
    acquire the hardware ownership. However, the code jumps to the 'out'
    label and executes:
    
        iowrite8(SMBHSTSTS_INUSE_STS | STATUS_FLAGS, SMBHSTSTS(priv));
    
    This forcefully clears the INUSE_STS lock and resets the hardware status
    flags without owning the controller. Doing so interrupts ongoing BIOS/ACPI
    transactions and totally corrupts the SMBus hardware state machine.
    
    Consequently, all subsequent i801_access() calls fail at the pre-check
    stage, triggering an endless stream of "SMBus is busy, can't use it!"
    error logs. Over a slow serial console, this printk flood monopolizes
    the CPU (Console Livelock), starving other processes trying to acquire
    the mmap_lock down_read semaphore, ultimately triggering the hung task
    watchdog.
    
    Fix this by moving the 'out' label below the hardware register cleanup.
    If i801_check_pre() fails, we safely bypass the iowrite8() and only
    release the software locks (pm_runtime and mutex), strictly adhering to
    the rule of not releasing resources that were never acquired.
    
    Fixes: 1f760b87e54c ("i2c: i801: Call i801_check_pre() from i801_access()")
    Signed-off-by: Mingyu Wang <25181214217@stu.xidian.edu.cn>
    Cc: <stable@vger.kernel.org> # v6.3+
    Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
    Link: https://lore.kernel.org/r/20260512093534.348655-1-w15303746062@163.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

i2c: imx-lpi2c: mark I2C adapter when hardware is powered down [+ + +]
Author: Carlos Song <carlos.song@nxp.com>
Date:   Mon May 25 11:14:50 2026 +0800

    i2c: imx-lpi2c: mark I2C adapter when hardware is powered down
    
    commit 218cfe364b55b2768221629bd4a69ad190b7fbbc 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: 1ee867e465c1 ("i2c: imx-lpi2c: add target mode support")
    Signed-off-by: Carlos Song <carlos.song@nxp.com>
    Cc: <stable@vger.kernel.org> # v6.14+
    Acked-by: Mukesh Savaliya <mukesh.savaliya@oss.qualcomm.com>
    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
    Link: https://lore.kernel.org/r/20260525031450.3183421-1-carlos.song@oss.nxp.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

i2c: mpc: Fix timeout calculations [+ + +]
Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date:   Thu Jun 18 16:49:34 2026 +0200

    i2c: mpc: Fix timeout calculations
    
    commit 2e9a7f68329be41792c0b123c28e6c53c2fa2249 upstream.
    
    At first glance the harmless cleanup of the driver does nothing bad.
    However, as the operator precedence list states the '*' (multiplication)
    and '/' division operators have order 5 with left-to-right associativity
    the *= has order 17 and associativity right-to-left. It wouldn't be
    a problem to replace
    
            foo = foo * HZ / 1000000;
    
    with
    
            foo *= HZ / 1000000;
    
    if HZ constant is in Hertz. The problem is that in the Linux kernel HZ is
    defined in jiffy units, which is order of magnitude smaller than a million.
    That's why operator precedence has a crucial role here. Fix the regression
    by reverting pre-optimized calculations.
    
    Fixes: be40a3ae719f ("i2c: mpc: Use of_property_read_u32 instead of of_get_property")
    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Cc: <stable@vger.kernel.org> # v6.4+
    Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
    Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
    Link: https://lore.kernel.org/r/20260618144934.3249950-1-andriy.shevchenko@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

i2c: stm32f7: truncate clock period instead of rounding it [+ + +]
Author: Guillermo Rodríguez <guille.rodriguez@gmail.com>
Date:   Thu Jun 11 12:48:56 2026 +0200

    i2c: stm32f7: truncate clock period instead of rounding it
    
    commit 111bb7f9f4a90b32e495d70a607c67b137f3074a upstream.
    
    stm32f7_i2c_compute_timing() derives the I2C clock source period
    (i2cclk) with DIV_ROUND_CLOSEST, which may round it up. When the
    period is overestimated, all timings computed from it (SCLDEL,
    SDADEL, SCLL, SCLH) come out shorter on the wire than calculated,
    and the resulting bus rate can exceed the requested speed, violating
    the I2C specification minimums for tLOW and tHIGH.
    
    For example, with a 104.45 MHz clock source (e.g. PCLK1, the
    reset-default I2C clock source on STM32MP1), i2cclk is rounded from
    9.574 ns up to 10 ns. Requesting a 400 kHz fast mode bus with
    72/27 ns rise/fall times and no analog/digital filters then produces
    an actual bus rate of 415.6 kHz with tLOW = 1254 ns, violating both
    the 400 kHz maximum rate and the 1300 ns tLOW minimum of the
    specification.
    
    Truncate the period instead, so that it can only be underestimated.
    The error then falls on the safe side: the programmed timings come
    out slightly longer than computed and the bus runs marginally below
    the target rate (375.3 kHz in the example above) while meeting the
    specification.
    
    i2cbus is left rounded-to-closest: it is only used as the target of
    the clk_error comparison and is never multiplied into the programmed
    timings, so nearest rounding remains accurate there.
    
    Fixes: aeb068c57214 ("i2c: i2c-stm32f7: add driver")
    Signed-off-by: Guillermo Rodríguez <guille.rodriguez@gmail.com>
    Cc: <stable@vger.kernel.org> # v4.14+
    Acked-by: Alain Volmat <alain.volmat@foss.st.com>
    Reviewed-by: Pierre-Yves MORDRET <pierre-yves.mordret@foss.st.com>
    Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
    Link: https://lore.kernel.org/r/20260611104857.242153-1-guille.rodriguez@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
iio: accel: bmc150: clamp the device-reported FIFO frame count [+ + +]
Author: Bryam Vargas <hexlabsecurity@proton.me>
Date:   Sat Jun 13 02:18:39 2026 -0500

    iio: accel: bmc150: clamp the device-reported FIFO frame count
    
    commit ce0e1cae26096fe959a0da5563a6d6d5a801d5fb upstream.
    
    __bmc150_accel_fifo_flush() copies the number of samples the device
    reports in its hardware FIFO into an on-stack buffer
    
            u16 buffer[BMC150_ACCEL_FIFO_LENGTH * 3];
    
    which is sized for at most BMC150_ACCEL_FIFO_LENGTH (32) samples. The
    frame count is read from the FIFO_STATUS register and only masked to its
    7 valid bits:
    
            count = val & 0x7F;
    
    so it can be 0..127. The only other limit applied to it is the optional
    caller-supplied sample budget:
    
            if (samples && count > samples)
                    count = samples;
    
    which does not constrain count on the flush-all path (samples == 0), and
    leaves it well above 32 whenever samples is larger. count samples are
    then transferred into buffer[]:
    
            bmc150_accel_fifo_transfer(data, (u8 *)buffer, count);
    
    bmc150_accel_fifo_transfer() reads count * 6 bytes through regmap, so a
    malfunctioning, malicious or counterfeit accelerometer (or an attacker
    tampering with the I2C/SPI bus) that reports up to 127 frames writes up
    to 762 bytes into the 192-byte buffer: a stack out-of-bounds write of up
    to 570 bytes that clobbers the stack canary, saved registers and the
    return address.
    
    Clamp count to BMC150_ACCEL_FIFO_LENGTH, the number of samples buffer[]
    is sized for, before the transfer, mirroring the watermark clamp already
    done in bmc150_accel_set_watermark(). A well-formed flush reports at most
    BMC150_ACCEL_FIFO_LENGTH frames, so legitimate devices are unaffected.
    
    Fixes: 3bbec9773389 ("iio: bmc150_accel: add support for hardware fifo")
    Cc: stable@vger.kernel.org
    Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: accel: kxsd9: fix runtime PM imbalance on write_raw() error [+ + +]
Author: Biren Pandya <birenpandya@gmail.com>
Date:   Sun Jun 14 12:45:46 2026 +0530

    iio: accel: kxsd9: fix runtime PM imbalance on write_raw() error
    
    commit 44a5fd874bb6873bdaec59f722c1d57832fbc9df upstream.
    
    kxsd9_write_raw() takes a runtime PM reference with pm_runtime_get_sync()
    but returns -EINVAL directly when a scale with a non-zero integer part is
    requested, skipping the matching pm_runtime_put_autosuspend(). This leaks
    a runtime PM usage-counter reference on every such write, after which the
    device can no longer autosuspend.
    
    Set the error code and fall through to the existing put instead of
    returning early.
    
    Fixes: 9a9a369d6178 ("iio: accel: kxsd9: Deploy system and runtime PM")
    Signed-off-by: Biren Pandya <birenpandya@gmail.com>
    Assisted-by: Claude:claude-opus-4-8 coccinelle
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: adc: ad4062: add GPIOLIB dependency [+ + +]
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Fri May 15 11:07:53 2026 +0200

    iio: adc: ad4062: add GPIOLIB dependency
    
    commit a5b7991d5a737df71a5e4230554481255af64ed4 upstream.
    
    The ad4062 driver gained support for the gpiochip and now fails
    to build when GPIOLIB is disabled:
    
    390-linux-ld: drivers/iio/adc/ad4062.o: in function `ad4062_gpio_get':
    drivers/iio/adc/ad4062.c:1383:(.text+0x3dc): undefined reference to `gpiochip_get_data`
    
    Add a Kconfig dependency for this.
    
    Fixes: da1d3596b1e4 ("iio: adc: ad4062: Add GPIO Controller support")
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: adc: ad7380: select REGMAP [+ + +]
Author: Samuel Moelius <samuel.moelius@trailofbits.com>
Date:   Tue Jun 2 16:45:39 2026 +0000

    iio: adc: ad7380: select REGMAP
    
    commit 6697091b386a4e2830bdd38512c87a4befff2b32 upstream.
    
    The AD7380 driver uses generic regmap types and APIs. However, its
    Kconfig entry does not select REGMAP.
    
    As a result, AD7380 can be enabled from an allnoconfig-derived config
    with SPI_MASTER=y while REGMAP remains unset, causing ad7380.o to fail
    to build.
    
    Fixes: b095217c104b ("iio: adc: ad7380: new driver for AD7380 ADCs")
    Signed-off-by: Samuel Moelius <samuel.moelius@trailofbits.com>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
    Reviewed-by: Nuno Sá <nuno.sa@analog.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: adc: ad7768-1: Select GPIOLIB [+ + +]
Author: Jonathan Cameron <jic23@kernel.org>
Date:   Sun Jan 11 16:55:28 2026 +0000

    iio: adc: ad7768-1: Select GPIOLIB
    
    commit 5a9c90350be4f6f175bdd193e8bd60a7aedfb4d2 upstream.
    
    This driver provides a gpio chip a some related functions are not
    stubbed if GPIOLIB is not built.
    
    ad7768-1.c:420: undefined reference to `gpiochip_get_data'
    ad7768-1.c:498: undefined reference to `devm_gpiochip_add_data_with_key'
    
    Dual sign off reflects change of affiliation whilst this was under review.
    
    Fixes: d569ae0f052e ("iio: adc: ad7768-1: Add GPIO controller support")
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202512271235.WwAmAbOa-lkp@intel.com/
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Cc: Stable@vger.kernel.org
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: adc: ad7779: add missing 'select IIO_TRIGGERED_BUFFER' to Kconfig [+ + +]
Author: Joshua Crofts <joshua.crofts1@gmail.com>
Date:   Wed Jul 1 21:21:47 2026 +0200

    iio: adc: ad7779: add missing 'select IIO_TRIGGERED_BUFFER' to Kconfig
    
    commit fd354554af1d2b33232ca6c8a3d79ed82413d715 upstream.
    
    The Kconfig entry for the AD7779 is missing a
    'select IIO_TRIGGERED_BUFFER' parameter, causing build failures.
    
    Fixes: c9a3f8c7bfcb ("drivers: iio: adc: add support for ad777x family")
    Cc: stable@vger.kernel.org
    Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
    Tested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: adc: ad_sigma_delta: fix clear_pending_event for registerless devices [+ + +]
Author: Radu Sabau <radu.sabau@analog.com>
Date:   Wed May 27 12:38:39 2026 +0300

    iio: adc: ad_sigma_delta: fix clear_pending_event for registerless devices
    
    commit 91bc6767a4f55dc470d8a56b55b9f2ea09094efe upstream.
    
    ad_sigma_delta_clear_pending_event() falls through to the status register
    read path for devices with has_registers = false and no rdy_gpiod. For
    such devices, ad_sd_read_reg() skips the address byte entirely and clocks
    raw MISO bytes with no address phase — making it byte-for-byte identical
    to reading conversion data. If a pending conversion result is present,
    this partially consumes it and corrupts the data stream for the subsequent
    ad_sd_read_reg() call in ad_sigma_delta_single_conversion().
    
    Furthermore, with num_resetclks = 0 on these devices, data_read_len
    evaluates to 0. If the clocked byte has bit 7 clear, pending_event is set
    and the code attempts memset(data + 2, 0xff, 0 - 1), overflowing to
    SIZE_MAX and corrupting the heap.
    
    Fix by returning 0 immediately when neither rdy_gpiod nor has_registers
    is set. This is safe for all current registerless devices: ad7191 and
    ad7780 (with powerdown GPIO) are reset between conversions by CS
    deassertion, so there is no stale result to drain; ad7780 (without
    powerdown GPIO) and max11205 are continuously-converting and cycle ~DRDY
    at the output data rate regardless of whether the previous result was
    read, so the next falling edge fires naturally.
    
    A future registerless device that holds ~DRDY asserted until data is read
    would be broken by this early return and would require either
    num_resetclks set or a rdy-gpio.
    
    The same heap corruption is reachable on any device with rdy_gpiod set
    but num_resetclks = 0: if the GPIO indicates a pending event, the drain
    path executes memset(data + 2, 0xff, 0 - 1) regardless of has_registers.
    Add an explicit data_read_len == 0 guard after the pending event check;
    the stale result is then consumed by the first ad_sd_read_reg() call in
    ad_sigma_delta_single_conversion().
    
    Fixes: 132d44dc6966 ("iio: adc: ad_sigma_delta: Check for previous ready signals")
    Signed-off-by: Radu Sabau <radu.sabau@analog.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: adc: ad_sigma_delta: fix CS held asserted and state leaks [+ + +]
Author: Radu Sabau <radu.sabau@analog.com>
Date:   Wed May 27 12:38:38 2026 +0300

    iio: adc: ad_sigma_delta: fix CS held asserted and state leaks
    
    commit c72da0688575e5ef39c36bb44fed53aa18f8ae65 upstream.
    
    In ad_sigma_delta_single_conversion(), set_mode(AD_SD_MODE_IDLE) and
    disable_one() were called from the out: block while keep_cs_asserted
    was still true. This caused any SPI transfer issued by those callbacks
    to carry cs_change=1, leaving CS permanently asserted after the
    conversion. Fix by moving both calls into the out_unlock: block, after
    keep_cs_asserted is cleared, matching the pattern already used in
    ad_sd_calibrate().
    
    In the error path of ad_sd_buffer_postenable(), if an operation fails
    after set_mode(AD_SD_MODE_CONTINUOUS) has already succeeded (e.g.
    spi_offload_trigger_enable()), the device is left in continuous
    conversion mode with CS physically asserted. Additionally,
    bus_locked remaining true after spi_bus_unlock() causes subsequent
    SPI operations to call spi_sync_locked() without the bus lock actually
    held, allowing concurrent SPI access.
    
    Fix the error path by clearing keep_cs_asserted first, then calling
    set_mode(AD_SD_MODE_IDLE) to revert the device mode and deassert CS,
    then clearing bus_locked before releasing the bus.
    
    For devices that implement neither set_mode nor disable_one (such as
    MAX11205, which has no physical CS pin), no SPI transfer is issued
    during cleanup and the cs_change flag has no effect on any physical
    line.
    
    Fixes: 132d44dc6966 ("iio: adc: ad_sigma_delta: Check for previous ready signals")
    Signed-off-by: Radu Sabau <radu.sabau@analog.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: adc: lpc32xx: Initialize completion before requesting IRQ [+ + +]
Author: Maxwell Doose <m32285159@gmail.com>
Date:   Fri Jun 12 19:58:10 2026 -0500

    iio: adc: lpc32xx: Initialize completion before requesting IRQ
    
    commit e561b35633f450ee607e87a6401d97f156a0cd54 upstream.
    
    In the report from Jaeyoung Chung:
    
    "lpc32xx_adc_probe() in drivers/iio/adc/lpc32xx_adc.c registers its
    interrupt handler with devm_request_irq() before it initializes
    st->completion with init_completion(). If an interrupt arrives after
    devm_request_irq() and before init_completion(), the handler calls
    complete() on an uninitialized completion, causing a kernel panic.
    
    The probe path, in lpc32xx_adc_probe():
    
        iodev = devm_iio_device_alloc(&pdev->dev, sizeof(*st)); /* st kzalloc-zeroed */
        ...
        retval = devm_request_irq(&pdev->dev, irq, lpc32xx_adc_isr, 0,
                                  LPC32XXAD_NAME, st);           /* register handler */
        ...
        init_completion(&st->completion);                       /* initialize completion */
    
    lpc32xx_adc_isr() calls complete():
    
        complete(&st->completion);
    
    If the device raises an interrupt before init_completion() runs,
    complete() acquires the uninitialized wait.lock and walks the zeroed
    task_list in swake_up_locked(). The zeroed task_list makes list_empty()
    return false, so swake_up_locked() dereferences a NULL list entry,
    triggering a KASAN wild-memory-access."
    
    Fix the chance of a spurious IRQ causing an uninitialized pointer
    dereference by moving init_completion() above devm_request_irq().
    
    Fixes: 7901b2a1453e ("staging:iio:adc:lpc32xx rename local state structure to _state")
    Reported-by: Sangyun Kim <sangyun.kim@snu.ac.kr>
    Reported-by: Kyungwook Boo <bookyungwook@gmail.com>
    Reported-by: Jaeyoung Chung <jjy600901@snu.ac.kr>
    Closes: https://lore.kernel.org/linux-iio/20260610115700.774689-1-jjy600901@snu.ac.kr/
    Signed-off-by: Maxwell Doose <m32285159@gmail.com>
    Reviewed-by: Vladimir Zapolskiy <vz@kernel.org>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: adc: nxp-sar-adc: Fix the delay calculation in nxp_sar_adc_wait_for() [+ + +]
Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date:   Tue May 19 23:56:06 2026 +0200

    iio: adc: nxp-sar-adc: Fix the delay calculation in nxp_sar_adc_wait_for()
    
    commit a9f41809bf1bd8e5c1bc4b6a1052adac58eb7ab6 upstream.
    
    The original code was using ndelay() twice. In one case the delay
    is calculated as 1/3 of ADC clock and in the other as 80 ADC clocks.
    But according to the comments in all cases it should be a multiplier
    of the ADC clock, and not a fraction of it. Inadvertently
    nxp_sar_adc_wait_for() takes the wrong case and spread it over
    the code make it wrong in all places. Fix this by modifying a helper
    to correctly use the multiplier.
    
    Fixes: 7e5c0f97c66a ("iio: adc: nxp-sar-adc: Avoid division by zero")
    Fixes: 4434072a893e ("iio: adc: Add the NXP SAR ADC support for the s32g2/3 platforms")
    Reported-by: Sashiko <sashiko-bot@kernel.org>
    Closes: https://sashiko.dev/#/patchset/20260416090122.758990-1-andriy.shevchenko%40linux.intel.com
    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Reviewed-by: Stepan Ionichev <sozdayvek@gmail.com>
    Acked-by: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: adc: spear: Initialize completion before requesting IRQ [+ + +]
Author: Maxwell Doose <m32285159@gmail.com>
Date:   Fri Jun 12 19:58:11 2026 -0500

    iio: adc: spear: Initialize completion before requesting IRQ
    
    commit 3ee2128b6f0eb0be7b6cb8f6e0f1f113a65201a0 upstream.
    
    In the report from Jaeyoung Chung:
    
    "spear_adc_probe() in drivers/iio/adc/spear_adc.c registers its
    interrupt handler with devm_request_irq() before it initializes
    st->completion with init_completion(). If an interrupt arrives after
    devm_request_irq() and before init_completion(), the handler calls
    complete() on an uninitialized completion, causing a kernel panic.
    
    The probe path, in spear_adc_probe():
    
        iodev = devm_iio_device_alloc(&pdev->dev, sizeof(*st)); /* st kzalloc-zeroed */
        ...
        retval = devm_request_irq(&pdev->dev, irq, spear_adc_isr, 0,
                                  LPC32XXAD_NAME, st);           /* register handler */
        ...
        init_completion(&st->completion);                       /* initialize completion */
    
    spear_adc_isr() calls complete():
    
        complete(&st->completion);
    
    If the device raises an interrupt before init_completion() runs,
    complete() acquires the uninitialized wait.lock and walks the zeroed
    task_list in swake_up_locked(). The zeroed task_list makes list_empty()
    return false, so swake_up_locked() dereferences a NULL list entry,
    triggering a KASAN wild-memory-access."
    
    Fix the chance of a spurious IRQ causing an uninitialized pointer
    dereference by moving init_completion() above devm_request_irq().
    
    Fixes: b586e5d9eee0 ("staging:iio:adc:spear rename device specific state structure to _state")
    Reported-by: Sangyun Kim <sangyun.kim@snu.ac.kr>
    Reported-by: Kyungwook Boo <bookyungwook@gmail.com>
    Reported-by: Jaeyoung Chung <jjy600901@snu.ac.kr>
    Closes: https://lore.kernel.org/linux-iio/20260610115700.774689-1-jjy600901@snu.ac.kr/
    Signed-off-by: Maxwell Doose <m32285159@gmail.com>
    Reviewed-by: Vladimir Zapolskiy <vz@kernel.org>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: adc: ti-ads1119: fix PM reference leak in buffer preenable [+ + +]
Author: Guangshuo Li <lgs201920130244@gmail.com>
Date:   Wed Jun 3 20:16:40 2026 +0800

    iio: adc: ti-ads1119: fix PM reference leak in buffer preenable
    
    commit adf4bc07f814da8329278d32600147f5a150938c upstream.
    
    ads1119_triggered_buffer_preenable() resumes the device with
    pm_runtime_resume_and_get() before starting a conversion.
    
    If i2c_smbus_write_byte() fails, the function returns the error directly
    and leaves the runtime PM usage counter elevated. The matching
    postdisable callback is not called when preenable fails, so the reference
    is leaked and the device may remain runtime-active indefinitely.
    
    Store the I2C transfer result in ret and drop the runtime PM reference on
    failure before returning the error.
    
    Fixes: a9306887eba41 ("iio: adc: ti-ads1119: Add driver")
    Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: adc: ti-ads124s08: Return reset GPIO lookup errors [+ + +]
Author: Pengpeng Hou <pengpeng@iscas.ac.cn>
Date:   Thu Jun 25 13:44:07 2026 +0800

    iio: adc: ti-ads124s08: Return reset GPIO lookup errors
    
    commit 7dc4de2aa6316f1d044cde21f5acfec5f3ec6b47 upstream.
    
    devm_gpiod_get_optional() returns NULL when the optional GPIO is absent,
    but returns an ERR_PTR when the GPIO provider lookup fails, including
    probe deferral.
    
    Probe currently logs the ERR_PTR case as if the reset GPIO were simply
    absent and keeps the error pointer in reset_gpio. Later ads124s_reset()
    treats any non-NULL reset_gpio as a valid descriptor and passes it to
    gpiod_set_value_cansleep().
    
    Return the lookup error instead of retaining the ERR_PTR.
    
    Fixes: e717f8c6dfec ("iio: adc: Add the TI ads124s08 ADC code")
    Cc: stable@vger.kernel.org
    Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
    Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: backend: fix uninitialized data in debugfs [+ + +]
Author: Dan Carpenter <error27@gmail.com>
Date:   Mon May 25 10:16:11 2026 +0300

    iio: backend: fix uninitialized data in debugfs
    
    commit a6e8b14a4897d0b6df9744f33d0a30e6b92368eb upstream.
    
    If the *ppos value is non-zero then simple_write_to_buffer() will not
    initialize the start of the buf[] buffer.  Non-zero ppos values aren't
    going to work at all.  Check for that at the start of the function and
    return -ENOSPC.
    
    Fixes: cdf01e0809a4 ("iio: backend: add debugFs interface")
    Signed-off-by: Dan Carpenter <error27@gmail.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: buffer: hw-consumer: free scan_mask on buffer release [+ + +]
Author: Felix Gu <ustc.gu@gmail.com>
Date:   Mon Apr 27 19:11:39 2026 +0800

    iio: buffer: hw-consumer: free scan_mask on buffer release
    
    commit 6325d6e2204327965b849c0a16efb6ac9202e5a8 upstream.
    
    The scan_mask lifetime changed in commit 9a2e1233d38c ("iio: buffer:
    hw-consumer: remove redundant scan_mask flexible array").
    
    Before that change, the scan mask storage was embedded in struct
    hw_consumer_buffer, so iio_hw_buf_release() could free the whole
    allocation with a single kfree(hw_buf).
    
    That commit moved the scan mask to a separate bitmap_zalloc() allocation
    stored in buffer.scan_mask, but left iio_hw_buf_release() unchanged.
    
    Free the scan mask in iio_hw_buf_release() before freeing the buffer
    wrapper.
    
    Fixes: 9a2e1233d38c ("iio: buffer: hw-consumer: remove redundant scan_mask flexible array")
    Signed-off-by: Felix Gu <ustc.gu@gmail.com>
    Reviewed-by: Nuno Sá <nuno.sa@analog.com>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: chemical: scd30: Cleanup initializations and fix sign-extension bug [+ + +]
Author: Maxwell Doose <m32285159@gmail.com>
Date:   Tue May 26 17:55:24 2026 -0500

    iio: chemical: scd30: Cleanup initializations and fix sign-extension bug
    
    commit 60d877910a43c305b5165131b258a17b1d772d57 upstream.
    
    Include linux/bitfield.h for FIELD_GET().
    
    Create new macros for bit manipulation in combination with manual bit
    manipulation being replaced with FIELD_GET().
    
    The current variable declaration and initializations are barely readable
    and use comma separations across multiple lines. Refactor the
    initializations so that mantissa and exp have separate declarations and
    sign gets initialized later.
    
    In addition (and due to the nature of the cleanup), fix a sign-extension
    bug where, float32 would get bitwise anded with ~BIT(31)
    (which is 0xFFFFFFFF7FFFFFFF) which corrupted the exponent.
    
    Fixes: 64b3d8b1b0f5c ("iio: chemical: scd30: add core driver")
    Reported-by: sashiko <sashiko-bot@kernel.org>
    Closes: https://sashiko.dev/#/patchset/20260524020309.18618-1-m32285159%40gmail.com
    Signed-off-by: Maxwell Doose <m32285159@gmail.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: common: st_sensors: honour channel endianness in read_axis_data [+ + +]
Author: Herman van Hazendonk <github.com@herrie.org>
Date:   Tue Jun 16 15:02:04 2026 +0200

    iio: common: st_sensors: honour channel endianness in read_axis_data
    
    commit 55052184ac9011db2ea983e54d6c21f0b1079a12 upstream.
    
    st_sensors_read_axis_data() unconditionally decoded multi-byte
    results with get_unaligned_le16() / get_unaligned_le24() regardless
    of the channel's declared scan_type.endianness.
    
    For every ST sensor that has used this helper since it was introduced
    this happened to be fine because the ST IMU/accel/gyro/pressure
    families publish their data registers as little-endian and the
    channel specs in those drivers declare IIO_LE accordingly.
    
    The LSM303DLH magnetometer however publishes its X/Y/Z output as a
    pair of big-endian bytes (the H register sits at the lower address,
    0x03/0x05/0x07, and the L register immediately after), and its
    channel specs in st_magn_core.c correctly declare IIO_BE -- but
    read_axis_data() ignored that and decoded as little-endian, swapping
    the high and low bytes of every magnetometer sample. The LSM303DLHC
    and LSM303DLM share the same st_magn_16bit_channels (IIO_BE) and
    were therefore byte-swapped by the same bug; users of those parts
    will see different in_magn_*_raw values after this fix lands.
    
    The bug is most visible on a stationary chip: in earth's field the
    true X reading is small and the high byte sits at 0x00, so swapping
    the bytes pins sysfs X at exactly the low byte's pattern (e.g. 0x00F0
    = 240). Y and Z still appear "to vary" because their magnitudes are
    larger and the noise in the low byte produces big swings in the
    swapped high byte:
    
      before (LSM303DLH flat, sysfs in_magn_*_raw):
          X=240 (stuck), Y= 12032..23296, Z=-16128..-9728
    
      after (direct i2c-dev big-endian decode, same chip same orientation):
          X≈-4096, Y≈210, Z≈80     (sensible values reflecting earth's
                                    ambient field at low gauss range)
    
    Fix read_axis_data() to dispatch on ch->scan_type.endianness and
    call get_unaligned_be16() / get_unaligned_be24() when the channel
    declares IIO_BE. Existing IIO_LE consumers (st_accel, st_gyro,
    st_pressure, st_lsm6dsx and others) are unaffected because their
    channel specs already declare IIO_LE and the LE path is unchanged.
    
    While restructuring the branches, replace the previously implicit
    silent-success-with-uninitialised-*data fall-through for
    byte_for_channel outside 1..3 with an explicit return -EINVAL. No
    in-tree ST sensor publishes such a channel, but the new behaviour
    is strictly safer than handing userspace garbage.
    
    Fixes: 23491b513bcd ("iio:common: Add STMicroelectronics common library")
    Cc: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4-7 sparse smatch clang-analyzer coccinelle checkpatch
    Assisted-by: Sashiko:claude-opus-4-7
    Signed-off-by: Herman van Hazendonk <github.com@herrie.org>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: core: fix uninitialized data in debugfs [+ + +]
Author: Dan Carpenter <error27@gmail.com>
Date:   Mon May 25 10:16:27 2026 +0300

    iio: core: fix uninitialized data in debugfs
    
    commit ab92ed206d41fd171ebd37bc46360d9f2140d043 upstream.
    
    If *ppos is non-zero then simple_write_to_buffer() will not initialize
    the start of buf[].  Non zero values for *ppos aren't going to work
    anyway.  Test for them at the start of the function and return -EINVAL.
    
    Fixes: 6d5dd486c715 ("iio: core: make use of simple_write_to_buffer()")
    Signed-off-by: Dan Carpenter <error27@gmail.com>
    Reviewed-by: Maxwell Doose <m32285159@gmail.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: dac: ad3552r-hs: fix uninitialized data ni ad3552r_hs_write_data_source() [+ + +]
Author: Dan Carpenter <error27@gmail.com>
Date:   Mon May 25 10:15:46 2026 +0300

    iio: dac: ad3552r-hs: fix uninitialized data ni ad3552r_hs_write_data_source()
    
    commit eaaa7eef181892ef7ba56c6295b81f0ae4492c13 upstream.
    
    If the *ppos value is non-zero then the simple_write_to_buffer() function
    won't initialized the start of the buf[] buffer.  Non-zero values for
    *ppos won't work here generally, so just test for them and return -ENOSPC
    at the start of the function.
    
    Fixes: b1c5d68ea66e ("iio: dac: ad3552r-hs: add support for internal ramp")
    Signed-off-by: Dan Carpenter <error27@gmail.com>
    Reviewed-by: Angelo Dureghello <adureghello@baylibre.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: event: Fix event FIFO reset race [+ + +]
Author: Lars-Peter Clausen <lars@metafoo.de>
Date:   Mon Jul 6 21:48:26 2026 -0700

    iio: event: Fix event FIFO reset race
    
    commit af791d295737ea6b6ff2c8d8488462a49c14af01 upstream.
    
    `iio_event_getfd()` creates the event file descriptor with
    `anon_inode_getfd()`, which allocates a new fd, creates the anonymous
    file and installs it in the process fd table before returning to the
    caller.
    
    The IIO code resets the event FIFO after `anon_inode_getfd()` has returned,
    but before `IIO_GET_EVENT_FD_IOCTL` has copied the fd number to userspace.
    But since fd tables are shared between threads, another thread can guess
    the newly allocated fd number and issue a `read()` on it as soon as the fd
    has been installed.
    
    This means the `kfifo_to_user()` in `iio_event_chrdev_read()` can run in
    parallel with the `kfifo_reset_out()` in `iio_event_getfd()`.
    
    The kfifo documentation says that `kfifo_reset_out()` is only safe when it
    is called from the reader thread and there is only one concurrent reader.
    Otherwise it is dangerous and must be handled in the same way as
    `kfifo_reset()`.
    
    If that happens, `kfifo_to_user()` can advance the FIFO `out` index based
    on state from before the reset, after the reset has already moved the `out`
    index to the current `in` index. That can leave the FIFO with an `out`
    index past the `in` index. A later `read()` can then see an underflowed
    FIFO length and copy more data than the event FIFO buffer contains. This
    can result in an out-of-bounds read and leak adjacent kernel memory to
    userspace.
    
    Move the FIFO reset before `anon_inode_getfd()`. At that point the event fd is
    marked busy, but the new fd has not been installed yet, so userspace cannot
    access it while the FIFO is reset.
    
    Fixes: b91accafbb10 ("iio:event: Fix and cleanup locking")
    Reported-by: Codex:gpt-5.5
    Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
    Reviewed-by: Nuno Sá <nuno.sa@analog.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: gyro: bmg160: bail out when bandwidth/filter is not in table [+ + +]
Author: Stepan Ionichev <sozdayvek@gmail.com>
Date:   Sun May 10 07:35:00 2026 +0500

    iio: gyro: bmg160: bail out when bandwidth/filter is not in table
    
    commit 8320c77e67382d5d55d77043a5f60a867d408a2b upstream.
    
    bmg160_get_filter() walks bmg160_samp_freq_table[] looking for the entry
    matching the bw_bits value read from the chip:
    
            for (i = 0; i < ARRAY_SIZE(bmg160_samp_freq_table); ++i) {
                    if (bmg160_samp_freq_table[i].bw_bits == bw_bits)
                            break;
            }
            *val = bmg160_samp_freq_table[i].filter;
    
    If no entry matches, i ends up equal to the array size and the next line
    reads one slot past the end. bmg160_set_filter() has the same shape, driven
    by 'val' instead of bw_bits.
    
    smatch flags both:
    
      drivers/iio/gyro/bmg160_core.c:204 bmg160_get_filter() error:
      buffer overflow 'bmg160_samp_freq_table' 7 <= 7
      drivers/iio/gyro/bmg160_core.c:222 bmg160_set_filter() error:
      buffer overflow 'bmg160_samp_freq_table' 7 <= 7
    
    Return -EINVAL when no entry matches.
    
    The set_filter() path is reachable from userspace via the sysfs
    in_anglvel_filter_low_pass_3db_frequency interface, so userspace can
    trivially trigger the out-of-bounds read with a value that is not in
    bmg160_samp_freq_table[].filter.
    
    Fixes: 22b46c45fb9b ("iio:gyro:bmg160 Gyro Sensor driver")
    Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: gyro: bmg160: wait full startup time after mode change at probe [+ + +]
Author: Stepan Ionichev <sozdayvek@gmail.com>
Date:   Mon May 11 11:40:20 2026 +0500

    iio: gyro: bmg160: wait full startup time after mode change at probe
    
    commit 088fcb9b567f8723074ad9eb1bf5cb46f8a0096b upstream.
    
    bmg160_chip_init() calls bmg160_set_mode(BMG160_MODE_NORMAL) and
    then waits only 500-1000 us. Per the BMG160 datasheet
    (BST-BMG160-DS000-07 Rev. 1.0, May 2013), the start-up and wake-up
    times (tsu, twusm) are 30 ms.
    
    The same file already waits BMG160_MAX_STARTUP_TIME_MS (80 ms)
    in bmg160_runtime_resume() after the same set_mode(NORMAL)
    operation. The 500 us value at probe was likely a unit mix-up;
    the old comment said "500 ms" while the code used microseconds.
    
    Reuse the same constant via msleep() and add a code comment
    explaining the datasheet basis for the wait. Without this,
    register writes that follow the mode change can hit the chip
    before it is ready.
    
    Fixes: 22b46c45fb9b ("iio:gyro:bmg160 Gyro Sensor driver")
    Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: imu: adis: add IRQF_NO_THREAD to non-FIFO trigger IRQ [+ + +]
Author: Runyu Xiao <runyu.xiao@seu.edu.cn>
Date:   Thu Jun 4 09:42:46 2026 +0800

    iio: imu: adis: add IRQF_NO_THREAD to non-FIFO trigger IRQ
    
    commit 6e1b9bff1202da55c464e36bd34a2b6863d7fe30 upstream.
    
    devm_adis_probe_trigger() registers iio_trigger_generic_data_rdy_poll()
    through devm_request_irq() on the non-FIFO path, but it does not add
    IRQF_NO_THREAD to the IRQ flags.
    
    When the kernel is booted with forced IRQ threading, the parent IRQ can
    otherwise be threaded by the IRQ core and the subsequent IIO trigger
    child IRQ is then dispatched from irq/... thread context instead of
    hardirq context. Because iio_trigger_generic_data_rdy_poll()
    immediately drives iio_trigger_poll(), this violates the hardirq-only
    IIO trigger helper contract and can push downstream trigger consumers
    through the wrong execution context.
    
    Add IRQF_NO_THREAD on top of the existing adis->irq_flag value for the
    non-FIFO request_irq() path, while preserving the current trigger
    polarity and IRQF_NO_AUTOEN behavior.
    
    Fixes: fec86c6b8369 ("iio: imu: adis: Add Managed device functions")
    Cc: stable@vger.kernel.org
    Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: imu: bmi160: add IRQF_NO_THREAD to data-ready trigger IRQ [+ + +]
Author: Runyu Xiao <runyu.xiao@seu.edu.cn>
Date:   Thu Jun 4 09:42:47 2026 +0800

    iio: imu: bmi160: add IRQF_NO_THREAD to data-ready trigger IRQ
    
    commit cd5a6a5096b246e10600da3ac47a1274ce9573c8 upstream.
    
    bmi160_probe_trigger() registers iio_trigger_generic_data_rdy_poll()
    through devm_request_irq(), but it passes only irq_type and does not add
    IRQF_NO_THREAD.
    
    When the kernel is booted with forced IRQ threading, the parent IRQ can
    otherwise be threaded by the IRQ core and the subsequent IIO trigger
    child IRQ is dispatched from irq/... thread context instead of hardirq
    context. Because the handler immediately pushes the event into
    iio_trigger_poll(), this violates the hardirq-only IIO trigger helper
    contract and can drive downstream trigger consumers through the wrong
    execution context.
    
    Add IRQF_NO_THREAD on top of irq_type when registering the BMI160 data-
    ready trigger handler.
    
    Fixes: 895bf81e6bbf ("iio:bmi160: add drdy interrupt support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: imu: inv_icm42600: fix timestamp clock period by using lower value [+ + +]
Author: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Date:   Tue Jun 23 16:22:15 2026 +0200

    iio: imu: inv_icm42600: fix timestamp clock period by using lower value
    
    commit 8b0b864c11a2e2ada470f9d5010e1c2bf1eceef2 upstream.
    
    Clock period value is used for computing periods of sampling. There is
    no need for it to be higher than the maximum odr, otherwise we are
    losing precision in the computation for nothing.
    
    Switch clock period value to maximum odr period (8kHz).
    
    Fixes: 0ecc363ccea7 ("iio: make invensense timestamp module generic")
    Cc: stable@vger.kernel.org
    Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: imu: inv_icm42600: fix timestamping by limiting FIFO reading [+ + +]
Author: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Date:   Mon Jun 29 21:51:55 2026 +0200

    iio: imu: inv_icm42600: fix timestamping by limiting FIFO reading
    
    commit affe3f077d7a4eeb25937f5323ff059a54b4712c upstream.
    
    Timestamps are made by measuring the chip clock using the watermark
    interrupts. If we read more than watermark samples as done today, we
    are reducing the period between interrupts and distort the time
    measurement. Fix that by reading only watermark samples in the
    interrupt case.
    
    Fixes: 7f85e42a6c54 ("iio: imu: inv_icm42600: add buffer support in iio devices")
    Cc: stable@vger.kernel.org
    Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: imu: st_lsm6dsx: deselect shub page before reading whoami [+ + +]
Author: Andreas Kempe <andreas.kempe@actia.se>
Date:   Thu Jul 2 10:41:23 2026 +0000

    iio: imu: st_lsm6dsx: deselect shub page before reading whoami
    
    commit aede83625ff5d9539508582036df30c809d51058 upstream.
    
    As part of driver initialization, e.g. st_lsm6dsx_init_shub() selects
    the shub register page using st_lsm6dsx_set_page(). Selecting the shub
    register page shadows the regular register space so whoami, among other
    registers, is no longer accessible.
    
    In applications where the IMU is permanently powered separately from the
    processor, there is a window where a reset of the CPU leaves the IMU in
    the shub register page. Once this occurs, any subsequent probe attempt
    fails because of the register shadowing.
    
    Using the ism330dlc, the error typically looks like
    
        st_lsm6dsx_i2c 3-006a: unsupported whoami [10]
    
    with the unknown whoami read from a reserved register in the shub page.
    
    The reset register is also shadowed by the page select, preventing a
    reset from recovering the chip.
    
    Unconditionally clear the shub page before the whoami readout to ensure
    normal register access and allow the initialization to proceed.
    
    Place the fix in st_lsm6dsx_check_whoami() before the whoami check
    because hw->settings, which st_lsm6dsx_set_page() relies on, is first
    assigned in that function.
    
    Placing the fix in a more logical place than the whoami check would
    require a bigger restructuring of the code.
    
    Fixes: c91c1c844ebd ("iio: imu: st_lsm6dsx: add i2c embedded controller support")
    Signed-off-by: Andreas Kempe <andreas.kempe@actia.se>
    Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: light: al3000a: add missing REGMAP_I2C to Kconfig [+ + +]
Author: Joshua Crofts <joshua.crofts1@gmail.com>
Date:   Thu Jun 25 21:38:08 2026 +0200

    iio: light: al3000a: add missing REGMAP_I2C to Kconfig
    
    commit a2d30022b7c316ad845d1b696e724058b88e5a4e upstream.
    
    The KConfig entry for the al3000a is missing a `select REGMAP_I2C`,
    causing build failures.
    
    Fixes: d531b9f78949 ("iio: light: Add support for AL3000a illuminance sensor")
    Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
    Reviewed-by: David Heidelberg <david@ixit.cz>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: light: al3010: add missing REGMAP_I2C to Kconfig [+ + +]
Author: Joshua Crofts <joshua.crofts1@gmail.com>
Date:   Thu Jun 25 21:38:09 2026 +0200

    iio: light: al3010: add missing REGMAP_I2C to Kconfig
    
    commit 84486e3bbda18a2df1ed74ca78e1e14bde9a941b upstream.
    
    The KConfig entry for the AL3010 is missing a `select REGMAP_I2C`,
    causing build failures.
    
    Fixes: 0e5e21e23dd6 ("iio: light: al3010: Implement regmap support")
    Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
    Reviewed-by: David Heidelberg <david@ixit.cz>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: light: al3010: fix incorrect scale for the highest gain range [+ + +]
Author: Vidhu Sarwal <vidhu.linux@gmail.com>
Date:   Sat Jul 4 17:22:45 2026 +0530

    iio: light: al3010: fix incorrect scale for the highest gain range
    
    commit aa411adc6ce40ad1a55ebc965f255a4cfc0005f8 upstream.
    
    al3010_scales[] encodes the highest gain range as {0, 1187200}.
    For IIO_VAL_INT_PLUS_MICRO, the fractional part must be less than
    1000000, so the scale 1.1872 should instead be represented as
    { 1, 187200 }.
    
    Since write_raw() compares the value from userspace against this
    table, writing the advertised 1.1872 scale never matches the malformed
    entry and returns -EINVAL. As a result, the highest gain range cannot
    be selected. Reading the scale in that state also reports the malformed
    value.
    
    Fixes: c36b5195ab70 ("iio: light: add Dyna-Image AL3010 driver")
    Signed-off-by: Vidhu Sarwal <vidhu.linux@gmail.com>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: light: al3010: read both ALS ADC registers again [+ + +]
Author: Alexander A. Klimov <grandmaster@al2klimov.de>
Date:   Sat May 23 13:44:57 2026 +0200

    iio: light: al3010: read both ALS ADC registers again
    
    commit ee78fae068f52a5582aaf448d9414f826855c106 upstream.
    
    al3010_read_raw() used to read two adjacent registers
    until the driver was modernized using the regmap framework.
    That cleanup accidentally replaced the 16-bit word read
    with a single byte read. I'm reverting latter.
    
    Fixes: 0e5e21e23dd6 ("iio: light: al3010: Implement regmap support")
    Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: light: al3320a: add missing REGMAP_I2C to Kconfig [+ + +]
Author: Joshua Crofts <joshua.crofts1@gmail.com>
Date:   Thu Jun 25 21:38:10 2026 +0200

    iio: light: al3320a: add missing REGMAP_I2C to Kconfig
    
    commit 9efcc9ba9b2e940cc01e63d132ae741e4c5d09c7 upstream.
    
    The Kconfig entry for the al3320a is missing a `select REGMAP_I2C`,
    causing build failures.
    
    Fixes: 1850e6ae7f91 ("iio: light: al3320a: Implement regmap support")
    Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
    Reviewed-by: David Heidelberg <david@ixit.cz>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: light: al3320a: read both ALS ADC registers again [+ + +]
Author: Alexander A. Klimov <grandmaster@al2klimov.de>
Date:   Sat May 23 13:44:58 2026 +0200

    iio: light: al3320a: read both ALS ADC registers again
    
    commit 744bccc2647c6b2206290e8e40890a23812116b3 upstream.
    
    al3320a_read_raw() used to read two adjacent registers
    until the driver was modernized using the regmap framework.
    That cleanup accidentally replaced the 16-bit word read
    with a single byte read. I'm reverting latter.
    
    Fixes: 1850e6ae7f91 ("iio: light: al3320a: Implement regmap support")
    Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: light: gp2ap002: fix runtime PM leak on read error [+ + +]
Author: Biren Pandya <birenpandya@gmail.com>
Date:   Sun Jun 14 12:45:49 2026 +0530

    iio: light: gp2ap002: fix runtime PM leak on read error
    
    commit 38b72267b7e22768a1f26d9935de4e1752a1dc85 upstream.
    
    gp2ap002_read_raw() calls pm_runtime_get_sync() before reading the
    lux value, but if gp2ap002_get_lux() fails, it returns directly. This
    skips the pm_runtime_put_autosuspend() call at the "out" label,
    permanently leaking a runtime PM reference and preventing the device
    from autosuspending.
    
    Replace the direct return with a "goto out" to ensure the reference
    is properly dropped on the error path.
    
    Fixes: f6dbf83c17cb ("iio: light: gp2ap002: Take runtime PM reference on light read")
    Signed-off-by: Biren Pandya <birenpandya@gmail.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: light: opt3001: fix missing state reset on timeout [+ + +]
Author: Joshua Crofts <joshua.crofts1@gmail.com>
Date:   Tue May 26 13:15:29 2026 +0200

    iio: light: opt3001: fix missing state reset on timeout
    
    commit c123ca6ee26ad98f70a866ff428b08145c5a24fe upstream.
    
    Currently in the function opt3001_get_processed(), there is a check
    that directly returns -ETIMEDOUT if the conversion IRQ times out,
    completely bypassing the err label, leaving ok_to_ignore_lock
    permanently true, potentially breaking the device's falling threshold
    interrupt detection.
    
    Assign -ETIMEDOUT to the return variable and jump to the error label
    to ensure ok_to_ignore_lock is properly reset.
    
    Fixes: 26d90b559057 ("iio: light: opt3001: Fixed timeout error when 0 lux")
    Reported-by: Sashiko <sashiko-bot@kernel.org>
    Closes: https://sashiko.dev/#/patchset/20260525-opt3001-cleanup-v4-0-65b36a174f78%40gmail.com?part=1
    Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: light: tsl2591: return actual error from probe IRQ failure [+ + +]
Author: Stepan Ionichev <sozdayvek@gmail.com>
Date:   Mon May 18 14:43:11 2026 +0500

    iio: light: tsl2591: return actual error from probe IRQ failure
    
    commit a00ffd15674bfaf8b906503c1600e3d8709af56c upstream.
    
    When devm_request_threaded_irq() fails, probe logs the error and
    then returns -EINVAL, dropping the real error code and breaking the
    deferred-probe flow for -EPROBE_DEFER.
    
    Return ret directly; the IRQ subsystem already prints on failure.
    
    Fixes: 2335f0d7c790 ("iio: light: Added AMS tsl2591 driver implementation")
    Cc: stable@vger.kernel.org
    Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: light: veml6030: fix channel type when pushing events [+ + +]
Author: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Date:   Thu May 14 14:01:11 2026 +1300

    iio: light: veml6030: fix channel type when pushing events
    
    commit c52bb33b641ebaae3e209f97714cb1758206f7d9 upstream.
    
    The events are registered for IIO_LIGHT and not for IIO_INTENSITY.
    Use the correct channel type.
    
    When at it, fix minor checkpatch code style warning (alignment).
    
    Cc: stable@vger.kernel.org
    Fixes: 7b779f573c48 ("iio: light: add driver for veml6030 ambient light sensor")
    Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: magnetometer: ak8975: Add missed pm_runtime_put_autosuspend() call [+ + +]
Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date:   Wed May 6 10:27:55 2026 +0200

    iio: magnetometer: ak8975: Add missed pm_runtime_put_autosuspend() call
    
    commit e94944d7364d3ddb273539492f9bd9c9a622549a upstream.
    
    On the failure in the ak8975_read_axis() the PM runtime gets unbalanced.
    Balance it by calling pm_runtime_put_autosuspend() on error path as well.
    
    Fixes: cde4cb5dd422 ("iio: magn: ak8975: deploy runtime and system PM")
    Reported-by: Sashiko <sashiko-bot@kernel.org>
    Closes: https://sashiko.dev/#/patchset/20260505-magnetometer-fixes-v5-0-831b9b5550fc%40gmail.com
    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: pressure: bmp280: zero-init bmp580 trigger handler buffer [+ + +]
Author: David Carlier <devnexen@gmail.com>
Date:   Tue May 5 18:34:55 2026 +0100

    iio: pressure: bmp280: zero-init bmp580 trigger handler buffer
    
    commit 1172160f2a2de7bade3bec64b8c5ecf945cde5ed upstream.
    
    bmp580_trigger_handler() builds an on-stack scan buffer containing
    two __le32 fields and an aligned_s64 timestamp, and pushes it to
    userspace via iio_push_to_buffers_with_ts(). However, only the low
    3 bytes of each __le32 field are populated by the device data:
    
            memcpy(&buffer.comp_press, &data->buf[3], 3);
            memcpy(&buffer.comp_temp,  &data->buf[0], 3);
    
    The high byte of each field is left uninitialised on the stack.
    The bmp580 channels declare storagebits = 32, so the IIO core
    transports all four bytes per sample to userspace as part of the
    scan element, leaking two bytes of kernel stack per scan.
    
    Zero-initialise the buffer before populating it, mirroring the fix
    applied to bme280_trigger_handler() in commit 018f50909e66 ("iio:
    bmp280: zero-init buffer").
    
    Fixes: 872c8014e05e ("iio: pressure: bmp280: drop sensor_data array")
    Cc: stable@vger.kernel.org
    Signed-off-by: David Carlier <devnexen@gmail.com>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: pressure: mpl115: fix runtime PM leak on read error [+ + +]
Author: Biren Pandya <birenpandya@gmail.com>
Date:   Sun Jun 14 12:45:48 2026 +0530

    iio: pressure: mpl115: fix runtime PM leak on read error
    
    commit fbe67ff37a6fd855a6c097f84f3738bd13d0a898 upstream.
    
    mpl115_read_raw() takes a runtime PM reference with pm_runtime_get_sync()
    before reading the processed pressure or raw temperature, but on the read
    error path it returns without calling pm_runtime_put_autosuspend(). Each
    failed read therefore leaks a runtime PM reference and prevents the device
    from autosuspending.
    
    Drop the reference before checking the return value so both the success
    and error paths are balanced.
    
    Fixes: 0c3a333524a3 ("iio: pressure: mpl115: Implementing low power mode by shutdown gpio")
    Signed-off-by: Biren Pandya <birenpandya@gmail.com>
    Assisted-by: Claude:claude-opus-4-8 coccinelle
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: proximity: vl53l0x: notify trigger and clear IRQ on error paths [+ + +]
Author: Stepan Ionichev <sozdayvek@gmail.com>
Date:   Thu May 14 19:37:10 2026 +0500

    iio: proximity: vl53l0x: notify trigger and clear IRQ on error paths
    
    commit be843b0579f872ec7590d825e2c9a656d4790c4b upstream.
    
    vl53l0x_trigger_handler() returns directly on the I2C read failure
    paths without calling iio_trigger_notify_done() or vl53l0x_clear_irq().
    
    A single transient i2c_smbus_read_i2c_block_data() failure (negative
    errno or a short read) therefore leaves two pieces of state behind:
    
      - iio_trigger_notify_done() never decrements the trigger's use_count,
        so iio_trigger_poll_nested() silently drops further dispatches
        (see industrialio-trigger.c, the !atomic_read(&trig->use_count)
        guard);
      - vl53l0x_clear_irq() never writes SYSTEM_INTERRUPT_CLEAR, so the
        chip keeps the DRDY interrupt asserted.
    
    The sensor's buffer mode stays wedged from then on, recoverable only
    by re-binding the driver. The sibling driver vl53l1x-i2c.c handles
    exactly the same case correctly by jumping to a "notify_and_clear_irq"
    label that always calls both helpers; mirror that here.
    
    The bogus negative-int return value cast to irqreturn_t also goes
    away as a side effect.
    
    Fixes: 762186c6e7b1 ("iio: proximity: vl53l0x-i2c: Added continuous mode support")
    Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: resolver: ad2s1210: notify trigger and clear state on fault read error [+ + +]
Author: Stepan Ionichev <sozdayvek@gmail.com>
Date:   Fri May 15 18:31:38 2026 +0500

    iio: resolver: ad2s1210: notify trigger and clear state on fault read error
    
    commit 70247658d0e783c93b48fcbc3b81d99e992ff478 upstream.
    
    ad2s1210_trigger_handler() walks several scan-mask branches and uses
    "goto error_ret" to land on the iio_trigger_notify_done() teardown at
    the bottom of the function for every I/O error -- except the
    MOD_CONFIG fault-register read, which uses a bare "return ret":
    
            if (st->fixed_mode == MOD_CONFIG) {
                    unsigned int reg_val;
    
                    ret = regmap_read(st->regmap, AD2S1210_REG_FAULT, ®_val);
                    if (ret < 0)
                            return ret;
                    ...
            }
    
    Two problems on that path:
    
      - the handler returns a negative errno where the prototype expects
        an irqreturn_t (IRQ_HANDLED / IRQ_NONE), so the caller in the
        IIO core sees a value outside the enum;
      - iio_trigger_notify_done() is skipped, leaving the trigger
        busy-flag set. A single transient SPI/regmap error on the fault
        read then wedges the trigger so subsequent samples are dropped
        until the consumer is detached.
    
    Convert the error path to "goto error_ret" so the failure path goes
    through the same notify_done() teardown as every other error in the
    handler.
    
    Fixes: f9b9ff95be8c ("iio: resolver: ad2s1210: add support for adi,fixed-mode")
    Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
    Reviewed-by: David Lechner <dlechner@baylibre.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: temperature: Build mlx90635 with CONFIG_MLX90635 [+ + +]
Author: Pengpeng Hou <pengpeng@iscas.ac.cn>
Date:   Thu Jun 25 13:42:59 2026 +0800

    iio: temperature: Build mlx90635 with CONFIG_MLX90635
    
    commit 63a76e3a587c4143e8e24e8a6b0c232fa0676034 upstream.
    
    drivers/iio/temperature/Kconfig has a dedicated MLX90635 option, but
    the Makefile currently builds mlx90635.o under CONFIG_MLX90632.
    
    This means enabling CONFIG_MLX90635 alone does not carry its provider
    object into the build, while enabling CONFIG_MLX90632 unexpectedly also
    builds mlx90635.o.
    
    Gate mlx90635.o on the matching generated Kconfig symbol.
    
    Fixes: a1d1ba5e1c28 ("iio: temperature: mlx90635 MLX90635 IR Temperature sensor")
    Cc: stable@vger.kernel.org
    Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
    Acked-by: Crt Mori <cmo@melexis.com>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: temperature: ltc2983: Fix n_wires default bypassing rotation check [+ + +]
Author: Liviu Stan <liviu.stan@analog.com>
Date:   Mon May 25 19:39:28 2026 +0300

    iio: temperature: ltc2983: Fix n_wires default bypassing rotation check
    
    commit 434c150752675f44dc52c384a7fa22e5176bc35a upstream.
    
    When adi,number-of-wires is absent, n_wires is left at 0. The binding
    documents a default of 2 wires, matching the hardware default. However
    the current-rotate validation checks n_wires == 2 || n_wires == 3, so
    with n_wires = 0 the guard is bypassed and adi,current-rotate is accepted
    for a 2-wire RTD.
    
    Initialize n_wires = 2 to match the binding default and ensure the
    rotation check fires correctly when the property is absent.
    
    Fixes: f110f3188e56 ("iio: temperature: Add support for LTC2983")
    Signed-off-by: Liviu Stan <liviu.stan@analog.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: temperature: ltc2983: Fix reinit_completion() called after conversion start [+ + +]
Author: Liviu Stan <liviu.stan@analog.com>
Date:   Mon May 25 19:39:29 2026 +0300

    iio: temperature: ltc2983: Fix reinit_completion() called after conversion start
    
    commit 5cb9fdb446bfc3ae0524496f53fb68e67051701b upstream.
    
    reinit_completion() was called after regmap_write() initiated the hardware
    conversion, creating a race window where the interrupt could fire and call
    complete() before reinit_completion() reset the completion.
    
    Move reinit_completion() before the regmap_write() to close the race.
    ltc2983_eeprom_cmd() already does it in the correct order.
    
    Fixes: f110f3188e56 ("iio: temperature: Add support for LTC2983")
    Signed-off-by: Liviu Stan <liviu.stan@analog.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: temperature: tmp006: use devm_iio_trigger_register [+ + +]
Author: Stepan Ionichev <sozdayvek@gmail.com>
Date:   Sun May 17 23:26:13 2026 +0500

    iio: temperature: tmp006: use devm_iio_trigger_register
    
    commit 3c5eed894efd93d68d7f6a359a81ddef0e928774 upstream.
    
    tmp006_probe() allocates the DRDY trigger with devm_iio_trigger_alloc()
    but registers it with plain iio_trigger_register(). The driver has no
    .remove() callback, so on module unload the trigger stays in the global
    trigger list while its memory is freed by devm, leaving a dangling
    entry.
    
    Switch to devm_iio_trigger_register() so the registration is undone in
    the same devm scope as the allocation.
    
    Fixes: 91f75ccf9f03 ("iio: temperature: tmp006: add triggered buffer support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Input: ads7846 - don't use scratch for tx_buf when clearing register [+ + +]
Author: Kris Bahnsen <kris@embeddedTS.com>
Date:   Thu May 7 16:49:43 2026 +0000

    Input: ads7846 - don't use scratch for tx_buf when clearing register
    
    commit 856668312685d9a8f32d49a135a89c429d309f81 upstream.
    
    The workaround for XPT2046 clears the command register, giving the
    touchscreen controller a NOP. The change incorrectly re-uses the
    req->scratch variable which is used as rx_buf for xfer[5], so by
    the time xfer[6] occurs, the contents of req->scratch may not be
    0. It was found that the touchscreen controller can end up in
    a completely unresponsive state due to it being given a command
    the driver does not expect.
    
    Instead, rely on the spi_transfer behavior of tx_buf being NULL to
    transmit all 0 bits and use the scratch variable for the rx_buf for
    both the 1 byte command to and 2 byte response from the controller.
    
    Also relocates the scratch member of struct ser_req to force it
    into a different cache line to prevent any potential issues of
    DMA stepping on unrelated data in other struct members due to
    sharing the same cache line.
    
    This change was tested on real TSC2046 and ADS7843 controllers,
    but not the XPT2046 the workaround was originally created for.
    Confirming that the original modification to clear the command
    register does not impact either real controller.
    
    Fixes: 781a07da9bb94 ("Input: ads7846 - add dummy command register clearing cycle")
    Cc: stable@vger.kernel.org
    Co-developed-by: Mark Featherston <mark@embeddedTS.com>
    Signed-off-by: Mark Featherston <mark@embeddedTS.com>
    Signed-off-by: Kris Bahnsen <kris@embeddedTS.com>
    Link: https://patch.msgid.link/20260507164943.760009-1-kris@embeddedTS.com
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Input: elan_i2c - prevent division by zero and arithmetic underflow [+ + +]
Author: Ranjan Kumar <kumarranja@chromium.org>
Date:   Mon Jun 22 22:31:05 2026 -0700

    Input: elan_i2c - prevent division by zero and arithmetic underflow
    
    commit df2b818fa009c10ff6ba875a1663ff001cda9558 upstream.
    
    The Elan I2C touchpad driver queries the device for its physical
    dimensions and trace counts to calculate the device resolution and width.
    However, if the device firmware or device tree provides invalid zero
    values for x_traces or y_traces, it results in a fatal division-by-zero
    exception leading to a kernel panic during device probe.
    
    Add checks to ensure these parameters are non-zero before performing
    the division. If invalid trace values are detected, fall back to a safe
    default of 1.
    
    Additionally, prevent an arithmetic underflow in the touch reporting
    logic. Previously, if the calculated or fallback width was smaller than
    ETP_FWIDTH_REDUCE (90), the subtraction would underflow, resulting in a
    massive unsigned integer being reported to userspace. Clamp the adjusted
    width to a minimum of 0 to safely handle small physical dimensions and
    fallback scenarios.
    
    Completing the probe with safe fallback values ensures the sysfs nodes
    are created, keeping the firmware update path intact so a recovery
    firmware can be flashed to the device.
    
    Fixes: 6696777c6506 ("Input: add driver for Elan I2C/SMbus touchpad")
    Fixes: e3a9a1290688 ("Input: elan_i2c - do not query the info if they are provided")
    Signed-off-by: Ranjan Kumar <kumarranja@chromium.org>
    Link: https://patch.msgid.link/20260612060339.3829666-1-kumarranja@chromium.org
    Cc: stable@vger.kernel.org
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Input: goodix - clamp the device-reported contact count [+ + +]
Author: Bryam Vargas <hexlabsecurity@proton.me>
Date:   Fri Jun 12 21:10:33 2026 -0500

    Input: goodix - clamp the device-reported contact count
    
    commit 5ed62a96e06be4e94b8296b7932afee550a70e04 upstream.
    
    goodix_ts_read_input_report() copies the number of touch points reported
    by the device into an on-stack buffer
    
            u8 point_data[2 + GOODIX_MAX_CONTACT_SIZE * GOODIX_MAX_CONTACTS];
    
    which is sized for at most GOODIX_MAX_CONTACTS (10) contacts. The only
    runtime check bounds the per-interrupt count against ts->max_touch_num,
    but that value is taken verbatim from a 4-bit field of the device
    configuration block and is never clamped:
    
            ts->max_touch_num = ts->config[MAX_CONTACTS_LOC] & 0x0f;
    
    The nibble can be 0..15, so a malfunctioning, malicious or counterfeit
    controller (or an attacker tampering with the I2C bus) can advertise up
    to 15 contacts. goodix_ts_read_input_report() then accepts a touch_num
    of up to 15 and the second goodix_i2c_read() writes
    ts->contact_size * (touch_num - 1) bytes past the one-contact header into
    point_data - up to 30 bytes (45 with the 9-byte report format) beyond the
    92-byte buffer: a stack out-of-bounds write.
    
    Clamp max_touch_num to GOODIX_MAX_CONTACTS, the number of contacts
    point_data[] is sized for, when reading it from the configuration.
    
    Fixes: a7ac7c95d468 ("Input: goodix - use max touch number from device config")
    Cc: stable@vger.kernel.org
    Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>
    Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
    Link: https://patch.msgid.link/20260612-b4-disp-6844625d-v1-1-df0aed080c9d@proton.me
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Input: gscps2 - advance receive buffer write index [+ + +]
Author: Xu Rao <raoxu@uniontech.com>
Date:   Wed Jun 24 17:47:39 2026 +0800

    Input: gscps2 - advance receive buffer write index
    
    commit d86d4f8cbb5a55a3b9b86f7b5ab8c4cdda600a3f upstream.
    
    Commit 44f920069911 ("Input: gscps2 - use guard notation when
    acquiring spinlock") moved the receive loop into gscps2_read_data()
    and gscps2_report_data().
    
    While moving the code, it preserved the writes to
    buffer[ps2port->append], but omitted the following producer index
    update from the original loop:
    
            ps2port->append = (ps2port->append + 1) & BUFFER_SIZE;
    
    As a result, append never advances. Since gscps2_report_data() only
    reports bytes while act != append, the receive buffer always appears
    empty and no keyboard or mouse data reaches the serio core.
    
    Restore the omitted index update.
    
    Fixes: 44f920069911 ("Input: gscps2 - use guard notation when acquiring spinlock")
    Cc: stable@vger.kernel.org # 6.13+
    Signed-off-by: Xu Rao <raoxu@uniontech.com>
    Link: https://patch.msgid.link/460B5655BA580C60+20260624094739.850306-1-raoxu@uniontech.com
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Input: iforce - bound the device-reported force-feedback effect index [+ + +]
Author: Bryam Vargas <hexlabsecurity@proton.me>
Date:   Mon Jun 22 20:47:50 2026 -0700

    Input: iforce - bound the device-reported force-feedback effect index
    
    commit 0e9943d2e4c63496b6ca84bc66fd3c71d40558e2 upstream.
    
    iforce_process_packet() handles a status report (packet id 0x02) by
    taking a force-feedback effect index straight from the device wire and
    using it to address the per-effect state array:
    
            i = data[1] & 0x7f;
            if (data[1] & 0x80) {
                    if (!test_and_set_bit(FF_CORE_IS_PLAYED,
                                          iforce->core_effects[i].flags))
                            ...
            } else if (test_and_clear_bit(FF_CORE_IS_PLAYED,
                                          iforce->core_effects[i].flags)) {
                    ...
            }
    
    The index is masked only with 0x7f, so it ranges 0..127, but
    core_effects[] holds only IFORCE_EFFECTS_MAX (32) entries.  For an index
    of 32..127 the test_and_set_bit()/test_and_clear_bit() is an
    out-of-bounds single-bit read-modify-write past the array.  core_effects[]
    is the second-to-last member of struct iforce, so the write lands in the
    trailing members and beyond the embedding kzalloc()'d iforce_serio /
    iforce_usb object.
    
    data[1] is unvalidated device payload on both transports (the USB
    interrupt endpoint and serio), and the status path is not gated on force
    feedback being present, so a malicious or counterfeit device can set or
    clear a bit at an attacker-chosen offset past the object.
    
    Reject an out-of-range index instead of indexing with it.  Bound against
    the array dimension IFORCE_EFFECTS_MAX rather than dev->ff->max_effects so
    the check guarantees memory safety regardless of how many effects the
    device registered.  A legitimate "effect started/stopped" status always
    carries an index below IFORCE_EFFECTS_MAX, so well-formed devices are
    unaffected; the neighbouring mark_core_as_ready() loop is already bounded
    and is left untouched.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20260613-b4-disp-4828d263-v1-1-02320e1a89dd@proton.me
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Input: maple_keyb - set driver data before registering input device [+ + +]
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date:   Mon Jun 29 18:44:41 2026 -0700

    Input: maple_keyb - set driver data before registering input device
    
    commit 536394ec81419b67d9f4f0028812c4372397be1b upstream.
    
    Set maple driver data before calling input_register_device() to
    ensure that it is available if the device is opened immediately and
    the callback is triggered.
    
    Cc: stable@vger.kernel.org
    Assisted-by: Antigravity:gemini-3.5-flash
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Input: maplecontrol - set driver data before registering input device [+ + +]
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date:   Mon Jun 29 22:49:15 2026 -0700

    Input: maplecontrol - set driver data before registering input device
    
    commit fe938ee497d58c644f6910cfe6ae155f6fb3e523 upstream.
    
    Set maple driver data before calling input_register_device() to
    ensure that it is available if the device is opened immediately and
    the callback is triggered.
    
    Cc: stable@vger.kernel.org
    Assisted-by: Antigravity:gemini-3.5-flash
    Tested-by: Florian Fuchs <fuchsfl@gmail.com>
    Link: https://patch.msgid.link/akNYib9hQFNN1fA9@google.com
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Input: maplemouse - fix NULL pointer dereference in open() [+ + +]
Author: Florian Fuchs <fuchsfl@gmail.com>
Date:   Mon Jun 29 18:33:42 2026 -0700

    Input: maplemouse - fix NULL pointer dereference in open()
    
    commit ee89db004238bd0b034f2a6176e175561658750b upstream.
    
    Commit 555c765b0cc2 ("Input: mouse - drop unnecessary calls to
    input_set_drvdata") dropped the input_set_drvdata() call in probe
    because the data appeared to be unused. However, dc_mouse_open() and
    dc_mouse_close() were using maple_get_drvdata(to_maple_dev(&dev->dev)).
    This appears to be accessing the data attached to an instance of
    maple_device structure, while in reality this actually retrieves driver
    data from the input device's embedded struct device (doing invalid
    conversion of input device structure to maple device). After
    input_set_drvdata() was removed, that lookup started returning NULL and
    opening the input device dereferences mse->mdev.
    
    Restore input_set_drvdata() and convert open() and close() to use
    input_get_drvdata() so the dependency is no longer hidden.
    
    Fixes: 6b3480855aad ("maple: input: fix up maple mouse driver")
    Fixes: 555c765b0cc2 ("Input: mouse - drop unnecessary calls to input_set_drvdata")
    Signed-off-by: Florian Fuchs <fuchsfl@gmail.com>
    Link: https://patch.msgid.link/20260628230715.2982552-1-fuchsfl@gmail.com
    Cc: stable@vger.kernel.org
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Input: maplemouse - set driver data before registering input device [+ + +]
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date:   Mon Jun 29 22:47:34 2026 -0700

    Input: maplemouse - set driver data before registering input device
    
    commit 738f24bbbc95dd50cb4229d1ed62a05f29db2bda upstream.
    
    Set maple driver data before calling input_register_device() to
    ensure that it is available if the device is opened immediately and
    the callback is triggered.
    
    Cc: stable@vger.kernel.org
    Assisted-by: Antigravity:gemini-3.5-flash
    Tested-by: Florian Fuchs <fuchsfl@gmail.com>
    Link: https://patch.msgid.link/akNXw45L_8bxD6QV@google.com
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Input: mms114 - fix multi-touch slot corruption [+ + +]
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date:   Fri Jul 3 23:01:12 2026 -0700

    Input: mms114 - fix multi-touch slot corruption
    
    commit adea84ee6cdea611146c4251d3c1616f5a09feca upstream.
    
    If the touchscreen controller reports a touch ID of 0, the driver
    calculates the slot ID as touch->id - 1, which underflows to UINT_MAX.
    This is passed to input_mt_slot() as -1.
    
    Since the input core ignores negative slot values, the active slot remains
    unchanged. The driver then reports the touch coordinates for the previously
    active slot, corrupting its state.
    
    Fix this by rejecting touch reports with ID 0.
    
    Fixes: 07b8481d4aff ("Input: add MELFAS mms114 touchscreen driver")
    Cc: stable@vger.kernel.org
    Reported-by: sashiko-bot@kernel.org
    Assisted-by: Antigravity:gemini-3.5-flash
    Link: https://patch.msgid.link/20260704060115.353049-1-dmitry.torokhov@gmail.com
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Input: mms114 - fix touch indexing for MMS134S and MMS136 [+ + +]
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date:   Mon Jun 22 22:35:18 2026 -0700

    Input: mms114 - fix touch indexing for MMS134S and MMS136
    
    commit a6ac4e24c1a8a533bb61035184fdcc7eede4cc8d upstream.
    
    The MMS134S and MMS136 touch controllers have an event size of 6 bytes
    rather than 8 bytes. When __mms114_read_reg() reads the touch data
    packet from the device into the touch buffer, the events are packed
    tightly at 6-byte intervals. However, the driver iterates through the
    events using standard C array indexing (touch[index]), where each
    element is sizeof(struct mms114_touch) (8 bytes) apart. As a result, any
    touch events beyond the first one are read from incorrect offsets and
    parsed improperly.
    
    Fix this by explicitly calculating the byte offset for each touch event
    based on the device's specific event size.
    
    Fixes: 53fefdd1d3a3 ("Input: mms114 - support MMS136")
    Fixes: ab108678195f ("Input: mms114 - support MMS134S")
    Reported-by: sashiko-bot@kernel.org
    Assisted-by: Antigravity:gemini-3.5-flash
    Reviewed-by: Bryam Vargas <hexlabsecurity@proton.me>
    Link: https://patch.msgid.link/20260616050912.1531241-1-dmitry.torokhov@gmail.com
    Cc: stable@vger.kernel.org
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Input: mms114 - reject an oversized device packet size [+ + +]
Author: Bryam Vargas <hexlabsecurity@proton.me>
Date:   Sun Jun 14 14:19:43 2026 -0700

    Input: mms114 - reject an oversized device packet size
    
    commit 66725039f7090afe14c31bd259e2059a68f04023 upstream.
    
    mms114_interrupt() reads a packet of touch data from the device into a
    fixed-size on-stack buffer
    
            struct mms114_touch touch[MMS114_MAX_TOUCH];
    
    which holds MMS114_MAX_TOUCH (10) events of MMS114_EVENT_SIZE (8) bytes,
    i.e. 80 bytes. The length of the I2C read into it is taken verbatim from
    the device:
    
            packet_size = mms114_read_reg(data, MMS114_PACKET_SIZE);
            if (packet_size <= 0)
                    goto out;
            ...
            error = __mms114_read_reg(data, MMS114_INFORMATION, packet_size,
                            (u8 *)touch);
    
    packet_size is a single device register byte (0x0F) and the only check
    is the lower bound packet_size <= 0; it is never bounded against the
    size of touch[]. A malfunctioning, malicious or counterfeit controller
    (or an attacker tampering with the I2C bus) can report a packet_size of
    up to 255, so __mms114_read_reg() writes up to 175 bytes past the end of
    touch[] on the IRQ-thread stack: a stack out-of-bounds write that can
    overwrite the stack canary, saved registers and the return address.
    
    A well-formed device never reports more than the buffer holds, so reject
    an oversized packet and drop the report, consistent with the handler's
    other error paths, rather than reading past the buffer.
    
    Fixes: 07b8481d4aff ("Input: add MELFAS mms114 touchscreen driver")
    Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20260612-b4-disp-dc4b8dc4-v1-1-d7cb0a828d92@proton.me
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Input: synaptics-rmi4 - bound the F30 keymap to the GPIO/LED count [+ + +]
Author: Bryam Vargas <hexlabsecurity@proton.me>
Date:   Sun Jun 14 00:36:12 2026 -0500

    Input: synaptics-rmi4 - bound the F30 keymap to the GPIO/LED count
    
    commit d577e46785d45484b2ab7e7309c49b18764bf56c upstream.
    
    rmi_f30_map_gpios() allocates gpioled_key_map with
    min(gpioled_count, TRACKSTICK_RANGE_END) == at most 6 entries, but
    rmi_f30_attention() iterates the full f30->gpioled_count (device query
    register, range 0..31) and dereferences gpioled_key_map[i], and
    input->keycodemax is set to the full gpioled_count while input->keycode
    points at the 6-entry allocation.
    
    A device that reports gpioled_count > 6 with GPIO support enabled
    therefore causes an out-of-bounds read on the attention interrupt and
    out-of-bounds read/write through the EVIOCGKEYCODE/EVIOCSKEYCODE ioctls,
    which bound the index only against keycodemax. This is the same defect
    as the F3A handler, which was copied from F30.
    
    Size the keymap for the full gpioled_count; the mapping loop still
    assigns only the first min(gpioled_count, TRACKSTICK_RANGE_END) entries.
    
    Fixes: 3e64fcbdbd10 ("Input: synaptics-rmi4 - limit the range of what GPIOs are buttons")
    Cc: stable@vger.kernel.org
    Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>
    Link: https://patch.msgid.link/20260614-b4-disp-818d6bda-v1-2-cf39a3615085@proton.me
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Input: synaptics-rmi4 - bound the F3A keymap to the GPIO count [+ + +]
Author: Bryam Vargas <hexlabsecurity@proton.me>
Date:   Sun Jun 14 00:36:11 2026 -0500

    Input: synaptics-rmi4 - bound the F3A keymap to the GPIO count
    
    commit 57c10915f2c16c90e0d46ad00876bf39ece40fc2 upstream.
    
    rmi_f3a_initialize() takes the GPIO count from the device query register
    (f3a->gpio_count = buf & RMI_F3A_GPIO_COUNT, range 0..127).
    rmi_f3a_map_gpios() then allocates gpio_key_map with
    min(gpio_count, TRACKSTICK_RANGE_END) == at most 6 entries, but
    rmi_f3a_attention() iterates the full gpio_count and dereferences
    gpio_key_map[i], and input->keycodemax is set to the full gpio_count
    while input->keycode points at the 6-entry allocation.
    
    A device that reports gpio_count > 6 therefore causes an out-of-bounds
    read of gpio_key_map[] on every attention interrupt, and out-of-bounds
    accesses through the input core's default keymap ioctls: EVIOCGKEYCODE
    reads past the buffer (leaking adjacent slab memory to user space) and
    EVIOCSKEYCODE writes a caller-controlled value past it, for any process
    able to open the evdev node, since input_default_getkeycode() and
    input_default_setkeycode() only bound the index against keycodemax.
    
    Size the keymap for the full gpio_count. The mapping loop is unchanged:
    it still assigns only the first min(gpio_count, TRACKSTICK_RANGE_END)
    entries; the remaining slots stay KEY_RESERVED (devm_kcalloc zero-fills)
    and are skipped when reporting.
    
    Fixes: 9e4c596bfd00 ("Input: synaptics-rmi4 - add support for F3A")
    Cc: stable@vger.kernel.org
    Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>
    Link: https://patch.msgid.link/20260614-b4-disp-818d6bda-v1-1-cf39a3615085@proton.me
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Input: synaptics-rmi4 - unregister function handlers on physical driver registration failure [+ + +]
Author: Haoxiang Li <haoxiang_li2024@163.com>
Date:   Wed Jun 10 16:41:16 2026 -0700

    Input: synaptics-rmi4 - unregister function handlers on physical driver registration failure
    
    commit 6251f7d3472c0409e30f8d6a24f10d33d12e3f9a upstream.
    
    If rmi_register_physical_driver() fails, the current error path
    unregisters only the RMI bus. The function handlers registered
    earlier remain registered with the driver core.
    
    Add a separate error path to unregister the function handlers
    before unregistering the bus in this failure case.
    
    Fixes: 2b6a321da9a2 ("Input: synaptics-rmi4 - add support for Synaptics RMI4 devices")
    Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20260610064633.2837084-1-haoxiang_li2024@163.com
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Input: touchwin - reset the packet index on every complete packet [+ + +]
Author: Bryam Vargas <hexlabsecurity@proton.me>
Date:   Sat Jun 13 20:07:20 2026 -0500

    Input: touchwin - reset the packet index on every complete packet
    
    commit 478cdd736f2ce3114f90e775d7358136d3977b94 upstream.
    
    tw_interrupt() accumulates each non-zero serial byte into a fixed
    three-byte buffer with a running index that is only reset once a full
    packet has been received *and* the device's two Y bytes agree:
    
            tw->data[tw->idx++] = data;
            if (tw->idx == TW_LENGTH && tw->data[1] == tw->data[2]) {
                    ...
                    tw->idx = 0;
            }
    
    The reset is gated on tw->data[1] == tw->data[2], a value the device
    controls.  A malicious, malfunctioning or counterfeit Touchwindow
    peripheral can stream non-zero bytes whose 2nd and 3rd bytes differ: the
    index reaches TW_LENGTH without the equality holding, is never reset, and
    keeps growing, so tw->data[tw->idx++] walks off the end of the three-byte
    array and the rest of the heap-allocated struct tw, one attacker-chosen
    byte at a time -- an unbounded, device-driven heap out-of-bounds write.
    
    Reset the index on every completed packet and report an event only when
    the two Y bytes match, like the other serio touchscreen drivers do.
    
    Fixes: 11ea3173d5f2 ("Input: add driver for Touchwin serial touchscreens")
    Cc: stable@vger.kernel.org
    Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>
    Link: https://patch.msgid.link/20260613-b4-disp-69921bfd-v1-1-82c036899959@proton.me
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
io_uring/io-wq: re-check IO_WQ_BIT_EXIT for each linked work item [+ + +]
Author: Runyu Xiao <runyu.xiao@seu.edu.cn>
Date:   Thu May 28 01:22:03 2026 +0800

    io_uring/io-wq: re-check IO_WQ_BIT_EXIT for each linked work item
    
    commit 29bef9934b2521f787bb15dd1985d4c0d12ae02a upstream.
    
    commit 10dc95939817 ("io_uring/io-wq: check IO_WQ_BIT_EXIT inside work
    run loop") fixed the obvious case where io_worker_handle_work() took one
    exit-bit snapshot before draining pending work, but the fix stops one
    level too early.
    
    io_worker_handle_work() now re-checks IO_WQ_BIT_EXIT in its outer work
    run loop, yet it still snapshots that bit once before processing a whole
    dependent linked-work chain. If io_wq_exit_start() sets IO_WQ_BIT_EXIT
    after the first linked item has started, the remaining linked items can
    still reuse stale do_kill = false, skip IO_WQ_WORK_CANCEL, and continue
    running after exit has begun.
    
    Move the check further inside, so it covers linked items too. Note: this
    is a syzbot special as it loves setting up tons of slow linked work on
    weird devices like msr that take forever to read, and immediately close
    the ring. Exit then takes a long time.
    
    Fixes: 10dc95939817 ("io_uring/io-wq: check IO_WQ_BIT_EXIT inside work run loop")
    Cc: stable@vger.kernel.org
    Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
    Link: https://patch.msgid.link/20260527172203.2043962-1-runyu.xiao@seu.edu.cn
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
io_uring/nop: fix file reference leak with IOSQE_FIXED_FILE [+ + +]
Author: Vasileios Almpanis <vasilisalmpanis@gmail.com>
Date:   Mon Jun 15 16:45:57 2026 +0200

    io_uring/nop: fix file reference leak with IOSQE_FIXED_FILE
    
    commit 2564ca2e31bd8ee8348362941af2ee4671e487ca upstream.
    
    NOP file-acquisition support choses between a fixed (registered) file and
    a normal fget()'d file based on its own IORING_NOP_FIXED_FILE flag in
    sqe->nop_flags. However, a request's REQ_F_FIXED_FILE is set
    independently from the generic IOSQE_FIXED_FILE sqe flag during request
    init, before the issue handler runs.
    
    If a NOP is submitted with IOSQE_FIXED_FILE set (so REQ_F_FIXED_FILE is
    set) but without IORING_NOP_FIXED_FILE, io_nop() takes the normal path
    and grabs a real reference via io_file_get_normal(). On completion,
    io_put_file() only drops the reference when REQ_F_FIXED_FILE is clear,
    so the fget()'d file is never released and leaks:
    
      BUG: memory leak
      unreferenced object 0xffff88800f42c240 (size 176):
        kmem_cache_alloc_noprof+0x358/0x440
        alloc_empty_file+0x57/0x180
        path_openat+0x44/0x1e50
        do_file_open+0x121/0x200
        do_sys_openat2+0xa7/0x150
        __x64_sys_openat+0x82/0xf0
    
    Decide between fixed and normal file acquisition from REQ_F_FIXED_FILE,
    the same way io_assign_file() does for every other opcode, and fold
    IORING_NOP_FIXED_FILE into REQ_F_FIXED_FILE at prep time.
    
    Cc: stable@vger.kernel.org
    Fixes: a85f31052bce ("io_uring/nop: add support for testing registered files and buffers")
    Reported-by: syzbot+2cd473471e77bda12b0e@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?id=879092631b98f73a28ea405adacfa5bb34a14a25
    Signed-off-by: Vasileios Almpanis <vasilisalmpanis@gmail.com>
    Link: https://patch.msgid.link/20260615144619.482749-1-vasilisalmpanis@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
io_uring/rw: preserve partial result for iopoll [+ + +]
Author: Michael Wigham <michael@wigham.net>
Date:   Sat Jun 13 23:52:16 2026 +0100

    io_uring/rw: preserve partial result for iopoll
    
    commit c554246ff4c68abf71b61a89c6e39d3cf94f523e upstream.
    
    A partial read will store the completed byte count in io->bytes_done.
    The regular completion path applies io_fixup_rw_res() so that, when the
    following operation reaches EOF, the number of bytes already read is
    returned.
    
    The iopoll completion path does not apply this fixup to the return value
    and can return zero instead.
    
    Use the fixup result when updating the CQE, and the raw result for the
    reissue check.
    
    Cc: stable@vger.kernel.org
    Fixes: 4d9cb92ca41d ("io_uring/rw: fix short rw error handling")
    Signed-off-by: Michael Wigham <michael@wigham.net>
    Link: https://patch.msgid.link/20260613225240.34032-1-michael@wigham.net
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
iommu/amd: Don't split flush for amd_iommu_domain_flush_all() [+ + +]
Author: Weinan Liu <wnliu@google.com>
Date:   Thu May 28 22:31:47 2026 +0000

    iommu/amd: Don't split flush for amd_iommu_domain_flush_all()
    
    commit 69fe699afe1afcb730164b86c228483c2da05f94 upstream.
    
    We have observed multiple full invalidations occurring during device
    detach when we are done using the vfio-device.
    
    blocked_domain_attach_device()
      -> detach_device()
        -> amd_iommu_domain_flush_all()
          -> amd_iommu_domain_flush_pages(..., CMD_INV_IOMMU_ALL_PAGES_ADDRESS)
    
            while (size != 0) {
    
              -> __domain_flush_pages( flush_size /* power of 2 flush_size */)
                -> domain_flush_pages_v1()
                  -> build_inv_iommu_pages()
                    -> build_inv_address()
    
             }
    
    build_inv_address() will trigger a full invalidation  if the chunk
    size > (1 << 51). Consequently, the guest will issue multiple full
    invalidations for a single call to  amd_iommu_domain_flush_all()
    
    Without this patch, we will see 10 time instead of 1 time full
    invalidations for every amd_iommu_domain_flush_all().
    
    Cc: stable@vger.kernel.org
    Fixes: a270be1b3fdf ("iommu/amd: Use only natural aligned flushes in a VM")
    Suggested-by: Josef Bacik <josef@toxicpanda.com>
    Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Weinan Liu <wnliu@google.com>
    Reviewed-by: Wei Wang <wei.w.wang@hotmail.com>
    Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
    Reviewed-by: Samiullah Khawaja <skhawaja@google.com>
    Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
    Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
    Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
iommu/vt-d: Avoid WARNING in sva unbind path [+ + +]
Author: Lu Baolu <baolu.lu@linux.intel.com>
Date:   Thu Jun 4 14:03:06 2026 +0800

    iommu/vt-d: Avoid WARNING in sva unbind path
    
    commit 534b5f98ab7319d8004bbc7dab6481462243e883 upstream.
    
    The Intel IOMMU driver allows SVA on devices even if they do not support
    PCI/PRI. Commit 39c20c4e83b9 ("iommu/vt-d: Only handle IOPF for SVA when
    PRI is supported") modified the SVA bind path to allow this configuration
    by skipping IOPF enablement when PRI is missing. However, it failed to
    update the unbind path.
    
    This creates an imbalance: the unbind path attempts to disable IOPF for
    a device that never had it enabled, triggering a WARNING in
    intel_iommu_disable_iopf():
    
     WARNING: drivers/iommu/intel/iommu.c:3475 at intel_iommu_disable_iopf+0x4f/0x90d
     Call Trace:
      <TASK>
      blocking_domain_set_dev_pasid+0x50/0x70
      iommu_detach_device_pasid+0x89/0xc0
      iommu_sva_unbind_device+0x73/0x150
      xe_vm_close_and_put+0x4d2/0x1200 [xe]
    
    Fix this by bypassing IOPF operations for SVA domains on non-PRI hardware
    in both the bind and unbind paths.
    
    Fixes: 39c20c4e83b9 ("iommu/vt-d: Only handle IOPF for SVA when PRI is supported")
    Cc: stable@vger.kernel.org
    Reported-by: Nareshkumar Gollakoti <naresh.kumar.g@intel.com>
    Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Link: https://lore.kernel.org/r/20260519052917.3729796-1-baolu.lu@linux.intel.com
    Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
iommufd: Avoid partial fault group delivery in iommufd_fault_fops_read() [+ + +]
Author: Nicolin Chen <nicolinc@nvidia.com>
Date:   Mon Jun 1 13:42:37 2026 -0700

    iommufd: Avoid partial fault group delivery in iommufd_fault_fops_read()
    
    commit 091ab6d70dc444f56ed14faedbcacfc979f4c613 upstream.
    
    The cookie returned by xa_alloc() in iommufd_fault_fops_read() is per fault
    group, but the inner copy_to_user() runs per fault inside the group. If a
    copy fails mid-group, xa_erase clears the cookie and the group is restored
    to the deliver list, yet done is not rolled back. The function returns the
    partial byte count, with the successfully copied faults sitting at offsets
    below done carrying the now-erased cookie. The next read() then re-fetches
    the group, allocates a fresh cookie, and re-delivers every fault including
    the ones already copied; userspace sees duplicates carrying the new cookie,
    and a stale cookie that can never be responded to.
    
    Use a local group_done variable that tracks the per-group progress inside
    the inner loop, and only commit done = group_done after the inner loop has
    finished successfully. On a copy_to_user failure the outer break skips the
    commit, so done remains at its prior start-of-group baseline; the partial
    bytes already written past done are undefined to userspace per the read(2)
    contract, and the next read re-delivers the whole group atomically.
    
    Fixes: 07838f7fd529 ("iommufd: Add iommufd fault object")
    Link: https://patch.msgid.link/r/360cab4d4aeccb0bae275a970e2b3c340a71e0e0.1780343944.git.nicolinc@nvidia.com
    Cc: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4-7
    Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
    Reviewed-by: Pranjal Shrivastava <praan@google.com>
    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: Break the loop on failure in iommufd_fault_fops_read() [+ + +]
Author: Nicolin Chen <nicolinc@nvidia.com>
Date:   Mon Jun 1 13:42:36 2026 -0700

    iommufd: Break the loop on failure in iommufd_fault_fops_read()
    
    commit 172fc8b19825a0f5884c38f2289188284e2d45ee upstream.
    
    On a copy_to_user() failure inside the inner list_for_each_entry, only the
    inner loop breaks; the outer while re-fetches the just-restored fault group
    and retries the failing copy_to_user() forever, spinning the reader at 100%
    CPU with fault->mutex held.
    
    Check rc after the inner loop and break the outer while as well.
    
    Fixes: 07838f7fd529 ("iommufd: Add iommufd fault object")
    Link: https://patch.msgid.link/r/336a9b6e44fe66a24199d3be777c405c85c98622.1780343944.git.nicolinc@nvidia.com
    Cc: stable@vger.kernel.org
    Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
    Reviewed-by: Pranjal Shrivastava <praan@google.com>
    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: Fix data_len byte-count vs element-count mismatch [+ + +]
Author: Nicolin Chen <nicolinc@nvidia.com>
Date:   Thu May 21 17:36:32 2026 -0700

    iommufd: Fix data_len byte-count vs element-count mismatch
    
    commit 85345becfead3255a5f875d4b4d82ea01d926239 upstream.
    
    kzalloc_flex() computes the allocation size. With event_data typed as u64,
    data_len is interpreted as a u64 element count. Yet, every caller and the
    read path treat data_len as a byte count. The current code over-allocates
    by sizeof(u64) and the __counted_by() annotation overstates the length by
    the same factor.
    
    Re-type event_data as u8. No functional change in user-visible behavior.
    
    Fixes: e36ba5ab808e ("iommufd: Add IOMMUFD_OBJ_VEVENTQ and IOMMUFD_CMD_VEVENTQ_ALLOC")
    Link: https://patch.msgid.link/r/f7665f839b9dce917d6bd394375a1cf56568d86b.1779408671.git.nicolinc@nvidia.com
    Cc: stable@vger.kernel.org
    Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
    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: Move vevent memory allocation outside spinlock [+ + +]
Author: Nicolin Chen <nicolinc@nvidia.com>
Date:   Thu May 21 17:36:33 2026 -0700

    iommufd: Move vevent memory allocation outside spinlock
    
    commit 47443565d10c51366c9382dbc8597cd6c460b8a2 upstream.
    
    The veventq memory allocation happens inside the spinlock. Given its depth
    is decided by the user space, this leaves a vulnerability, where userspace
    can allocate large queues to exhaust atomic memory reserves.
    
    Move the allocation outside the spinlock and use GFP_NOWAIT, which can fail
    fast under memory pressure without dipping into the GFP_ATOMIC reserves or
    direct-reclaiming from the threaded IRQ handler. On allocation failure,
    queue the lost_events_header (so userspace learns of the drop) and return
    -ENOMEM so the caller learns of the kernel-side memory pressure.
    
    This is intentionally distinct from the queue-overflow path, which also
    queues the lost_events_header but returns 0: a full queue is an expected
    userspace-pacing condition rather than a kernel error.
    
    A subsequent change will cap the upper bound of the veventq_depth.
    
    Fixes: e36ba5ab808e ("iommufd: Add IOMMUFD_OBJ_VEVENTQ and IOMMUFD_CMD_VEVENTQ_ALLOC")
    Link: https://patch.msgid.link/r/5ff36b5d80f7f6299f851be532a5195c1d2f1dae.1779408671.git.nicolinc@nvidia.com
    Cc: stable@vger.kernel.org
    Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
    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: Propagate allocation failure in iommufd_veventq_deliver_fetch() [+ + +]
Author: Nicolin Chen <nicolinc@nvidia.com>
Date:   Mon Jun 1 13:42:34 2026 -0700

    iommufd: Propagate allocation failure in iommufd_veventq_deliver_fetch()
    
    commit 489e63dd120bad52eba63f5506c214750cd5bc75 upstream.
    
    When the kzalloc_obj() fails in iommufd_veventq_deliver_fetch(), it returns
    NULL, falsely advertising to userspace that the queue is empty.
    
    Propagate the -ENOMEM properly to the caller.
    
    Fixes: e36ba5ab808e ("iommufd: Add IOMMUFD_OBJ_VEVENTQ and IOMMUFD_CMD_VEVENTQ_ALLOC")
    Link: https://patch.msgid.link/r/25d29feac909e36f78c145fa99ef2d4cb7a415da.1780343944.git.nicolinc@nvidia.com
    Cc: stable@vger.kernel.org
    Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
    Reviewed-by: Pranjal Shrivastava <praan@google.com>
    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 invalid read count in iommufd_fault_fops_read() [+ + +]
Author: Nicolin Chen <nicolinc@nvidia.com>
Date:   Mon Jun 1 13:42:35 2026 -0700

    iommufd: Reject invalid read count in iommufd_fault_fops_read()
    
    commit 47916a54eeb2a9e654512ee609f71bd5b29db702 upstream.
    
    The read count must be large enough to hold one fault or a group's faults.
    
    iommufd_fault_fops_read() does not validate the count, but returns 0 as if
    the read had succeeded while leaving the pending fault in the queue.
    
    Return -EINVAL in the undersize cases.
    
    Fixes: 07838f7fd529 ("iommufd: Add iommufd fault object")
    Link: https://patch.msgid.link/r/85c118a606fbedc5c132a1f5ec223a5ba23b92d2.1780343944.git.nicolinc@nvidia.com
    Cc: stable@vger.kernel.org
    Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
    Reviewed-by: Pranjal Shrivastava <praan@google.com>
    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 invalid read count in iommufd_veventq_fops_read() [+ + +]
Author: Nicolin Chen <nicolinc@nvidia.com>
Date:   Mon Jun 1 13:42:33 2026 -0700

    iommufd: Reject invalid read count in iommufd_veventq_fops_read()
    
    commit 00203ca8323f9714630408c19a209b52397975e6 upstream.
    
    The read count must be large enough to hold a vEVENT header. For a normal
    vEVENT, it must also hold the trailing data following the header.
    
    iommufd_veventq_fops_read() does not validate the count, but returns 0 as
    if the read had succeeded while leaving the pending event in the queue.
    
    Return -EINVAL in both undersize cases.
    
    Fixes: e36ba5ab808e ("iommufd: Add IOMMUFD_OBJ_VEVENTQ and IOMMUFD_CMD_VEVENTQ_ALLOC")
    Link: https://patch.msgid.link/r/e1111adcc8a8882fbfd84accd6674dc846dc5689.1780343944.git.nicolinc@nvidia.com
    Cc: stable@vger.kernel.org
    Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
    Reviewed-by: Pranjal Shrivastava <praan@google.com>
    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: Rewind header length in done if iommufd_veventq_fops_read() fails [+ + +]
Author: Nicolin Chen <nicolinc@nvidia.com>
Date:   Mon Jun 1 13:42:32 2026 -0700

    iommufd: Rewind header length in done if iommufd_veventq_fops_read() fails
    
    commit 01e41ad76c12ae5c49ab4ef4fc7dd54e9b8784d6 upstream.
    
    When the first event copy fails, rc = -EFAULT will not be reported as done
    is set to the length of the copied header.
    
    Rewind it to report rc correctly.
    
    Fixes: e36ba5ab808e ("iommufd: Add IOMMUFD_OBJ_VEVENTQ and IOMMUFD_CMD_VEVENTQ_ALLOC")
    Link: https://patch.msgid.link/r/78f8caeb6a5d667a26b870e3068cec47dd4b5be1.1780343944.git.nicolinc@nvidia.com
    Cc: stable@vger.kernel.org
    Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
    Reviewed-by: Pranjal Shrivastava <praan@google.com>
    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: Set upper bounds on cache invalidation entry_num and entry_len [+ + +]
Author: Nicolin Chen <nicolinc@nvidia.com>
Date:   Wed Jun 3 14:26:53 2026 -0700

    iommufd: Set upper bounds on cache invalidation entry_num and entry_len
    
    commit 4d70986002f2f3eaaed89124fb2522bded38b016 upstream.
    
    iommufd_hwpt_invalidate() takes a user-controlled entry_num and entry_len,
    each bounded only by U32_MAX. An entry_len beyond the kernel's struct size
    makes the copy helper verify the extra bytes are zero, scanning that excess
    in one uninterruptible pass; a multi-gigabyte value over zeroed user memory
    trips the soft-lockup watchdog.
    
    A large entry_num is the other half, driving the backend invalidation loop
    with no reschedule. The VT-d nested handler, for one, copies each entry and
    flushes caches per iteration, pinning the CPU on a non-preemptible kernel.
    
    Cap both in the ioctl. entry_len is held under PAGE_SIZE, above any request
    struct, and entry_num under 1 << 19, the order of a hardware invalidation
    queue and well beyond any real batch, bounding the per-call loop length.
    
    Fixes: 8c6eabae3807 ("iommufd: Add IOMMU_HWPT_INVALIDATE")
    Link: https://patch.msgid.link/r/447fa93663f7526eb361719e83fa8b649464483d.1780521606.git.nicolinc@nvidia.com
    Cc: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
    Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iommufd: Set veventq_depth upper bound [+ + +]
Author: Nicolin Chen <nicolinc@nvidia.com>
Date:   Thu May 21 17:36:34 2026 -0700

    iommufd: Set veventq_depth upper bound
    
    commit 6ebf2eb46fbd5b40393ff8fbb847ba96925beaff upstream.
    
    iommufd_veventq_alloc() accepts any !0 veventq_depth from userspace, with
    an upper bound at U32_MAX.
    
    This leaves a vulnerability where userspace can allocate excessively large
    queues to exhaust kernel memory reserves.
    
    Cap the veventq_depth (maximum number of entries) to 1 << 19, matching the
    maximum number of entries in the SMMUv3 EVTQ (the largest use case today).
    
    Fixes: e36ba5ab808e ("iommufd: Add IOMMUFD_OBJ_VEVENTQ and IOMMUFD_CMD_VEVENTQ_ALLOC")
    Link: https://patch.msgid.link/r/8426cbaa5e8294472ec7f076ef427cc473be5985.1779408671.git.nicolinc@nvidia.com
    Cc: stable@vger.kernel.org
    Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
    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: Use sizeof(*hdr) instead of sizeof(hdr) in veventq read [+ + +]
Author: Kai Aizen <kai.aizen.dev@gmail.com>
Date:   Thu Apr 30 20:56:30 2026 +0300

    iommufd: Use sizeof(*hdr) instead of sizeof(hdr) in veventq read
    
    commit be93d186ae88a92e7aa77e122d4e661fa57b1e39 upstream.
    
    The bound-check in iommufd_veventq_fops_read() for the normal vEVENT
    path uses sizeof(hdr) where the surrounding code uses sizeof(*hdr):
    
            if (!vevent_for_lost_events_header(cur) &&
                sizeof(hdr) + cur->data_len > count - done) {
    
    hdr is declared as struct iommufd_vevent_header *, so sizeof(hdr)
    evaluates to the size of the pointer.  Surrounding code uses
    sizeof(*hdr) consistently:
    
            if (done >= count || sizeof(*hdr) > count - done) {
            ...
            if (copy_to_user(buf + done, hdr, sizeof(*hdr))) {
            ...
            done += sizeof(*hdr);
    
    struct iommufd_vevent_header is currently 8 bytes (two __u32 fields,
    flags and sequence), so on 64-bit (sizeof(void *) == 8) the two
    expressions happen to be equal and the check works as intended.
    
    On 32-bit (sizeof(void *) == 4) the check under-counts the header by
    4 bytes: a vEVENT whose data_len causes 8 + cur->data_len to exceed
    count - done while 4 + cur->data_len does not will pass the check,
    then the loop will copy_to_user 8 bytes of header followed by data_len
    bytes of payload, writing past the user-supplied buffer.
    
    It is also a latent bug for any future expansion of struct
    iommufd_vevent_header beyond sizeof(void *) on 64-bit; the check
    should not depend on the type happening to match the host pointer
    width.
    
    Use sizeof(*hdr) to match the rest of the function and the actual
    amount that will be copied.
    
    Fixes: e36ba5ab808e ("iommufd: Add IOMMUFD_OBJ_VEVENTQ and IOMMUFD_CMD_VEVENTQ_ALLOC")
    Link: https://patch.msgid.link/r/20260430175630.67078-1-kai.aizen.dev@gmail.com
    Cc: stable@vger.kernel.org
    Reported-by: Kai Aizen <kai.aizen.dev@gmail.com>
    Signed-off-by: Kai Aizen <kai.aizen.dev@gmail.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
    Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ipv4: igmp: remove multicast group from hash table on device destruction [+ + +]
Author: Yuyang Huang <yuyanghuang@google.com>
Date:   Thu Jul 2 08:50:14 2026 +0900

    ipv4: igmp: remove multicast group from hash table on device destruction
    
    commit 7993211bde166471dffac074dc965489f86531f8 upstream.
    
    When a device is destroyed under RTNL, ip_mc_destroy_dev() iterates through
    the multicast list and calls ip_ma_put() on each membership, scheduling
    them for RCU reclamation. However, they are not unlinked from the device's
    multicast hash table (mc_hash).
    
    Since the device remains published in dev->ip_ptr until after
    ip_mc_destroy_dev() completes, concurrent RCU readers traversing mc_hash
    can still locate and access the multicast group after its refcount is
    decremented. If the RCU callback runs and frees the group while a reader is
    accessing it, a use-after-free occurs.
    
    Fix this by unlinking the multicast group from mc_hash using
    ip_mc_hash_remove() before scheduling it for reclamation.
    
    BUG: KASAN: slab-use-after-free in ip_check_mc_rcu+0x149/0x3f0
    Read of size 4 at addr ffff888009bf1408 by task mausezahn/2276
    
    Call Trace:
     <IRQ>
     dump_stack_lvl+0x67/0x90
     print_report+0x175/0x7c0
     kasan_report+0x147/0x180
     ip_check_mc_rcu+0x149/0x3f0
     udp_v4_early_demux+0x36d/0x12d0
     ip_rcv_finish_core+0xb8b/0x1390
     ip_rcv_finish+0x54/0x120
     NF_HOOK+0x213/0x2b0
     __netif_receive_skb+0x126/0x340
     process_backlog+0x4f2/0xf00
     __napi_poll+0x92/0x2c0
     net_rx_action+0x583/0xc60
     handle_softirqs+0x236/0x7f0
     do_softirq+0x57/0x80
     </IRQ>
    
    Allocated by task 2239:
     kasan_save_track+0x3e/0x80
     __kasan_kmalloc+0x72/0x90
     ____ip_mc_inc_group+0x31a/0xa40
     __ip_mc_join_group+0x334/0x3f0
     do_ip_setsockopt+0x16fa/0x2010
     ip_setsockopt+0x3f/0x90
     do_sock_setsockopt+0x1ad/0x300
    
    Freed by task 0:
     kasan_save_track+0x3e/0x80
     kasan_save_free_info+0x40/0x50
     __kasan_slab_free+0x3a/0x60
     __rcu_free_sheaf_prepare+0xd4/0x220
     rcu_free_sheaf+0x36/0x190
     rcu_core+0x8d9/0x12f0
     handle_softirqs+0x236/0x7f0
    
    Fixes: e9897071350b ("igmp: hash a hash table to speedup ip_check_mc_rcu()")
    Cc: stable@vger.kernel.org
    Signed-off-by: Yuyang Huang <yuyanghuang@google.com>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Link: https://patch.msgid.link/20260701235014.73505-1-yuyanghuang@google.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
isofs: bound Rock Ridge symlink components to the SL record [+ + +]
Author: Bryam Vargas <hexlabsecurity@proton.me>
Date:   Sun Jun 7 01:18:27 2026 +0000

    isofs: bound Rock Ridge symlink components to the SL record
    
    commit 5fa1d6a5ec2356d2107dead614437c66fa7138b1 upstream.
    
    get_symlink_chunk() and the SL handling in
    parse_rock_ridge_inode_internal() walk the variable-length components of
    a Rock Ridge "SL" (symbolic link) record.  Each component is a two-byte
    header (flags, len) followed by len bytes of text, so it occupies
    slp->len + 2 bytes.  Both loops read slp->len and advance to the next
    component, and get_symlink_chunk() additionally does
    memcpy(rpnt, slp->text, slp->len), but neither checks that the component
    lies within the SL record before dereferencing it.
    
    A crafted SL record whose component declares a len that runs past the
    record (rr->len) therefore triggers an out-of-bounds read of up to 255
    bytes.  When the record sits at the tail of its backing buffer - for
    example a small kmalloc()ed continuation block reached through a CE
    record - the read crosses the allocation; get_symlink_chunk() then
    copies the out-of-bounds bytes into the symlink body returned to user
    space by readlink(), disclosing adjacent kernel memory.
    
    ISO 9660 images are routinely mounted from untrusted removable media -
    desktop environments auto-mount them (e.g. via udisks2) without
    CAP_SYS_ADMIN - so the record contents are attacker-controlled.
    
    Reject any component that does not fit in the remaining record bytes
    before using it.  In get_symlink_chunk() return NULL, like the existing
    output-buffer (plimit) checks, so a malformed record makes readlink()
    fail with -EIO rather than silently returning a truncated target; in
    parse_rock_ridge_inode_internal() stop the inode-size walk.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable@vger.kernel.org
    Suggested-by: Michael Bommarito <michael.bommarito@gmail.com>
    Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>
    Link: https://patch.msgid.link/20260607011823.217748-1-hexlabsecurity@proton.me
    Signed-off-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ksmbd: add a permission check for FSCTL_SET_ZERO_DATA [+ + +]
Author: Gil Portnoy <dddhkts1@gmail.com>
Date:   Wed Jun 10 20:07:04 2026 +0900

    ksmbd: add a permission check for FSCTL_SET_ZERO_DATA
    
    commit 3320ba068198adc144c89d6661b805acce01735b upstream.
    
    FSCTL_SET_ZERO_DATA in smb2_ioctl() destroys file data via
    ksmbd_vfs_zero_data() -> vfs_fallocate(PUNCH_HOLE/ZERO_RANGE) after
    checking only the share-level KSMBD_TREE_CONN_FLAG_WRITABLE, with no
    per-handle access check. A handle opened with only FILE_WRITE_ATTRIBUTES
    still yields an FMODE_WRITE filp (FILE_WRITE_ATTRIBUTES is part of
    FILE_WRITE_DESIRE_ACCESS_LE, so smb2_create_open_flags() opens it
    O_WRONLY), so the vfs_fallocate FMODE_WRITE check does not stop it; only
    the missing fp->daccess gate would. Reproduced on mainline 7.1-rc7 with
    KASAN by an authenticated SMB client: a FILE_WRITE_ATTRIBUTES-only handle
    zeroed 4096 bytes of file data it had no FILE_WRITE_DATA right to
    (6/6; a FILE_READ_DATA-only handle was correctly denied).
    
    This is the unfixed sibling of commit cc57232cae23 ("ksmbd: fix FSCTL
    permission bypass by adding a permission check for FSCTL_SET_SPARSE").
    Because SET_ZERO_DATA writes data (not an attribute), require
    FILE_WRITE_DATA.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Gil Portnoy <dddhkts1@gmail.com>
    Acked-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ksmbd: add a WRITE_DAC/WRITE_OWNER check to SMB2 SET_INFO SECURITY [+ + +]
Author: Gil Portnoy <dddhkts1@gmail.com>
Date:   Tue Jun 9 00:00:00 2026 +0000

    ksmbd: add a WRITE_DAC/WRITE_OWNER check to SMB2 SET_INFO SECURITY
    
    commit 44df157a1183a7f746caa970c169255da5ac61f8 upstream.
    
    commit cc57232cae23 ("ksmbd: fix FSCTL permission bypass by adding a
    permission check for FSCTL_SET_SPARSE") added a fp->daccess gate to
    fsctl_set_sparse and noted that "similar handle-level checks exist in other
    functions but are missing here." The SMB2 SET_INFO SECURITY arm is one of
    the missing ones, and the most security-relevant: smb2_set_info_sec() calls
    set_info_sec() with no per-handle access check.
    
    set_info_sec() (fs/smb/server/smbacl.c) re-permissions the file: it
    rewrites owner/group/mode via notify_change(), rewrites the POSIX ACL via
    set_posix_acl(), and on KSMBD_SHARE_FLAG_ACL_XATTR shares removes and
    rewrites the Windows security descriptor via ksmbd_vfs_set_sd_xattr().
    Every other persistent-mutation arm of the sibling handler
    smb2_set_info_file() checks fp->daccess first (FILE_WRITE_DATA /
    FILE_DELETE / FILE_WRITE_EA / FILE_WRITE_ATTRIBUTES); the SECURITY arm —
    which mutates the access control itself — is the only one with no gate.
    
    A client can therefore open a handle with FILE_WRITE_ATTRIBUTES only (no
    FILE_WRITE_DAC / FILE_WRITE_OWNER) and use SMB2_SET_INFO with InfoType
    SMB2_O_INFO_SECURITY to rewrite the file's DACL and owner, granting itself
    access the handle's daccess never carried. Unlike the FSCTL data arms this
    is a metadata/xattr operation, so there is no FMODE_WRITE VFS backstop —
    the missing fp->daccess check is the entire gate.
    
    Setting a security descriptor is the WRITE_DAC / WRITE_OWNER operation, so
    require at least one of those on the handle before re-permissioning the
    file. -EACCES is mapped to STATUS_ACCESS_DENIED by smb2_set_info().
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Gil Portnoy <dddhkts1@gmail.com>
    Acked-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ksmbd: add per-handle permission check to FILE_LINK_INFORMATION [+ + +]
Author: Gil Portnoy <dddhkts1@gmail.com>
Date:   Wed Jun 10 20:13:51 2026 +0900

    ksmbd: add per-handle permission check to FILE_LINK_INFORMATION
    
    commit 13f3942f2bf45856bb751faed2f0c4618f41ca20 upstream.
    
    The FILE_LINK_INFORMATION arm of smb2_set_info_file() calls
    smb2_create_link() with no per-handle fp->daccess check. On the
    ReplaceIfExists path smb2_create_link() unlinks an existing file at the
    target name (ksmbd_vfs_remove_file) and creates a hardlink
    (ksmbd_vfs_link); neither helper checks daccess. A handle opened with
    FILE_READ_DATA only (no FILE_DELETE, no FILE_WRITE_DATA) can therefore
    delete an arbitrary file in the share and plant a hardlink over its name.
    
    The sibling delete/move arms in the same switch already gate:
    FILE_RENAME_INFORMATION and FILE_DISPOSITION_INFORMATION both require
    FILE_DELETE_LE; FILE_FULL_EA_INFORMATION requires FILE_WRITE_EA_LE. Gate
    the link arm the same way as its closest analogue (rename), since it
    mutates the namespace and, on replace, deletes an existing entry.
    
    This is a sibling of commit cc57232cae23 ("ksmbd: fix FSCTL permission
    bypass by adding a permission check for FSCTL_SET_SPARSE").
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Gil Portnoy <dddhkts1@gmail.com>
    Acked-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ksmbd: add permission checks for FSCTL_DUPLICATE_EXTENTS_TO_FILE [+ + +]
Author: Gil Portnoy <dddhkts1@gmail.com>
Date:   Fri Jun 12 07:15:38 2026 +0900

    ksmbd: add permission checks for FSCTL_DUPLICATE_EXTENTS_TO_FILE
    
    commit 388e4139db27a9e3612c9d356b826f5b1ff6a9e3 upstream.
    
    The FSCTL_DUPLICATE_EXTENTS_TO_FILE arm of smb2_ioctl() overwrites the
    destination file's data via vfs_clone_file_range() with neither the
    share-level KSMBD_TREE_CONN_FLAG_WRITABLE check nor a per-handle
    fp->daccess check that the other write-bearing arms carry. A client can
    overwrite destination data on a read-only share, or from a handle opened
    with only FILE_WRITE_ATTRIBUTES (which still yields an FMODE_WRITE filp).
    FILE_WRITE_ATTRIBUTES-only destination handle overwrote the file's data via
    the clone. Add both checks, matching the FSCTL_SET_SPARSE permission fix;
    require FILE_WRITE_DATA since this writes data.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Gil Portnoy <dddhkts1@gmail.com>
    Acked-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ksmbd: enforce FILE_READ_ATTRIBUTES on SMB_FIND_FILE_POSIX_INFORMATION [+ + +]
Author: Gil Portnoy <dddhkts1@gmail.com>
Date:   Thu Jun 11 22:59:51 2026 +0900

    ksmbd: enforce FILE_READ_ATTRIBUTES on SMB_FIND_FILE_POSIX_INFORMATION
    
    commit 20c8442dc1003f9f7bb522d3dcd81d09ea59a79e upstream.
    
    find_file_posix_info() in smb2_query_info() returns file metadata (owner
    uid, group gid, mode, inode, size, allocation size, hard-link count and all
    four timestamps) but performs no per-handle access check. Every sibling
    query handler gates on the handle's granted access first --
    get_file_basic_info(), get_file_all_info(), get_file_network_open_info()
    and get_file_attribute_tag_info() all reject a handle lacking
    FILE_READ_ATTRIBUTES_LE with -EACCES. The POSIX handler is gated only by
    the connection-scoped tcon->posix_extensions flag, which is not a
    per-handle authorization, so a handle opened with only FILE_WRITE_DATA is
    correctly denied FileBasicInformation yet is allowed the strict-superset
    POSIX info. Mirror the FILE_READ_ATTRIBUTES_LE gate the sibling info
    handlers already use.
    
    Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
    Cc: stable@vger.kernel.org
    Signed-off-by: Gil Portnoy <dddhkts1@gmail.com>
    Acked-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ksmbd: fix UAF of struct file_lock in SMB2_LOCK deferred-lock cancellation [+ + +]
Author: Davide Ornaghi <d.ornaghi97@gmail.com>
Date:   Sat Jun 6 16:11:04 2026 +0900

    ksmbd: fix UAF of struct file_lock in SMB2_LOCK deferred-lock cancellation
    
    commit d20d1c8ba5765d1d12eefc0aee6385ab3f240e1e upstream.
    
    When a blocking byte-range lock request is deferred in the
    FILE_LOCK_DEFERRED path, ksmbd registers the asynchronous work into
    the connection's async_requests list via setup_async_work(). The cancel
    callback smb2_remove_blocked_lock() holds a reference to the flock.
    
    If the lock waiter is subsequently woken up but the work state is no
    longer KSMBD_WORK_ACTIVE (e.g., due to a concurrent cancellation), the
    cleanup path calls locks_free_lock(flock) without dequeuing the work from
    the async_requests list. Concurrently, smb2_cancel() walks the list
    under conn->request_lock and invokes the cancel callback, which then
    dereferences the already freed 'flock'. This leads to a slab-use-after-free
    inside __wake_up_common.
    
    Fix this by restructuring the cleanup logic after the worker returns
    from ksmbd_vfs_posix_lock_wait(). Move list_del(&smb_lock->llist) and
    release_async_work(work) to the top of the cleanup block. This guarantees
    that the async work is completely dequeued and serialized under
    conn->request_lock before locks_free_lock(flock) is called, rendering
    the flock unreachable for any concurrent smb2_cancel().
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Davide Ornaghi <d.ornaghi97@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: fix use-after-free of a deferred file_lock on SMB2_CLOSE then SMB2_CANCEL [+ + +]
Author: Gil Portnoy <dddhkts1@gmail.com>
Date:   Wed Jun 10 19:53:14 2026 +0900

    ksmbd: fix use-after-free of a deferred file_lock on SMB2_CLOSE then SMB2_CANCEL
    
    commit 10f293a07f9e10e988b0ae44e2e99c631f5a68e0 upstream.
    
    Commit f580d27e8928 ("ksmbd: fix use-after-free of a deferred file_lock on
    double SMB2_CANCEL") made smb2_cancel() skip a work whose state is
    KSMBD_WORK_CANCELLED, so its cancel_fn cannot be fired a second time. But
    KSMBD_WORK has three states (ACTIVE, CANCELLED, CLOSED), and the same
    freeing producer path is reached for CLOSED too:
    
      SMB2_CLOSE on the locking handle -> set_close_state_blocked_works() sets
      the deferred work's state to KSMBD_WORK_CLOSED and wakes the smb2_lock()
      worker. The worker takes the non-ACTIVE early-exit, locks_free_lock()s
      the file_lock and, because the state is not KSMBD_WORK_CANCELLED, takes
      the STATUS_RANGE_NOT_LOCKED branch with "goto out2" -- which, like the
      cancelled branch, skips release_async_work(). The work stays on
      conn->async_requests with a live cancel_fn = smb2_remove_blocked_lock
      pointing at the freed file_lock.
    
    A subsequent SMB2_CANCEL for the same AsyncId then passes the
    KSMBD_WORK_CANCELLED-only guard (its state is KSMBD_WORK_CLOSED), so
    smb2_cancel() fires cancel_fn again over the freed file_lock -- the same
    use-after-free fixed, via SMB2_CLOSE instead of a first SMB2_CANCEL:
    
      BUG: KASAN: slab-use-after-free in __locks_delete_block
        __locks_delete_block
        locks_delete_block
        ksmbd_vfs_posix_lock_unblock
        smb2_remove_blocked_lock
        smb2_cancel                 <- 2nd SMB2_CANCEL fires cancel_fn
        handle_ksmbd_work
      Allocated by ...: locks_alloc_lock <- smb2_lock
      Freed by ...:     locks_free_lock  <- smb2_lock (non-ACTIVE early-exit)
      ... cache file_lock_cache of size 192
    
    Reproduced on mainline 7.1-rc7 (which already contains f580d27e8928) with
    KASAN by an authenticated SMB client; the double-SMB2_CANCEL control is
    silent on that kernel, so the splat is attributable to the CLOSE trigger.
    
    Only an ACTIVE deferred work may have its cancel_fn fired: both terminal
    states (CANCELLED and CLOSED) reach the smb2_lock() early-exit that frees
    the file_lock and skips release_async_work(). Guard on KSMBD_WORK_ACTIVE
    so any non-active work is skipped.
    
    Fixes: f580d27e8928 ("ksmbd: fix use-after-free of a deferred file_lock on double SMB2_CANCEL")
    Cc: stable@vger.kernel.org
    Signed-off-by: Gil Portnoy <dddhkts1@gmail.com>
    Acked-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ksmbd: prevent path traversal bypass by restricting caseless retry [+ + +]
Author: Namjae Jeon <linkinjeon@kernel.org>
Date:   Sun Jun 7 20:15:51 2026 +0900

    ksmbd: prevent path traversal bypass by restricting caseless retry
    
    commit 54bab9ba5a9f156ffa9324fcbe5a356fd0242f95 upstream.
    
    ksmbd_vfs_path_lookup() enforces LOOKUP_BENEATH to restrict path
    resolution within the share root. When a crafted path attempts to
    escape the share boundary using parent-directory components ('..'),
    vfs_path_parent_lookup() detects this and immediately fails,
    returning -EXDEV.
    
    However, a bug exists in __ksmbd_vfs_kern_path() under caseless mode.
    The function fails to intercept the -EXDEV error and erroneously
    falls through to the caseless retry logic, which is intended only
    for genuinely missing files. During this retry process, the path
    is reconstructed, leading to an unintended LOOKUP_BENEATH bypass
    that allows write-capable users to create zero-length files or
    directories outside the exported share.
    
    Fix this by ensuring that the execution only proceeds to the caseless
    lookup retry when the error is specifically -ENOENT. Any other errors,
    such as -EXDEV from a path traversal attempt, must be returned immediately.
    
    Cc: stable@vger.kernel.org
    Reported-by: Y s65 <yu4ys@outlook.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: require source read access for duplicate extents [+ + +]
Author: Namjae Jeon <linkinjeon@kernel.org>
Date:   Sat Jun 13 22:00:02 2026 +0900

    ksmbd: require source read access for duplicate extents
    
    commit cedff600f1642aa982178503552f0d007bc829c8 upstream.
    
    FSCTL_DUPLICATE_EXTENTS_TO_FILE passes the source file directly to
    vfs_clone_file_range() or vfs_copy_file_range() without checking the SMB
    access mask granted to the source handle. A handle opened with attribute
    access can consequently be used to copy file contents into an
    attacker-readable destination.
    
    Require FILE_READ_DATA on the source handle before either VFS operation,
    matching other ksmbd data-copy paths.
    
    Cc: stable@vger.kernel.org
    Reported-by: Musaab Khan <musaab.khan@protonmail.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: run set info with opener credentials [+ + +]
Author: Namjae Jeon <linkinjeon@kernel.org>
Date:   Sat Jun 13 22:00:01 2026 +0900

    ksmbd: run set info with opener credentials
    
    commit b383bcad3d2fe634b26efbce53e22bbb5753a520 upstream.
    
    SMB2 SET_INFO handlers call path-based VFS helpers after checking the
    access mask granted to the SMB handle. Those helpers perform their owner,
    inode permission and LSM checks using the current ksmbd worker credentials.
    
    Run the complete SET_INFO dispatch with the credentials captured when the
    handle was opened. This also removes the separate security information
    credential setup and keeps all SET_INFO classes under one credential scope.
    
    Direct override_creds() is used because it can nest with the request
    credential overrides already used by rename and link helpers.
    
    Cc: stable@vger.kernel.org
    Reported-by: Musaab Khan <musaab.khan@protonmail.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: serialize QUERY_DIRECTORY requests per file [+ + +]
Author: Namjae Jeon <linkinjeon@kernel.org>
Date:   Fri Jun 12 08:00:00 2026 +0900

    ksmbd: serialize QUERY_DIRECTORY requests per file
    
    commit be6d26bf27499977c746abc163659915082348d8 upstream.
    
    smb2_query_dir() stores a pointer to its stack-allocated private data in
    the ksmbd_file readdir_data. Concurrent QUERY_DIRECTORY requests using the
    same file handle can overwrite this pointer while an iterate_dir() callback
    is still using it, resulting in a stack use-after-free.
    
    Add a per-file mutex and hold it while accessing the shared directory
    enumeration state. The lock covers scan restart, dot entry state,
    readdir_data setup and iteration, and response construction. This prevents
    another request from replacing readdir_data.private before the current
    request has finished using it and also serializes the shared file position.
    
    Cc: stable@vger.kernel.org
    Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-30527
    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: track the connection owning a byte-range lock [+ + +]
Author: Namjae Jeon <linkinjeon@kernel.org>
Date:   Mon Jun 15 10:00:00 2026 +0900

    ksmbd: track the connection owning a byte-range lock
    
    commit c1016dd1d8b2bcd1158bbaabe94a31bb7e7431fb upstream.
    
    SMB2_LOCK adds each granted byte-range lock to both the file lock list
    and the lock list of the connection which handled the request.  The
    final close and durable handle paths, however, remove the connection
    list entry while holding fp->conn->llist_lock.
    
    With SMB3 multichannel, the connection handling the LOCK request can be
    different from the connection which opened the file.  The entry can
    therefore be removed under a different spinlock from the one protecting
    the list it belongs to.  A concurrent traversal can then access freed
    struct ksmbd_lock and struct file_lock objects.
    
    Record the connection owning each lock's clist entry and hold a
    reference to it while the entry is linked.  Use that connection and its
    llist_lock for unlock, rollback, close, and durable preserve.  Durable
    reconnect assigns the new connection as the owner when publishing the
    locks again.
    
    Fixes: f5a544e3bab7 ("ksmbd: add support for SMB3 multichannel")
    Cc: stable@vger.kernel.org
    Reported-by: Musaab Khan <musaab.khan@protonmail.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: use opener credentials for ADS I/O [+ + +]
Author: Namjae Jeon <linkinjeon@kernel.org>
Date:   Sat Jun 13 22:00:03 2026 +0900

    ksmbd: use opener credentials for ADS I/O
    
    commit baa5e094886fffa7e6272edcb5e08be5ce28262c upstream.
    
    Alternate data streams are stored as xattrs. Unlike regular file I/O,
    their read and write paths therefore call VFS xattr helpers which recheck
    inode permissions and LSM policy using the current task credentials.
    
    Run ADS I/O with the credentials captured when the SMB handle was opened.
    
    Cc: stable@vger.kernel.org
    Reported-by: Musaab Khan <musaab.khan@protonmail.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: use opener credentials for delete-on-close [+ + +]
Author: Namjae Jeon <linkinjeon@kernel.org>
Date:   Sat Jun 13 22:00:00 2026 +0900

    ksmbd: use opener credentials for delete-on-close
    
    commit 52e2f21911158ec961cd5aae19c56460db382af0 upstream.
    
    Delete-on-close can be completed by deferred or durable handle teardown,
    where no request work is available. Both the base-file unlink and the ADS
    xattr removal consequently run with the ksmbd worker credentials and can
    bypass filesystem permission checks.
    
    Run both operations with the credentials captured in struct file when the
    handle was opened. This preserves the authenticated user's fsuid, fsgid,
    supplementary groups and capability restrictions at final close.
    
    Cc: stable@vger.kernel.org
    Reported-by: Musaab Khan <musaab.khan@protonmail.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: validate NTLMv2 response before updating session key [+ + +]
Author: Haofeng Li <lihaofeng@kylinos.cn>
Date:   Tue Jun 23 09:30:26 2026 +0800

    ksmbd: validate NTLMv2 response before updating session key
    
    commit 954d196bebb2b50151cb96454c72dc113b2af1ac upstream.
    
    ksmbd_auth_ntlmv2() derives the NTLMv2 session key into
    sess->sess_key before it verifies the NTLMv2 response.
    ksmbd_decode_ntlmssp_auth_blob() then continues into KEY_XCH even
    when ksmbd_auth_ntlmv2() failed.
    
    With SMB3 multichannel binding, the failed authentication operates on
    an existing session and the session setup error path does not expire
    binding sessions. A client can send a binding session setup with a
    bad NT proof and KEY_XCH and still modify sess->sess_key before
    STATUS_LOGON_FAILURE is returned.
    
    Relevant path:
    
      smb2_sess_setup()
        -> conn->binding = true
        -> ntlm_authenticate()
           -> session_user()
           -> ksmbd_decode_ntlmssp_auth_blob()
              -> ksmbd_auth_ntlmv2()
                 -> calc_ntlmv2_hash()
                 -> hmac_md5_usingrawkey(..., sess->sess_key)
                 -> crypto_memneq() returns mismatch
              -> KEY_XCH arc4_crypt(..., sess->sess_key, ...)
        -> out_err without expiring the binding session
    
    Derive the base session key into a local buffer and copy it to
    sess->sess_key only after the proof matches. Return immediately on
    authentication failure so KEY_XCH is only processed after successful
    authentication.
    
    Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
    Fixes: f9929ef6a2a5 ("ksmbd: add support for key exchange")
    Cc: stable@vger.kernel.org
    Signed-off-by: Haofeng Li <lihaofeng@kylinos.cn>
    Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
    Acked-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
KVM: arm64: Bound used_lrs when flushing the pKVM hyp vCPU [+ + +]
Author: Hyunwoo Kim <imv4bel@gmail.com>
Date:   Sun Jun 7 02:56:11 2026 +0900

    KVM: arm64: Bound used_lrs when flushing the pKVM hyp vCPU
    
    commit 8cc8bbbfab14c22c5551d0dd19b208a44b141c76 upstream.
    
    flush_hyp_vcpu() copies the host vGIC state into the hyp's private vCPU
    on every run. The vGIC list register save and restore use used_lrs as
    their loop bound and expect it to stay within the number of implemented
    list registers. While this is generally the case, flush_hyp_vcpu()
    copies vgic_v3 verbatim and does not enforce this, so a value provided
    by the host is used at EL2 to index vgic_lr[] and access ICH_LR<n>_EL2
    (host -> EL2).
    
    Fix by clamping used_lrs to the number of implemented list registers
    after the copy, as the trusted path already does in
    vgic_flush_lr_state(). The number of implemented list registers is
    constant after init, so it is replicated once from
    kvm_vgic_global_state.nr_lr into hyp_gicv3_nr_lr rather than read on
    every entry.
    
    Cc: stable@vger.kernel.org
    Fixes: be66e67f1750 ("KVM: arm64: Use the pKVM hyp vCPU structure in handle___kvm_vcpu_run()")
    Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
    Reviewed-by: Fuad Tabba <tabba@google.com>
    Tested-by: Fuad Tabba <tabba@google.com>
    Link: https://patch.msgid.link/20260606175614.83273-3-imv4bel@gmail.com
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: arm64: Clear __hyp_running_vcpu when flushing the pKVM hyp vCPU [+ + +]
Author: Hyunwoo Kim <imv4bel@gmail.com>
Date:   Sun Jun 7 02:56:10 2026 +0900

    KVM: arm64: Clear __hyp_running_vcpu when flushing the pKVM hyp vCPU
    
    commit e8042f6e1d7befb2fb6b10a75918642bcd0acf9a upstream.
    
    flush_hyp_vcpu() copies the host vCPU context into the hyp's private
    vCPU on every run. ctxt_to_vcpu() expects a guest context to have a
    NULL __hyp_running_vcpu, which is only ever set on the host context, so
    that it resolves the vCPU via container_of(). While this is generally
    the case, flush_hyp_vcpu() copies the context verbatim and does not
    enforce this, so a value provided by the host is dereferenced at EL2
    (host -> EL2).
    
    Fix by clearing __hyp_running_vcpu after the copy.
    
    Cc: stable@vger.kernel.org
    Fixes: be66e67f1750 ("KVM: arm64: Use the pKVM hyp vCPU structure in handle___kvm_vcpu_run()")
    Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
    Reviewed-by: Fuad Tabba <tabba@google.com>
    Tested-by: Fuad Tabba <tabba@google.com>
    Link: https://patch.msgid.link/20260606175614.83273-2-imv4bel@gmail.com
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: arm64: Don't leak PFN when kvm_translate_vncr() races MMU notifier [+ + +]
Author: Oliver Upton <oupton@kernel.org>
Date:   Tue Jun 2 16:54:46 2026 -0700

    KVM: arm64: Don't leak PFN when kvm_translate_vncr() races MMU notifier
    
    commit 9f76b039a72d7e06374aa96862f0232ed53f7787 upstream.
    
    In the case that kvm_translate_vncr() races with an MMU notifier the
    early return does not release a reference on the faulted in PFN. Add
    the necessary call to kvm_release_faultin_page() for the unused PFN.
    
    Cc: stable@vger.kernel.org
    Fixes: 069a05e535496 ("KVM: arm64: nv: Handle VNCR_EL2-triggered faults")
    Reported-by: Sashiko (local):gemini-3.1-pro
    Signed-off-by: Oliver Upton <oupton@kernel.org>
    Link: https://patch.msgid.link/20260602235450.103057-2-oupton@kernel.org
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: arm64: nv: Avoid dereferencing NULL VNCR pseudo-TLB [+ + +]
Author: Marc Zyngier <maz@kernel.org>
Date:   Sun Jun 7 18:57:45 2026 +0100

    KVM: arm64: nv: Avoid dereferencing NULL VNCR pseudo-TLB
    
    commit 4be6cbeb93d26994bd1827ddbce391e3c4395c8f upstream.
    
    VNCR TLB invalidation occurs from MMU notifiers or TLBI instructions,
    and either can race against a vcpu not being onlined yet (no pseudo-TLB
    allocated). Similarly, the TLB might be invalid, and the invalidation
    should be skipped in this case.
    
    Both kvm_invalidate_vncr_ipa() and kvm_invalidate_vncr_va() are
    expected to perform the same checks, except that the latter doesn't
    check for the allocation and blindly dereferences the pointer.
    
    Solve this by introducing a new iterator built on top of the usual
    kvm_for_each_vcpu() that checks for both of the above conditions,
    and convert the two users to it.
    
    Reported-by: Hyunwoo Kim <imv4bel@gmail.com>
    Link: https://lore.kernel.org/r/aiUvSbrWndQeUPc8@v4bel
    Fixes: 4ffa72ad8f37 ("KVM: arm64: nv: Add S1 TLB invalidation primitive for VNCR_EL2")
    Cc: stable@vger.kernel.org
    Reviewed-by: Oliver Upton <oupton@kernel.org>
    Link: https://patch.msgid.link/20260607175745.297793-1-maz@kernel.org
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: guest_memfd: Treat memslot binding offset+size as unsigned values [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Tue Jun 2 10:09:19 2026 -0700

    KVM: guest_memfd: Treat memslot binding offset+size as unsigned values
    
    commit eba85fee7fc6cf28fec38a5bf3c378bef9a79ca6 upstream.
    
    When binding a memslot to a guest_memfd file, treat the offset and size as
    unsigned values to fix a bug where the sum of the two can result in a false
    negative when checking for overflow against the size of the file.  Passing
    unsigned values also avoids relying on somewhat obscure checks in other
    flows for safety, and tracks the offset and size as they are intended to be
    tracked, as unsigned values.
    
    On 64-bit kernels, the number of pages a memslot contains and thus the size
    (and offset) of its guest_memfd binding are unsigned 64-bit values.  Taking
    the offset+size as an loff_t instead of a uoff_t inadvertently converts
    the unsigned value to a signed value if the offset and/or size is massive.
    
    Locally storing the offset and size as signed values is benign in and of
    itself (though even that is *extremely* difficult to discern), but
    operating on their sum is not.
    
    For the offset, KVM explicitly checks against a negative value, which might
    seem like a bug as KVM could incorrectly reject a legitimate binding, but
    that's not actually the case as KVM_CREATE_GUEST_MEMFD takes a signed value
    for its size, i.e. a would-be-negative offset is also greater than the
    maximum possible size of any guest_memfd file.
    
    Regarding the size, while KVM lacks an explicit check for a negative value,
    i.e. seemingly has a flawed overflow check, KVM restricts the number of
    pages in a single memslot to the largest positive signed 32-bit value:
    
            if (id < KVM_USER_MEM_SLOTS &&
                (mem->memory_size >> PAGE_SHIFT) > KVM_MEM_MAX_NR_PAGES)
                    return -EINVAL;
    
    and so that maximum "size" will ever be is 0x7fffffff000.
    
    The sum of the two is, however, problematic.  While the size is restricted
    by KVM's memslot logic, the offset is not, i.e. the offset is completely
    unchecked until the "offset + size > i_size_read(inode)" check.  If the
    offset is the (nearly) largest possible _positive_ value, then adding size
    to the offset can result in a signed, negative 64-bit value.  When compared
    against the size of the file (guaranteed to be positive), the negative sum
    is always smaller, and KVM incorrectly allows the absurd offset.
    
    Opportunistically add missing includes in kvm_mm.h (instead of relying on
    its parents).
    
    Fixes: a7800aa80ea4 ("KVM: Add KVM_CREATE_GUEST_MEMFD ioctl() for guest-specific backing memory")
    Cc: stable@vger.kernel.org
    Cc: Ackerley Tng <ackerleytng@google.com>
    Reviewed-by: Michael Roth <michael.roth@amd.com>
    Reviewed-by: Ackerley Tng <ackerleytng@google.com>
    Link: https://patch.msgid.link/20260602170921.1304394-2-seanjc@google.com
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: SEV: Don't terminate SNP VMs on #VMGEXIT without a registered GHCB [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Fri May 29 20:35:43 2026 +0200

    KVM: SEV: Don't terminate SNP VMs on #VMGEXIT without a registered GHCB
    
    commit 1797e00bf802d64b859ea18505087daad92019c8 upstream.
    
    If the guest attempts a non-MSR #VMGEXIT without the registered GHCB,
    return a GHCB_HV_RESP_MALFORMED_INPUT+GHCB_ERR_NOT_REGISTERED error to the
    guest instead of exiting KVM_RUN with -EINVAL (and in likelihood killing
    the VM).  KVM has already mapped the requested GHCB, i.e. can cleanly
    report an error, and so exiting with -EINVAL is completely unjustified.
    
    Fixes: 0c76b1d08280 ("KVM: SEV: Add support to handle GHCB GPA register VMGEXIT")
    Cc: stable@vger.kernel.org
    Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
    Reviewed-by: Michael Roth <michael.roth@amd.com>
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Message-ID: <20260501202250.2115252-19-seanjc@google.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Message-ID: <20260529183549.1104619-19-pbonzini@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: SEV: Pin source page for write when adding CPUID data for SNP guest [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Fri May 22 15:46:06 2026 -0700

    KVM: SEV: Pin source page for write when adding CPUID data for SNP guest
    
    commit f13e900599089b10113ceb36013423f0837c6792 upstream.
    
    When populating a guest_memfd instance with the initial CPUID data for an
    SNP guest, acquire a writable pin on the source page as KVM will write back
    the "correct" CPUID information if the userspace provided data is rejected
    by trusted firmware.  Because KVM writes to the source page using a kernel
    mapping, pinning for read could result in KVM clobbering read-only memory.
    
    Note, well-behaved VMMs are unlikely to be affected, as CPUID information
    is almost always dynamically generated by userspace, i.e. it's unlikely for
    the CPUID information to be backed by a read-only mapping.
    
    Fixes: 2a62345b30529 ("KVM: guest_memfd: GUP source pages prior to populating guest memory")
    Cc: stable@vger.kernel.org
    Signed-off-by: Ackerley Tng <ackerleytng@google.com>
    Link: https://patch.msgid.link/20260522-fix-sev-gmem-post-populate-v2-1-3f196bfad5a1@google.com
    [sean: rewrite shortlog and changelog, tag for stable@]
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: SVM: Disable x2AVIC RDMSR interception for MSRs KVM actually supports [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Thu May 14 14:31:14 2026 -0700

    KVM: SVM: Disable x2AVIC RDMSR interception for MSRs KVM actually supports
    
    commit 7f4b7092d9a173a4271e28c0ed1fc235994e309b upstream.
    
    When toggling x2AVIC on/off, use KVM's curated mask of x2APIC MSRs that
    can/should be passed through to the guest (or not) when 2AVIC is enabled.
    Using the effective list provided by the local APIC emulation fixes
    multiple (classes of) bugs, as the existing hand-coded list of MSRs is
    wrong on multiple fronts:
    
     - ARBPRI isn't supported by KVM, isn't accelerated by AVIC (for read or
       write), and its #VMEXIT is fault-like, i.e. requires decoding the
       instruction.  Disabling interception is nonsensical and suboptimal.
    
     - DFR and ICR2 aren't supported by x2APIC and so don't need their
       intercepts disabled for performance reasons.  While the #GP due to
       x2APIC being abled has higher priority than the trap-like #VMEXIT,
       disabling interception of unsupported MSRs is confusing and unnecessary.
    
     - RRR is completely unsupported.
    
     - AVIC currently fails to pass through the "range of vectors" registers,
       IRR, ISR, and TMR, as e.g. X2APIC_MSR(APIC_IRR) only affects IRR0, and
       thus only disables intercept for vectors 31:0 (which are the *least*
       interesting registers).
    
     - TMCCT (the current APIC timer count) isn't accelerated by hardware, and
       generates a fault-like AVIC_UNACCELERATED_ACCESS #VMEXIT, i.e. requires
       KVM to decode the instruction to figure out what the guest was trying to
       access.  Note, the only reason this isn't a fatal bug is that the AVIC
       architecture had the foresight to guard against buggy hypervisors.  E.g.
       if hardware simply read from the virtual APIC page, the guest would get
       garbage (because the timer is emulated in software).
    
    Fixes: 4d1d7942e36a ("KVM: SVM: Introduce logic to (de)activate x2AVIC mode")
    Cc: stable@vger.kernel.org
    Reviewed-by: Naveen N Rao (AMD) <naveen@kernel.org>
    Link: https://patch.msgid.link/20260514213115.1637082-3-seanjc@google.com
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: SVM: Only disable x2AVIC WRMSR interception for MSRs that are accelerated [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Thu May 14 14:31:15 2026 -0700

    KVM: SVM: Only disable x2AVIC WRMSR interception for MSRs that are accelerated
    
    commit 8c63179d975f2029c948ecce622f72af616dbff7 upstream.
    
    When x2AVIC is enabled, disable WRMSR interception only for MSRs that are
    actually accelerated by hardware.  Disabling interception for MSRs that
    aren't accelerated is functionally "fine", and in some cases a weird "win"
    for performance, but only for cases that should never be triggered by a
    well-behaved VM (writes to read-only registers; the #GP will typically
    occur in the guest without taking a #VMEXIT, even for fault-like exits).
    
    But overall, disabling interception for MSRs that aren't accelerated is at
    best confusing and unintuitive, and at worst introduces avoidable risk, as
    the APM's documentation is imperfect and contradictory.  The table in
    "15.29.3.1 Virtual APIC Register Accesses" of simply states that such
    writes generate exits, where as "Section 15.29.10 x2AVIC" says:
    
      x2APIC MSR intercept checks and access checks have higher priority than
      AVIC access permission checks.
    
    CPU behavior follows the latter (which makes perfect sense), but all in
    all there's simply no reason to disable interception just to make a #GP
    faster.
    
    Note, the set of MSRs that are passed through for write is identical to
    VMX's set when IPI virtualization is enabled.  This is not a coincidence,
    and is another motiviating factor for cleaning up the intercepts, as x2AVIC
    is functionally equivalent to APICv+IPIv.
    
    Fixes: 4d1d7942e36a ("KVM: SVM: Introduce logic to (de)activate x2AVIC mode")
    Cc: stable@vger.kernel.org
    Reviewed-by: Naveen N Rao (AMD) <naveen@kernel.org>
    Link: https://patch.msgid.link/20260514213115.1637082-4-seanjc@google.com
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: TDX: Account all non-transient page allocations for per-TD structures [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Wed Jan 28 17:14:35 2026 -0800

    KVM: TDX: Account all non-transient page allocations for per-TD structures
    
    commit a8b2924676ec42d76597f849baba31acc3ba1bfc upstream.
    
    Account all non-transient allocations associated with a single TD (or its
    vCPUs), as KVM's ABI is that allocations that are active for the lifetime
    of a VM are accounted.  Leave temporary allocations, i.e. allocations that
    are freed within a single function/ioctl, unaccounted, to again align with
    KVM's existing behavior, e.g. see commit dd103407ca31 ("KVM: X86: Remove
    unnecessary GFP_KERNEL_ACCOUNT for temporary variables").
    
    Fixes: 8d032b683c29 ("KVM: TDX: create/destroy VM structure")
    Fixes: a50f673f25e0 ("KVM: TDX: Do TDX specific vcpu initialization")
    Cc: stable@vger.kernel.org
    Reviewed-by: Kai Huang <kai.huang@intel.com>
    Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
    Link: https://patch.msgid.link/20260129011517.3545883-4-seanjc@google.com
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: VMX: Grab vmcs12 on CR8 interception update iff vCPU is in guest mode [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Thu Jul 9 15:21:08 2026 +0200

    KVM: VMX: Grab vmcs12 on CR8 interception update iff vCPU is in guest mode
    
    [ Upstream commit 7ef78d71ca713d8c00f7c34ddcf276c808143f77 ]
    
    When updating CR8 intercepts, get vmcs12 if and only if the vCPU is in
    guest mode so that a future change can have update CR8 intercepts during
    vCPU creation, without running afoul of get_vmcs12()'s lockdep assertion.
    
      ------------[ cut here ]------------
      debug_locks && !(lock_is_held(&(&vcpu->mutex)->dep_map) || !refcount_read(&vcpu->kvm->users_count))
      WARNING: arch/x86/kvm/vmx/nested.h:61 at get_vmcs12 arch/x86/kvm/vmx/nested.h:60 [inline], CPU#0: syz.2.19/5879
      WARNING: arch/x86/kvm/vmx/nested.h:61 at vmx_update_cr8_intercept+0x3de/0x4e0 arch/x86/kvm/vmx/vmx.c:6879, CPU#0: syz.2.19/5879
      Modules linked in:
      CPU: 0 UID: 0 PID: 5879 Comm: syz.2.19 Not tainted syzkaller #0 PREEMPT(full)
      Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
      RIP: 0010:get_vmcs12 arch/x86/kvm/vmx/nested.h:60 [inline]
      RIP: 0010:vmx_update_cr8_intercept+0x3de/0x4e0 arch/x86/kvm/vmx/vmx.c:6879
      Call Trace:
       <TASK>
       apic_update_ppr arch/x86/kvm/lapic.c:984 [inline]
       kvm_lapic_reset+0x1c24/0x2980 arch/x86/kvm/lapic.c:3023
       kvm_vcpu_reset+0x44c/0x1bf0 arch/x86/kvm/x86.c:12986
       kvm_arch_vcpu_create+0x746/0x8b0 arch/x86/kvm/x86.c:12847
       kvm_vm_ioctl_create_vcpu+0x428/0x930 virt/kvm/kvm_main.c:4201
       kvm_vm_ioctl+0x893/0xd50 virt/kvm/kvm_main.c:5159
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:597 [inline]
       __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:583
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f
       </TASK>
    
    No functional change intended.
    
    Reported-by: syzbot ci <syzbot+ci493c6d734b63e050@syzkaller.appspotmail.com>
    Closes: https://lore.kernel.org/all/6a2adf3b.3b0a2d4e.8c8d1.0012.GAE@google.com
    Cc: stable@vger.kernel.org
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Message-ID: <20260618174347.1981064-2-seanjc@google.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Carlos López <clopez@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: VMX: Handle bad values on proxied writes to LBR MSRs [+ + +]
Author: Xuanqing Shi <1356292400@qq.com>
Date:   Tue May 26 19:26:17 2026 -0700

    KVM: VMX: Handle bad values on proxied writes to LBR MSRs
    
    commit ca674df13b195eb6d124ab059799d4e03fa40624 upstream.
    
    Use the "safe" WRMSR API when writing LBRs on behalf of the guest (or host
    userspace), and propagate any errors back to the instigator, as the value
    being written is untrusted.  E.g. if the guest (or host userspace) attempts
    to set reserved bits in LBR_SELECT, then KVM needs to return an error, and
    not WARN on the bad value.
    
    Continue using the "unsafe" version of RDMSR, as it should be impossible to
    reach the helper with a completely bogus MSR, i.e. WARNing on RDMSR failure
    is very desirable, e.g. to make KVM bugs more visible.
    
      unchecked MSR access error: WRMSR to 0x1c8 (tried to write 0x0000000000004000)
      Call Trace:
       intel_pmu_set_msr+0x4e0/0x7f0 [kvm_intel]
       kvm_pmu_set_msr+0x17e/0x1c0 [kvm]
       kvm_set_msr_common+0xc76/0x1440 [kvm]
       vmx_set_msr+0x5e6/0x1570 [kvm_intel]
       kvm_emulate_wrmsr+0x54/0x1d0 [kvm]
       vmx_handle_exit+0x7fc/0x970 [kvm_intel]
    
    Fixes: 1b5ac3226a1a ("KVM: vmx/pmu: Pass-through LBR msrs when the guest LBR event is ACTIVE")
    Cc: stable@vger.kernel.org
    Signed-off-by: Xuanqing Shi <1356292400@qq.com>
    [sean: rework changelog, only modify WRMSR path, tag for stable@]
    Link: https://patch.msgid.link/20260527022617.3973884-1-seanjc@google.com
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: VMX: Refresh GUEST_PENDING_DBG_EXCEPTIONS.BS on all injected #DBs [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Fri May 15 15:26:29 2026 -0700

    KVM: VMX: Refresh GUEST_PENDING_DBG_EXCEPTIONS.BS on all injected #DBs
    
    commit c5bad4fa2d5dfd8c25140051a9807eba387a19b8 upstream.
    
    Move KVM's stuffing of GUEST_PENDING_DBG_EXCEPTIONS.BS when RFLAGS.TF=1 and
    MOV/POP SS or STI blocking is active into the exception injection code so
    that KVM fixes up the VMCS for all injected #DBs, not only those that are
    reflected back into the guest after #DB interception.  E.g. if KVM queues
    a #DB in the emulator, or more importantly if userspace does save/restore
    exactly on the #DB+shadow boundary, then KVM needs to massage the VMCS to
    avoid the VM-Entry consistency check.
    
    Opportunistically update the wording of the comment to describe the
    behavior as a workaround of flawed CPU behavior/architecture, to make it
    clear that the *only* thing KVM is doing is fudging around a consistency
    check.  Per the SDM:
    
      There are no pending debug exceptions after VM entry if any of the
      following are true:
    
        * The VM entry is vectoring with one of the following interruption
          types: external interrupt, non-maskable interrupt (NMI), hardware
          exception, or privileged software exception.
    
    I.e. forcing GUEST_PENDING_DBG_EXCEPTIONS.BS does *not* impact guest-
    visible behavior.
    
    Fixes: b9bed78e2fa9 ("KVM: VMX: Set vmcs.PENDING_DBG.BS on #DB in STI/MOVSS blocking shadow")
    Cc: stable@vger.kernel.org
    Reported-by: Hou Wenlong <houwenlong.hwl@antgroup.com>
    Closes: https://lore.kernel.org/all/b1a294bc9ed4dae532474a5dc6c8cb6e5962de7c.1757416809.git.houwenlong.hwl@antgroup.com
    Reviewed-by: Hou Wenlong <houwenlong.hwl@antgroup.com>
    Link: https://patch.msgid.link/20260515222638.1949982-2-seanjc@google.com
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: x86: Add dedicated API for getting mask of accelerated x2APIC MSRs [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Thu May 14 14:31:13 2026 -0700

    KVM: x86: Add dedicated API for getting mask of accelerated x2APIC MSRs
    
    commit 8ba621f335a519b47cb7d3e3f4f15b5101b3a56f upstream.
    
    Add a dedicated local APIC API, kvm_x2apic_disable_intercept_reg_mask(),
    to provide the mask of x2APIC registers whose MSRs can and should be passed
    through to the guest when x2APIC virtualization is enable, and use it in
    lieu of the open-coded equivalent VMX logic.  Providing a common helper
    will allow sharing the logic with SVM (x2AVIC), and as a bonus eliminates
    the somewhat confusing code where KVM enables interception for MSR_TYPE_RW,
    even though only the READ case actually needs to be updated.
    
    No functional change intended.
    
    Cc: stable@vger.kernel.org
    Reviewed-by: Naveen N Rao (AMD) <naveen@kernel.org>
    Link: https://patch.msgid.link/20260514213115.1637082-2-seanjc@google.com
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: x86: Ensure vendor's exit handler runs before fastpath userspace exits [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Thu Apr 23 09:26:27 2026 -0700

    KVM: x86: Ensure vendor's exit handler runs before fastpath userspace exits
    
    commit 0ffedf43910e44b76c2c1db4e9fbf12b268190c1 upstream.
    
    Move the handling of fastpath userspace exits into vendor code to ensure
    KVM runs vendor specific operations that need to run before userspace gains
    control of the vCPU.  E.g. for VMX (and soon to be for SVM as well), KVM
    needs to flush the PML buffer prior to exiting to userspace, otherwise any
    memory written by the final KVM_RUN might never be flagged as dirty.
    
    Note, waiting to snapshot CR0 and CR3 until svm_handle_exit() is flawed in
    general, as that risks consuming stale state in a fastpath handler.  That
    will be addressed in a future change.
    
    Fixes: f7f39c50edb9 ("KVM: x86: Exit to userspace if fastpath triggers one on instruction skip")
    Cc: stable@vger.kernel.org
    Cc: Nikunj A. Dadhania <nikunj@amd.com>
    Reviewed-by: Nikunj A. Dadhania <nikunj@amd.com>
    Reviewed-by: Kai Huang <kai.huang@intel.com>
    Link: https://patch.msgid.link/20260423162628.490962-2-seanjc@google.com
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: x86: Move update_cr8_intercept() to lapic.c [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Thu Jul 9 15:21:07 2026 +0200

    KVM: x86: Move update_cr8_intercept() to lapic.c
    
    [ Upstream Commit c7722e5e1daeeabbd9f969554d52bb7158120b27 ]
    
    Move update_cr8_intercept() to lapic.c so that it's globally visible
    in anticipation of extracting most of the register-specific code out of
    x86.c and into a new compilation unit.  Opportunistically prefix the
    helper kvm_lapic_ to make its role/scope more obvious.
    
    No functional change intended.
    
    Reviewed-by: Kai Huang <kai.huang@intel.com>
    Reviewed-by: Yosry Ahmed <yosry@kernel.org>
    Link: https://patch.msgid.link/20260529222223.870923-14-seanjc@google.com
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Signed-off-by: Carlos López <clopez@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: x86: Unconditionally recompute CR8 intercept on PPR update [+ + +]
Author: Carlos López <clopez@suse.de>
Date:   Thu Jul 9 15:21:09 2026 +0200

    KVM: x86: Unconditionally recompute CR8 intercept on PPR update
    
    [ Upstream commit bb365a506b1e6fb050c0fceaad354fe395385ef0 ]
    
    The TPR_THRESHOLD field in the VMCS is used by VMX to induce VM exits
    when the guest's virtual TPR falls under the specified threshold,
    allowing KVM to inject previously masked interrupts.
    
    KVM handles these VM exits in handle_tpr_below_threshold().
    Commit eb90f3417a0c ("KVM: vmx: speed up TPR below threshold vmexits")
    optimized this function by calling apic_update_ppr() instead of raising
    KVM_REQ_EVENT. apic_update_ppr() then raises KVM_REQ_EVENT if there is
    a pending, deliverable interrupt.
    
    However, if there are no new interrupts pending, apic_update_ppr() does
    not issue the request. Thus, kvm_lapic_update_cr8_intercept() and
    vmx_update_cr8_intercept() are not called before VM entry, which results
    in a high, stale TPR_THRESHOLD. This is problematic due to the following
    sentence in 28.2.1.1 "VM-Execution Control Fields" in the SDM:
    
      The following check is performed if the “use TPR shadow” VM-execution
      control is 1 and the “virtualize APIC accesses” and “virtual-interrupt
      delivery” VM-execution controls are both 0: the value of bits 3:0 of
      the TPR threshold VM-execution control field should not be greater
      than the value of bits 7:4 of VTPR.
    
    This error condition is typically not observed when KVM runs on a bare
    metal system because modern processors support APICv, which enables
    virtual-interrupt delivery, and which KVM uses when possible. This
    causes the processor to no longer generate TPR-below-threshold exits
    and to no longer check TPR_THRESHOLD on entry. However, when running
    on older platforms, or under nested virtualization on a hypervisor that
    does not support virtual-interrupt delivery and enforces this check
    (like Hyper-V) this can cause a VM entry failure with hardware error
    0x7, as seen in [1].
    
    Call kvm_lapic_update_cr8_intercept() if apic_update_ppr() does not
    find a deliverable interrupt (and thus does not raise KVM_REQ_EVENT).
    Remove calls to kvm_lapic_update_cr8_intercept() on paths that end up in
    apic_update_ppr(), as they now become redundant. This ensures that any
    path that updates the guest's PPR also figures out if KVM needs to wait
    for a TPR change (using TPR_THRESHOLD on VMX or CR8 intercepts on SVM).
    
    Link: https://github.com/coconut-svsm/svsm/issues/1081 [1]
    Tested-by: Stefano Garzarella <sgarzare@redhat.com>
    Cc: stable@vger.kernel.org
    Fixes: eb90f3417a0c ("KVM: vmx: speed up TPR below threshold vmexits")
    Signed-off-by: Carlos López <clopez@suse.de>
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Message-ID: <20260618174347.1981064-3-seanjc@google.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
landlock: Account all audit data allocations to user space [+ + +]
Author: Mickaël Salaün <mic@digikod.net>
Date:   Wed May 13 20:03:08 2026 +0200

    landlock: Account all audit data allocations to user space
    
    commit b232bd12789fa57405b5092f28788be97aae9999 upstream.
    
    Mark the kzalloc_flex() of struct landlock_details with
    GFP_KERNEL_ACCOUNT so the allocation is charged to the calling task,
    like the other Landlock per-domain allocations which have used
    GFP_KERNEL_ACCOUNT forever.
    
    Every property of landlock_details is caller-attributable: allocated by
    landlock_restrict_self(2), owned by the caller's landlock_hierarchy,
    contents are the caller's pid, uid, comm, and exe_path, lifetime bounded
    by the caller's domain.  While the caller may not know nor control the
    size of this allocation (i.e. exe_path), this data should still be
    accounted for it.
    
    The deciding factor is whether userspace can trigger the allocation, not
    whether the size of the data is known nor controlled by the caller.
    This aligns with the kmemcg accounting policy established by commit
    5d097056c9a0 ("kmemcg: account certain kmem allocations to memcg").
    
    No new failure modes: the hierarchy and ruleset are allocated before
    details and are already accounted, so landlock_restrict_self(2) already
    returns -ENOMEM under memcg pressure.  This change widens that existing
    failure window slightly; it does not introduce a new error code.
    
    Cc: Günther Noack <gnoack@google.com>
    Cc: Paul Moore <paul@paul-moore.com>
    Cc: stable@vger.kernel.org
    Fixes: 1d636984e088 ("landlock: Add AUDIT_LANDLOCK_DOMAIN and log domain status")
    Link: https://patch.msgid.link/20260513180309.165840-1-mic@digikod.net
    Signed-off-by: Mickaël Salaün <mic@digikod.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

landlock: Set audit_net.sk for socket access checks [+ + +]
Author: Mickaël Salaün <mic@digikod.net>
Date:   Fri Jun 12 19:27:55 2026 +0200

    landlock: Set audit_net.sk for socket access checks
    
    commit d936e1a9170f9cadaa5f37586b1dfe6f20f98799 upstream.
    
    Set audit_net.sk in current_check_access_socket() to provide the socket
    object to audit_log_lsm_data().  This makes Landlock consistent with
    AppArmor, which always sets .sk for socket operations, and with
    SELinux's generic socket permission checks.
    
    The socket's local and foreign address information (laddr, lport, faddr,
    fport) is logged by the shared lsm_audit.c infrastructure when the
    socket has bound or connected state.  Fields with zero values are
    suppressed by print_ipv4_addr()/print_ipv6_addr(), so the audit output
    is unchanged for the common case of bind denials on unbound sockets.
    For connect denials after a prior bind, the bound local address (laddr,
    lport) appears before the existing sockaddr fields (daddr, dest).
    
    No existing fields are removed or reordered, and the new field names
    (laddr, lport, faddr, fport) are standard audit fields already emitted
    by other LSMs through the same lsm_audit.c code path.
    
    Add a connect_tcp_bound audit test that binds to an allowed port and
    then connects to a denied one, verifying that the denial record reports
    laddr/lport from the bound socket in addition to the connect
    destination.
    
    Cc: Günther Noack <gnoack@google.com>
    Cc: Tingmao Wang <m@maowtm.org>
    Cc: stable@vger.kernel.org
    Fixes: 9f74411a40ce ("landlock: Log TCP bind and connect denials")
    Link: https://patch.msgid.link/20260612172757.1003481-1-mic@digikod.net
    Signed-off-by: Mickaël Salaün <mic@digikod.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
lib/test_hmm: use kvfree() to free kvcalloc() allocations [+ + +]
Author: Hao Ge <hao.ge@linux.dev>
Date:   Wed May 13 16:25:25 2026 +0800

    lib/test_hmm: use kvfree() to free kvcalloc() allocations
    
    commit 59f19bf6f119eecfa16355186b593abba8eb5198 upstream.
    
    Coccinelle scripts/coccinelle/api/kfree_mismatch.cocci reports
    the following warnings:
    
      lib/test_hmm.c:1256:15-16: WARNING kvmalloc is used to allocate this memory at line 1191
      lib/test_hmm.c:1257:15-16: WARNING kvmalloc is used to allocate this memory at line 1196
    
    Fix this by replacing kfree() with kvfree() to correctly handle the
    vmalloc() fallback path of kvcalloc().
    
    Link: https://lore.kernel.org/20260513082525.154036-1-hao.ge@linux.dev
    Fixes: 775465fd26a3 ("lib/test_hmm: add zone device private THP test infrastructure")
    Signed-off-by: Hao Ge <hao.ge@linux.dev>
    Acked-by: Balbir Singh <balbirs@nvidia.com>
    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>

 
libfs: set SB_I_NOEXEC and SB_I_NODEV by default in init_pseudo() [+ + +]
Author: John Hubbard <jhubbard@nvidia.com>
Date:   Wed Jun 3 19:53:14 2026 -0700

    libfs: set SB_I_NOEXEC and SB_I_NODEV by default in init_pseudo()
    
    commit 6de2aeffabaafaeda819e60ec8d04f199711e11a upstream.
    
    Since commit 1e7ab6f67824 ("anon_inode: rework assertions"),
    path_noexec() warns when an anonymous-inode file is mmap'd from a
    superblock that has not set SB_I_NOEXEC. dma-buf backs its files this
    way and never set the flag, so mmap of any exported buffer trips the
    warning on a CONFIG_DEBUG_VFS=y kernel:
    
      WARNING: CPU: 11 PID: 121813 at fs/exec.c:118 path_noexec+0x47/0x50
       do_mmap+0x2b5/0x680
       vm_mmap_pgoff+0x129/0x210
       ksys_mmap_pgoff+0x177/0x240
       __x64_sys_mmap+0x33/0x70
    
    init_pseudo() sets up internal SB_NOUSER mounts that are never
    path-reachable. Set both flags here so every pseudo filesystem gets
    them by default instead of each caller setting them.
    
    SB_I_NODEV is inert for unreachable mounts. SB_I_NOEXEC has one
    visible effect: an executable mapping of a pseudo-fs fd, such as a
    dma-buf, now fails with -EPERM, which is the invariant the assertion
    enforces. No in-tree caller maps these executable.
    
    Reproduce on CONFIG_DEBUG_VFS=y:
    
      make -C tools/testing/selftests/dmabuf-heaps
      sudo ./tools/testing/selftests/dmabuf-heaps/dmabuf-heap -t system
    
    Fixes: 1e7ab6f67824 ("anon_inode: rework assertions")
    Suggested-by: Christoph Hellwig <hch@infradead.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: John Hubbard <jhubbard@nvidia.com>
    Link: https://patch.msgid.link/20260604025315.245910-2-jhubbard@nvidia.com
    Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Linux: Linux 7.1.4 [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Sat Jul 18 16:55:52 2026 +0200

    Linux 7.1.4
    
    Link: https://lore.kernel.org/r/20260716133047.772246337@linuxfoundation.org
    Tested-by: Ronald Warsow <rwarsow@gmx.de>
    Tested-by: Brett A C Sheffield <bacs@librecast.net>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Justin M. Forbes <jforbes@fedoraproject.org>
    Tested-by: Peter Schneider <pschneider1968@googlemail.com>
    Tested-by: Salvatore Bonaccorso <carnil@debian.org>
    Tested-by: Miguel Ojeda <ojeda@kernel.org>
    Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com>
    Tested-by: Ron Economos <re@w6rz.net>
    Tested-by: Shuah Khan <skhan@linuxfoundation.org>
    Tested-by: Pavel Machek (CIP) <pavel@nabladev.com>
    Link: https://lore.kernel.org/r/20260717101912.682013354@linuxfoundation.org
    Tested-by: Brett A C Sheffield <bacs@librecast.net>
    Tested-by: Ronald Warsow <rwarsow@gmx.de>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Pavel Machek (CIP) <pavel@nabladev.com>
    Tested-by: Peter Schneider <pschneider1968@googlemail.com>
    Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com>
    Tested-by: Barry K. Nathan <barryn@pobox.com>
    Tested-by: Mark Brown <broonie@kernel.org>
    Tested-by: Miguel Ojeda <ojeda@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
liveupdate: reject LIVEUPDATE_IOCTL_CREATE_SESSION with invalid name length [+ + +]
Author: Luca Boccassi <luca.boccassi@gmail.com>
Date:   Wed Apr 29 22:21:14 2026 +0100

    liveupdate: reject LIVEUPDATE_IOCTL_CREATE_SESSION with invalid name length
    
    commit e947433cd0d2b95a277757451b9b9c2714136dc2 upstream.
    
    A session name must not be an empty string, and must not exceed the
    maximum size define in the uapi header, including null termination.
    
    Fixes: 0153094d03df ("liveupdate: luo_session: add sessions support")
    Cc: stable@vger.kernel.org
    
    Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
    Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com>
    Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
    Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
    Link: https://lore.kernel.org/r/20260429212221.814107-2-luca.boccassi@gmail.com
    Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
    Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
LoongArch: Add PIO for early access before ACPI PCI root register [+ + +]
Author: Huacai Chen <chenhuacai@kernel.org>
Date:   Thu Jun 25 13:03:47 2026 +0800

    LoongArch: Add PIO for early access before ACPI PCI root register
    
    commit 6061e65f95713b01f4313cda6637dfe3aa5412b4 upstream.
    
    For ACPI system we suppose the ISA/LPC PIO range is registered together
    with PCI root bridge. But the fact is there may be some early access to
    the ISA/LPC PIO range before ACPI PCI root register (most of them are
    due to abnormal BIOS). Unconditionally register the ISA/LPC PIO range
    usually causes ACPI PCI root register fail because of the address range
    confliction. So we add a pair of helpers: acpi_add_early_pio() to add
    PIO for early access, and acpi_remove_early_pio() to remove PIO before
    PCI root register. Since acpi_remove_early_pio() may be called multiple
    times, we add an acpi_pio flag to ensure PIO be removed only once.
    
    Cc: <stable@vger.kernel.org>
    Tested-by: Yuanzhen Gan <elysia-best@simplelinux.cn.eu.org>
    Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

LoongArch: KVM: Add missing slots_lock for device register/unregister [+ + +]
Author: Zeng Chi <zengchi@kylinos.cn>
Date:   Thu Jun 11 20:46:44 2026 +0800

    LoongArch: KVM: Add missing slots_lock for device register/unregister
    
    commit aeded601d6aceb57cdda4b2701d2ee00c43a8b69 upstream.
    
    kvm_io_bus_register_dev() and kvm_io_bus_unregister_dev() should be
    called under kvm->slots_lock. The unregister calls in ipi.c, eiointc.c
    and pch_pic.c were also missing this protection. Add it to match the
    register side.
    
    Cc: stable@vger.kernel.org
    Reviewed-by: Bibo Mao <maobibo@loongson.cn>
    Signed-off-by: Zeng Chi <zengchi@kylinos.cn>
    Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
media: mtk-jpeg: cancel workqueue on release for supported platforms only [+ + +]
Author: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
Date:   Wed Apr 1 11:44:15 2026 +0200

    media: mtk-jpeg: cancel workqueue on release for supported platforms only
    
    commit b1845a227fda37b2fe5327df3ca0015d7e290235 upstream.
    
    Since a recent fix the mtk_jpeg_release function cancels any pending
    or running work present in the driver workqueue using
    cancel_work_sync function.
    Currently, only the multicore based variants use this workqueue and they
    have the jpeg_worker platform data field initialized with a workqueue
    callback function. For the others, this field value remain NULL by
    default.
    The cancel_work_sync function is unconditionally called in
    mtk_jpeg_release function, even for the variants that do not use the
    workqueue. This call generates a WARN_ON print in __flush_work because
    the workqueue callback function presence check fails in __flush_work
    function (used by cancel_work_sync).
    
    So, to avoid these warnings, call cancel_work_sync only if a workqueue
    callback is defined in platform data.
    
    Fixes: 34c519feef3e ("media: mtk-jpeg: fix use-after-free in release path due to uncancelled work")
    Cc: stable@vger.kernel.org
    Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: nxp: imx8-isi: Fix use-after-free on remove [+ + +]
Author: Xiaolei Wang <xiaolei.wang@windriver.com>
Date:   Thu May 7 12:13:15 2026 +0800

    media: nxp: imx8-isi: Fix use-after-free on remove
    
    commit b670bf89824ede5d07d20bb9bfbafb754846081d upstream.
    
    KASAN reports a slab-use-after-free in __media_entity_remove_link()
    during rmmod of imx8_isi:
    
      BUG: KASAN: slab-use-after-free in __media_entity_remove_link+0x608/0x650
      Read of size 2 at addr ffff0000d47cb02a by task rmmod/724
    
      Call trace:
       __media_entity_remove_link+0x608/0x650
       __media_entity_remove_links+0x78/0x144
       __media_device_unregister_entity+0x150/0x280
       media_device_unregister_entity+0x48/0x68
       v4l2_device_unregister_subdev+0x158/0x300
       v4l2_async_unbind_subdev_one+0x22c/0x358
       v4l2_async_nf_unbind_all_subdevs+0xfc/0x1c0
       v4l2_async_nf_unregister+0x5c/0x14c
       mxc_isi_remove+0x124/0x2a0 [imx8_isi]
    
      Allocated by task 249:
       __kmalloc_noprof+0x27c/0x690
       mxc_isi_crossbar_init+0x22c/0x560 [imx8_isi]
    
      Freed by task 724:
       kfree+0x1e4/0x5b0
       mxc_isi_crossbar_cleanup+0x34/0x80 [imx8_isi]
       mxc_isi_remove+0x11c/0x2a0 [imx8_isi]
    
    The problem is that mxc_isi_remove() calls mxc_isi_crossbar_cleanup()
    before mxc_isi_v4l2_cleanup(). The crossbar cleanup frees the media
    entity pads, but the subsequent v4l2 cleanup still tries to remove
    media links that reference those pads.
    
    Fix this by calling mxc_isi_v4l2_cleanup() before
    mxc_isi_crossbar_cleanup() to ensure all media entities are properly
    unregistered while the pads are still valid.
    
    Fixes: cf21f328fcaf ("media: nxp: Add i.MX8 ISI driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Link: https://patch.msgid.link/20260507041318.491594-2-xiaolei.wang@windriver.com
    Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

media: staging: ipu3-imgu: Add range check for imgu_css_cfg_acc_stripe [+ + +]
Author: Ricardo Ribalda <ribalda@chromium.org>
Date:   Thu May 7 20:58:10 2026 +0000

    media: staging: ipu3-imgu: Add range check for imgu_css_cfg_acc_stripe
    
    commit c32fe4c4918c9aa49f61359e3b42619c4d8686de upstream.
    
    If the driver's stripe information is invalid it can result in an integer
    underflow. Add a range check to avoid this kind of error.
    
    This patch fixes the following smatch error:
    drivers/staging/media/ipu3/ipu3-css-params.c:1792 imgu_css_cfg_acc_stripe() warn: 'acc->stripe.bds_out_stripes[0]->width - 2 * f' 4294967168 can't fit into 65535 'acc->stripe.bds_out_stripes[1]->offset'
    
    Cc: stable@vger.kernel.org
    Fixes: e11110a5b744 ("media: staging/intel-ipu3: css: Compute and program ccs")
    Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
    Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mfd: cros_ec: Delay dev_set_drvdata() until probe success [+ + +]
Author: Andrei Kuchynski <akuchynski@chromium.org>
Date:   Mon Apr 27 13:17:21 2026 +0000

    mfd: cros_ec: Delay dev_set_drvdata() until probe success
    
    commit 8b2c1d41bc36c100b38ce5ee6def246c527eaf8a upstream.
    
    If ec_device_probe() fails, cros_ec_class_release releases memory for the
    cros_ec_dev structure. However, because the drvdata was already set,
    sub-drivers like cros_ec_typec can still retrieve the stale pointer via the
    platform device. This leads to a use-after-free when cros_ec_typec attempts
    to access &typec->ec->ec->dev on a device that has already been released.
    Move dev_set_drvdata() to ensure that the pointer is only made available
    once all initialization steps have succeeded.
    
     sysfs: cannot create duplicate filename '/class/chromeos/cros_ec'
     Call trace:
      sysfs_do_create_link_sd+0x94/0xdc
      sysfs_create_link+0x30/0x44
      device_add_class_symlinks+0x90/0x13c
      device_add+0xf0/0x50c
      ec_device_probe+0x150/0x4f0
      platform_probe+0xa0/0xe0
     ...
     BUG: KASAN: invalid-access in __memcpy+0x44/0x230
     Write at addr f5ffff809e2d33ac by task kworker/u32:5/125
     Pointer tag: [f5], memory tag: [fe]
     Tainted : [W]=WARN, [O]=OOT_MODULE
     Hardware name: Google Navi unprovisioned 0x7FFFFFFF/sku0 board/sku3
     Workqueue: events_unbound deferred_probe_work_func
     Call trace:
      __memcpy+0x44/0x230
      cros_ec_check_features+0x60/0xcc [cros_ec_proto]
      cros_typec_probe+0xe8/0x6e0 [cros_ec_typec]
      platform_probe+0xa0/0xe0
    
    Cc: stable@vger.kernel.org
    Fixes: 1c1d152cc5ac ("platform/chrome: cros_ec_dev - utilize new cdev_device_add helper function")
    Co-developed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
    Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
    Signed-off-by: Andrei Kuchynski <akuchynski@chromium.org>
    Reviewed-by: Benson Leung <bleung@chromium.org>
    Link: https://patch.msgid.link/20260427131721.1165078-1-akuchynski@chromium.org
    Signed-off-by: Lee Jones <lee@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/damon/ops-common: handle extreme intervals in damon_hot_score() [+ + +]
Author: SeongJae Park <sj@kernel.org>
Date:   Tue Jun 23 06:58:31 2026 -0700

    mm/damon/ops-common: handle extreme intervals in damon_hot_score()
    
    commit 35d4a3cf70a855b50e53189ac2f8463e20a02046 upstream.
    
    Fix three issues in damon_hot_score() that comes from wrong handling of
    extreme (zero or too high) monitoring intervals user setup.
    
    When the user sets sampling interval zero, damon_max_nr_accesses(), which
    is called from damon_hot_score(), causes a divide-by-zero.  Needless to
    say, it is a problem.
    
    When the user sets the aggregation interval zero, the function returns
    zero.  It is wrong, since the real maximum nr_acceses in the setup should
    be one.  Worse yet, it can cause another divide-by-zero from its caller,
    damon_hot_score(), since it uses damon_max_nr_accesses() return value as a
    denominator.
    
    When the user sets the aggregation interval very high, damon_hot_score()
    could return a value out of [0, DAMOS_MAX_SCORE] range.  Since the return
    value is used as an index to the regions_score_histogram array, which is
    DAMOS_MAX_SCORE+1 size, it causes out of bounds array access.
    
    The issues can be relatively easily reproduced like below.  The sysfs
    write permission is required, though.
    
        # ./damo start --damos_action lru_prio --damos_quota_space 100M \
                --damos_quota_interval 1s
        # cd /sys/kernel/mm/damon/admin/kdamonds/0
        # echo 0 > contexts/0/monitoring_attrs/intervals/sample_us
        # echo 0 > contexts/0/monitoring_attrs/intervals/aggr_us
        # echo commit > state
        # dmesg
        [...]
        [  131.329762] Oops: divide error: 0000 [#1] SMP NOPTI
        [...]
        [  131.336089] RIP: 0010:damon_hot_score+0x27/0xd0
        [...]
    
    Fix the divide-by-zero intervals problems by explicitly handling the zero
    intervals in damon_max_nr_accesses().  Fix the out-of-bound array access
    by applying [0, DAMOS_MAX_SCORE] bounds before returning from
    damon_hot_score().
    
    The issue was discovered [1] by Sashiko.
    
    Link: https://lore.kernel.org/20260623135834.67189-1-sj@kernel.org
    Link: https://lore.kernel.org/20260619202459.145010-1-sj@kernel.org [1]
    Fixes: 198f0f4c58b9 ("mm/damon/vaddr,paddr: support pageout prioritization")
    Signed-off-by: SeongJae Park <sj@kernel.org>
    Cc: <stable@vger.kernel.org> # 5.16.x
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/khugepaged: write all dirty file folios when collapsing [+ + +]
Author: Pedro Falcato <pfalcato@suse.de>
Date:   Wed Jul 8 16:13:57 2026 +0100

    mm/khugepaged: write all dirty file folios when collapsing
    
    [There is no upstream commit, as this code was removed by upstream
     commit 044925f9b565 ("mm: fs: remove filemap_nr_thps*() functions and their users")]
    
    As-is, khugepaged and writable-file opening exclude each other. A file
    cannot be open writeable and have THPs (because the filesystem is not aware
    of them). khugepaged will never collapse file pages for files that are
    opened writeable. On an open(O_RDWR/O_WRONLY), the page cache for that
    particular file is dropped. This is fine because nothing could've been
    dirtied.
    
    However, there is an edge-case: collapse_file() might not be able to
    coexist with concurrent writers, but it can coexist with dirty folios
    (from previous writers). Therefore, the following can happen:
    
    open(file, O_RDWR)
    write(file)
    close(file)
    madvise(file_mapping, MADV_COLLAPSE, some non-dirty range)
    open(file, O_RDWR)
     nr_thps > 0
      truncate_inode_pages()
        /* THPs are cleared out, but so are the dirty folios */
    
    When this edge-case happens, there is data loss, as the dirty folios are
    fully discarded.
    
    Fix it by fully writing back the page cache (and waiting) when collapsing
    file THPs. Doing so provides the guarantee that no dirty folio will be
    observed while there are active THPs. To fully ensure this is safe, the
    invalidate_lock needs to be held while doing the writeout, so that
    do_dentry_open()'s page cache truncation excludes this write-and-wait.
    
    As a side effect, move the nr_thps counter bumping outside the i_pages
    lock. This is correct since the counter itself is an atomic_t and the
    producer <-> consumer correctness is provided by a full memory barrier:
    smp_mb() in collapse_file()/memory barrier implied by full ordering in
    get_write_access() -> atomic_inc_unless_negative().
    
    Cc: stable@vger.kernel.org
    Cc: Alexander Viro <viro@zeniv.linux.org.uk>
    Cc: Christian Brauner <brauner@kernel.org>
    Cc: Jan Kara <jack@suse.cz>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Song Liu <song@kernel.org>
    Cc: Eric Hagberg <ehagberg@janestreet.com>
    Cc: Zi Yan <ziy@nvidia.com>
    Fixes: 99cb0dbd47a1 ("mm,thp: add read-only THP support for (non-shmem) FS")
    Reported-by: Gregg Leventhal <gleventhal@janestreet.com>
    Closes: https://lore.kernel.org/linux-mm/CAFN_u7H_0ECF3jixP=T=U7AH5=Q3wQNvJMo8an3VqUDMerQfUw@mail.gmail.com/
    Tested-by: Zi Yan <ziy@nvidia.com>
    Tested-by: Lance Yang <lance.yang@linux.dev>
    Signed-off-by: Pedro Falcato <pfalcato@suse.de>
    Acked-by: David Hildenbrand (Arm) <david@kernel.org>
    Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
mm/shrinker: do not hold RCU lock in shrinker_debugfs_count_show() [+ + +]
Author: Shakeel Butt <shakeel.butt@linux.dev>
Date:   Wed Jun 10 16:20:48 2026 -0700

    mm/shrinker: do not hold RCU lock in shrinker_debugfs_count_show()
    
    commit b902890c62d200b3509cb5e09cf1e0a66553c128 upstream.
    
    Reading the debugfs "count" file of a memcg-aware shrinker can sleep
    inside an RCU read-side critical section:
    
      BUG: sleeping function called from invalid context at kernel/cgroup/rstat.c:421
      RCU nest depth: 1, expected: 0
       css_rstat_flush
       mem_cgroup_flush_stats
       zswap_shrinker_count
       shrinker_debugfs_count_show
    
    shrinker_debugfs_count_show() invokes the ->count_objects() callback under
    rcu_read_lock().  The zswap callback flushes memcg stats via
    css_rstat_flush(), which may sleep, so it must not run under RCU.
    
    The RCU lock is not needed here.  mem_cgroup_iter() takes RCU internally
    and returns a memcg holding a css reference (dropped on the next iteration
    or by mem_cgroup_iter_break()), so the memcg stays alive without it.  The
    shrinker is kept alive by the open debugfs file: shrinker_free() removes
    the debugfs entries via debugfs_remove_recursive(), which waits for
    in-flight readers to drain, before call_rcu(..., shrinker_free_rcu_cb).
    The sibling "scan" handler already invokes the sleeping ->scan_objects()
    callback with no RCU section.
    
    Drop the rcu_read_lock()/rcu_read_unlock().
    
    Link: https://lore.kernel.org/20260610232048.62930-1-shakeel.butt@linux.dev
    Fixes: 5035ebc644ae ("mm: shrinkers: introduce debugfs interface for memory shrinkers")
    Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
    Reported-by: Zenghui Yu <zenghui.yu@linux.dev>
    Closes: https://lore.kernel.org/all/c052a064-cddb-494f-a0d8-f8a10b4b1c4d@linux.dev/
    Suggested-by: Nhat Pham <nphamcs@gmail.com>
    Reviewed-by: SeongJae Park <sj@kernel.org>
    Reviewed-by: Qi Zheng <qi.zheng@linux.dev>
    Tested-by: Zenghui Yu (Huawei) <zenghui.yu@linux.dev>
    Reviewed-by: Nhat Pham <nphamcs@gmail.com>
    Acked-by: Muchun Song <muchun.song@linux.dev>
    Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>
    Cc: Dave Chinner <david@fromorbit.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: do not limit zeroing to orig_size when only red zoning is enabled [+ + +]
Author: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Date:   Wed Jun 10 17:40:03 2026 +0200

    mm/slab: do not limit zeroing to orig_size when only red zoning is enabled
    
    commit 648927ceb84021a25a0fbd5673740956f318d534 upstream.
    
    When init (zeroing) on allocation is requested, for kmalloc() we
    generally have to zero the full object size even if a smaller size is
    requested, in order to provide krealloc()'s __GFP_ZERO guarantees.
    
    But if we track the requested size, krealloc() uses that information to
    do the right thing, so we can zero only the requested size. With red
    zoning also enabled, any extra size became part of the red zone, so it
    must not be zeroed and thus we must zero only the requested size.
    
    However the current check is imprecise, and will trigger also when only
    SLAB_RED_ZONE is enabled without SLAB_STORE_USER (which enables tracking
    the requested size). This means enabling red zoning alone can compromise
    krealloc()'s __GFP_ZERO contract.
    
    Fix this by using slub_debug_orig_size() instead, which is the exact
    check for whether the requested size is tracked. We don't need to care
    if red zoning is also enabled or not. Also update and expand the
    comment accordingly.
    
    Fixes: 9ce67395f5a0 ("mm/slub: only zero requested size of buffer for kzalloc when debug enabled")
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20260610-slab_alloc_flags-v2-1-7190909db118@kernel.org
    Reviewed-by: Harry Yoo (Oracle) <harry@kernel.org>
    Reviewed-by: Hao Li <hao.li@linux.dev>
    Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/swap: add cond_resched() in swap_reclaim_full_clusters to prevent softlockup [+ + +]
Author: Zijiang Huang <huangzjsmile@gmail.com>
Date:   Wed May 6 21:09:19 2026 +0800

    mm/swap: add cond_resched() in swap_reclaim_full_clusters to prevent softlockup
    
    commit 66366d291f666ddeda5f8c84f253e308de3e6b55 upstream.
    
    We hit a real softlockup in an internal stress test environment.  The
    workload was LTP memory/swap stress on a large arm64 machine, with 320
    CPUs, about 1TB memory and an 8.6GB swap device.  The system was under
    heavy load and the swap device had a large number of full clusters.  The
    softlockup was triggered during a stress test after about 3 days.
    
    So, add periodic cond_resched() calls during large full_clusters
    reclaim operations to prevent softlockup issues.
    
    Detailed call trace as follow:
    
    PID: 3817773  TASK: ffff0883bb28b780  CPU: 48   COMMAND: "kworker/48:7"
       #0 [ffff800080183d10] __crash_kexec at ffffa4c1361e5de4
       #1 [ffff800080183d90] panic at ffffa4c1360d5e9c
       #2 [ffff800080183e20] watchdog_timer_fn at ffffa4c136231fa8
       ...
      #16 [ffff8000c4ad3cb0] swap_cache_del_folio at ffffa4c1363e1614
      #17 [ffff8000c4ad3ce0] __try_to_reclaim_swap at ffffa4c1363e4bfc
      #18 [ffff8000c4ad3d40] swap_reclaim_full_clusters at ffffa4c1363e5474
      #19 [ffff8000c4ad3da0] swap_reclaim_work at ffffa4c1363e550c
      #20 [ffff8000c4ad3dc0] process_one_work at ffffa4c136102edc
      #21 [ffff8000c4ad3e10] worker_thread at ffffa4c136103398
      #22 [ffff8000c4ad3e70] kthread at ffffa4c13610d95c
    
    Link: https://lore.kernel.org/20260506130919.2298807-1-kerayhuang@tencent.com
    Fixes: 5168a68eb78f ("mm, swap: avoid over reclaim of full clusters")
    Signed-off-by: Zijiang Huang <kerayhuang@tencent.com>
    Reviewed-by: Kairui Song <kasong@tencent.com>
    Reviewed-by: Hao Peng <flyingpeng@tencent.com>
    Reviewed-by: albinwyang <albinwyang@tencent.com>
    Reviewed-by: Baoquan He <baoquan.he@linux.dev>
    Acked-by: Chris Li <chrisl@kernel.org>
    Cc: Barry Song <baohua@kernel.org>
    Cc: Kairui Song <kasong@tencent.com>
    Cc: Kemeng Shi <shikemeng@huaweicloud.com>
    Cc: Nhat Pham <nphamcs@gmail.com>
    Cc: Youngjun Park <youngjun.park@lge.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: do file ownership checks with the proper mount idmap [+ + +]
Author: Pedro Falcato <pfalcato@suse.de>
Date:   Thu Jun 25 16:38:53 2026 +0100

    mm: do file ownership checks with the proper mount idmap
    
    commit e187bc02f8fa4226d62814592cf064ee4557c470 upstream.
    
    Ever since idmapped mounts were introduced, inode ownership checks (for
    side-channel protection) in mincore() and madvise(MADV_PAGEOUT) were done
    against the nop_mnt_idmap, which completely ignores the file's mount's
    idmap.  This results in odd edgecases like:
    
    1) mount/bind-mount with an idmap userA:userB:1
    2) userB runs an owner_or_capable() check on file that is owned by userA
    on-disk/in-memory, but owned by userB after idmap translation
    3) owner_or_capable() mysteriously fails as the correct idmap wasn't supplied
    
    In the case of mincore/madvise MADV_PAGEOUT, this is usually benign,
    because file_permission(file, MAY_WRITE) will probably succeed, as it uses
    the proper idmap internally, but it does not need to be the case on e.g a
    0444 file where even the owner itself doesn't have permissions to write to
    it.
    
    Since this is clearly not trivial to get right, introduce a
    file_owner_or_capable() that can carry the correct semantics, and switch
    the various users in mm to it.
    
    The issue was found by manual code inspection & an off-list discussion
    with Jan Kara.
    
    Link: https://lore.kernel.org/20260625153853.913949-1-pfalcato@suse.de
    Fixes: 9caccd41541a ("fs: introduce MOUNT_ATTR_IDMAP")
    Signed-off-by: Pedro Falcato <pfalcato@suse.de>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Reviewed-by: Christian Brauner (Amutable) <brauner@kernel.org>
    Acked-by: David Hildenbrand (Arm) <david@kernel.org>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Jann Horn <jannh@google.com>
    Cc: Liam R. Howlett <liam@infradead.org>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.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: fix mmap errno value when MAP_DROPPABLE is not supported [+ + +]
Author: Anthony Yznaga <anthony.yznaga@oracle.com>
Date:   Wed Apr 15 20:39:37 2026 -0700

    mm: fix mmap errno value when MAP_DROPPABLE is not supported
    
    commit d86c9e971af2315119a78c564a802fafcebf1b6b upstream.
    
    Patch series "fix MAP_DROPPABLE not supported errno", v4.
    
    Mark Brown reported seeing a regression in -next on 32 bit arm with the
    mlock selftests.  Before exiting and marking the tests failed, the
    following message was logged after an attempt to create a MAP_DROPPABLE
    mapping:
    
    Bail out! mmap error: Unknown error 524
    
    It turns out error 524 is ENOTSUPP which is an error that userspace is not
    supposed to see, but it indicates in this instance that MAP_DROPPABLE is
    not supported.
    
    The first patch changes the errno returned to EOPNOTSUPP.  The second
    patch is a second version of a prior patch to introduce selftests to
    verify locking behavior with droppable mappings with the additional change
    to skip the tests when MAP_DROPPABLE is not supported.  The third patch
    fixes the MAP_DROPPABLE selftest so that it is run by the framework and
    skips if MAP_DROPPABLE is not supported.
    
    
    This patch (of 3):
    
    On configs where MAP_DROPPABLE is not supported (currently any 32-bit
    config except for PPC32), mmap fails with errno set to ENOTSUPP.  However,
    ENOTSUPP is not a standard error value that userspace knows about.  The
    acceptable userspace-visible errno to use is EOPNOTSUPP.  checkpatch.pl
    has a warning to this effect.
    
    Link: https://lore.kernel.org/20260416033939.49981-1-anthony.yznaga@oracle.com
    Link: https://lore.kernel.org/20260416033939.49981-2-anthony.yznaga@oracle.com
    Fixes: 9651fcedf7b9 ("mm: add MAP_DROPPABLE for designating always lazily freeable mappings")
    Signed-off-by: Anthony Yznaga <anthony.yznaga@oracle.com>
    Acked-by: David Hildenbrand (Arm) <david@kernel.org>
    Acked-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
    Reported-by: Mark Brown <broonie@kernel.org>
    Reviewed-by: Pedro Falcato <pfalcato@suse.de>
    Reviewed-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
    Cc: Jann Horn <jannh@google.com>
    Cc: Jason A. Donenfeld <jason@zx2c4.com>
    Cc: Liam 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: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mm: page_ext: add count limit to page_ext_iter_next to prevent invalid PFN access [+ + +]
Author: Ketan <ketan.kishore@oss.qualcomm.com>
Date:   Tue Jun 23 02:48:04 2026 +0530

    mm: page_ext: add count limit to page_ext_iter_next to prevent invalid PFN access
    
    commit ffd017237cfe99e6e5602ab14179b0e6878a0840 upstream.
    
    The page_ext iteration API does not validate if the PFN still belongs to a
    valid section while advancing the iterator.  When dynamically adding
    memory in the hotplug path, it can lead to a NULL pointer dereference
    during page_ext_lookup at the boundary of the last valid section when
    iterator count equals __pgcount.
    
    The for_each_page_ext() macro calls page_ext_iter_next() as its loop
    increment.  for_each_page_ext() does a "__page_ext =
    page_ext_iter_next(&__iter)" at the end.  This causes page_ext_iter_next()
    to increment iter->index past __pgcount and call page_ext_lookup(start_pfn
    + __pgcount).  During memory hotplug (online), the PFN at start_pfn +
    __pgcount may belong to a section that has not yet been initialized,
    causing page_ext_lookup() to trigger a NULL pointer dereference.
    
    [   14.555124][  T846] Call trace:
    [   14.555125][  T846]  lookup_page_ext+0x6c/0x108 (P)
    [   14.555127][  T846]  page_ext_lookup+0x30/0x3c
    [   14.555129][  T846]  __reset_page_owner+0x11c/0x260
    [   14.571201][  T846]  __free_pages_ok+0x5e8/0x8e0
    [   14.571204][  T846]  __free_pages_core+0x78/0xf0
    [   14.571206][  T846]  generic_online_page+0x14/0x24
    [   14.597782][  T846]  online_pages+0x178/0x30c
    [   14.597784][  T846]  memory_block_change_state+0x284/0x32c
    [   14.597787][  T846]  memory_subsys_online+0x4c/0x64
    [   14.597789][  T846]  device_online+0x88/0xb0
    [   14.597791][  T846]  online_memory_block+0x30/0x40
    [   14.597793][  T846]  walk_memory_blocks+0xac/0xe8
    [   14.597794][  T846]  add_memory_resource+0x280/0x298
    [   14.656161][  T846]  add_memory+0x60/0x98
    
    Move the iteration boundary enforcement inside the iterator functions, so
    callers cannot inadvertently access beyond the requested range.
    
    Link: https://lore.kernel.org/20260623-page_ext-v3-1-a89799a5367c@oss.qualcomm.com
    Fixes: 9039b9096ea2 ("mm: page_ext: add an iteration API for page extensions")
    Signed-off-by: Ketan Kishore <ketan.kishore@oss.qualcomm.com>
    Suggested-by: David Hildenbrand <david@redhat.com>
    Suggested-by: Matthew Wilcox <willy@infradead.org>
    Acked-by: Zi Yan <ziy@nvidia.com>
    Acked-by: David Hildenbrand (Arm) <david@kernel.org>
    Cc: Brendan Jackman <jackmanb@google.com>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Liam R. Howlett <liam@infradead.org>
    Cc: Lorenzo Stoakes <ljs@kernel.org>
    Cc: Luiz Capitulino <luizcap@redhat.com>
    Cc: Michal Hocko <mhocko@suse.com>
    Cc: Mike Rapoport <rppt@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>

mm: shrinker: fix NULL pointer dereference in debugfs [+ + +]
Author: Qi Zheng <qi.zheng@linux.dev>
Date:   Wed Jun 17 17:00:52 2026 +0800

    mm: shrinker: fix NULL pointer dereference in debugfs
    
    commit e30453c61e185e914fde83c650e268067b140218 upstream.
    
    shrinker_debugfs_add() creates both "count" and "scan" debugfs files
    unconditionally.
    
    That assumes every shrinker implements both count_objects() and
    scan_objects(), which is not guaranteed.  For example, the xen-backend
    shrinker sets count_objects() but leaves scan_objects() NULL, so writing
    to its scan file calls through a NULL function pointer and panics the
    kernel:
    
    BUG: kernel NULL pointer dereference, address: 0000000000000000
    RIP: 0010:0x0
    Code: Unable to access opcode bytes at 0xffffffffffffffd6.
    Call Trace:
     <TASK>
     shrinker_debugfs_scan_write+0x12e/0x270
     full_proxy_write+0x5f/0x90
     vfs_write+0xde/0x420
     ? filp_flush+0x75/0x90
     ? filp_close+0x1d/0x30
     ? do_dup2+0xb8/0x120
     ksys_write+0x68/0xf0
     ? filp_flush+0x75/0x90
     do_syscall_64+0xb3/0x5b0
     entry_SYSCALL_64_after_hwframe+0x76/0x7e
    
    The count path has the same issue in principle if a shrinker omits
    count_objects().
    
    To fix it, only create "count" and "scan" debugfs files when the
    corresponding callbacks are present.
    
    Link: https://lore.kernel.org/20260617090052.27325-1-qi.zheng@linux.dev
    Fixes: bbf535fd6f06 ("mm: shrinkers: add scan interface for shrinker debugfs")
    Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
    Reviewed-by: Muchun Song <muchun.song@linux.dev>
    Cc: Dave Chinner <david@fromorbit.com>
    Cc: Qi Zheng <zhengqi.arch@bytedance.com>
    Cc: Roman Gushchin <roman.gushchin@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: shrinker: fix shrinker_info teardown race with expansion [+ + +]
Author: Qi Zheng <qi.zheng@linux.dev>
Date:   Wed Jun 17 16:56:58 2026 +0800

    mm: shrinker: fix shrinker_info teardown race with expansion
    
    commit 65476d31d8056e859c48580f82295ce159196ffe upstream.
    
    expand_shrinker_info() iterates all visible memcgs under shrinker_mutex,
    including memcgs that have not finished ->css_online() yet.
    
    Once pn->shrinker_info has been published, teardown must stay serialized
    with expand_shrinker_info() until that memcg is either fully online or no
    longer visible to iteration.  Today alloc_shrinker_info() breaks that rule
    by dropping shrinker_mutex before freeing a partially initialized
    shrinker_info array, which may cause the following race:
    
    CPU0                   CPU1
    ====                   ====
    
    css_create
    --> list_add_tail_rcu(&css->sibling, &parent_css->children);
        online_css
        --> mem_cgroup_css_online
            --> alloc_shrinker_info
                --> alloc node0 info
                    rcu_assign_pointer(C->node0->shrinker_info, old0)
                    alloc node1 info -> FAIL -> goto err
                    mutex_unlock(shrinker_mutex)
    
                           shrinker_alloc()
                           --> shrinker_memcg_alloc
                               --> mutex_lock(shrinker_mutex)
                                   expand_shrinker_info
                                   --> mem_cgroup_iter see the memcg
                                       expand_one_shrinker_info
                                       --> old0 = C->node0->shrinker_info
                                           memcpy(new->unit, old0->unit, ...);
    
                    free_shrinker_info
                    --> kvfree(old0);
    
                                           /* double free !! */
                                           kvfree_rcu(old0, rcu);
    
    The same problem exists later in mem_cgroup_css_online().  If
    alloc_shrinker_info() succeeds but a subsequent objcg allocation fails,
    the free_objcg -> free_shrinker_info() unwind path tears down the already
    published pn->shrinker_info arrays without shrinker_mutex.  The
    expand_one_shrinker_info() can race with that teardown in the same way,
    leading to use-after-free or double-free of the old shrinker_info.
    
    Fix this by serializing shrinker_info teardown with shrinker_mutex, and by
    keeping alloc_shrinker_info() error cleanup inside the locked section.
    
    Link: https://lore.kernel.org/20260617085658.27096-1-qi.zheng@linux.dev
    Fixes: 307bececcd12 ("mm: shrinker: add a secondary array for shrinker_info::{map, nr_deferred}")
    Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
    Acked-by: Muchun Song <muchun.song@linux.dev>
    Cc: Dave Chinner <david@fromorbit.com>
    Cc: Qi Zheng <zhengqi.arch@bytedance.com>
    Cc: Roman Gushchin <roman.gushchin@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: swap_cgroup: fix NULL deref in lookup_swap_cgroup_id on swapless host [+ + +]
Author: Jose Fernandez (Anthropic) <jose.fernandez@linux.dev>
Date:   Mon May 4 12:55:17 2026 +0000

    mm: swap_cgroup: fix NULL deref in lookup_swap_cgroup_id on swapless host
    
    commit 63b02a9409cb5180398491b093e48bcb5315f5fb upstream.
    
    lookup_swap_cgroup_id() passes swap_cgroup_ctrl[type].map to
    __swap_cgroup_id_lookup() without checking that the type was ever
    registered via swap_cgroup_swapon().  On a swapless host every ctrl->map
    is NULL, so __swap_cgroup_id_lookup() dereferences NULL + a scaled
    swp_offset().
    
    Since commit bea67dcc5eea ("mm: attempt to batch free swap entries for
    zap_pte_range()"), zap_pte_range() -> swap_pte_batch() calls
    lookup_swap_cgroup_id() on any non-present, non-none PTE that decodes as a
    real swap entry, without first validating it against swap_info[].  A
    single PTE corrupted into a type-0 swap entry takes the host down at
    process exit.
    
    We hit this in production on a swapless 6.12.58 host: ~1s of
    "get_swap_device: Bad swap file entry 3f800204222bb" (do_swap_page() being
    correctly defensive about the same entry) followed by
    
      BUG: unable to handle page fault for address: 000003f800204220
      RIP: 0010:lookup_swap_cgroup_id+0x2b/0x60
      Call Trace:
       swap_pte_batch+0xbf/0x230
       zap_pte_range+0x4c8/0x780
       unmap_page_range+0x190/0x3e0
       exit_mmap+0xd9/0x3c0
       do_exit+0x20c/0x4b0
    
    syzbot has reported the identical stack.
    
    The source of the PTE corruption is a separate bug; this change makes the
    teardown path as robust as the fault path already is.  Every other caller
    of lookup_swap_cgroup_id() is downstream of a get_swap_device() that has
    already validated the entry, so the new branch is cold.
    
    Link: https://lore.kernel.org/20260504-swap-cgroup-fix-7-0-v1-1-f53ff41ee553@linux.dev
    Fixes: bea67dcc5eea ("mm: attempt to batch free swap entries for zap_pte_range()")
    Signed-off-by: Jose Fernandez (Anthropic) <jose.fernandez@linux.dev>
    Reported-by: syzbot+e12bd9ca48157add237a@syzkaller.appspotmail.com
    Link: https://lore.kernel.org/r/69859728.050a0220.3b3015.0033.GAE@google.com
    Assisted-by: Claude:unspecified
    Cc: Barry Song <baohua@kernel.org>
    Cc: David Hildenbrand <david@kernel.org>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Kairui Song <ryncsn@gmail.com>
    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>

 
module: decompress: check return value of module_extend_max_pages() [+ + +]
Author: Andrii Kuchmenko <capyenglishlite@gmail.com>
Date:   Mon May 18 17:32:33 2026 +0300

    module: decompress: check return value of module_extend_max_pages()
    
    commit 786d2d84416a9a1c1a47b71a68d679d886284be2 upstream.
    
    module_extend_max_pages() calls kvrealloc() internally and returns
    -ENOMEM on allocation failure. The return value is never checked.
    
    If the initial allocation fails, info->pages remains NULL and
    info->max_pages remains 0. Subsequent calls to module_get_next_page()
    will attempt to dynamically grow the array by calling
    module_extend_max_pages(info, 0) since info->used_pages is 0. This
    results in kvrealloc(NULL, 0) returning ZERO_SIZE_PTR, which is treated
    as a success, leading to a dereference of ZERO_SIZE_PTR and a kernel
    oops.
    
    Fix: add the missing error check after module_extend_max_pages() and
    return immediately on failure. This matches the pattern used by every
    other kvrealloc() caller in the module loading path.
    
    Fixes: b1ae6dc41eaa ("module: add in-kernel support for decompressing")
    Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Cc: Luis Chamberlain <mcgrof@kernel.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Andrii Kuchmenko <capyenglishlite@gmail.com>
    Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
    [Sami: Corrected the analysis in the commit message.]
    Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
net/sched: dualpi2: fix GSO backlog accounting [+ + +]
Author: Xingquan Liu <b1n@b1n.io>
Date:   Fri Jun 19 11:13:47 2026 -0400

    net/sched: dualpi2: fix GSO backlog accounting
    
    commit 05ed733b65ab977dd931e7f7ac0f62fdb81205c2 upstream.
    
    When DualPI2 splits a GSO skb into N segments, it propagates N
    additional packets to its parent before returning NET_XMIT_SUCCESS.
    The parent then accounts for the original skb once more, leaving its
    qlen one larger than the number of packets actually queued.
    
    With QFQ as the parent, after all real packets are dequeued, QFQ still
    has a non-zero qlen while its in-service aggregate has no active
    classes. qfq_choose_next_agg() returns NULL and qfq_dequeue() passes
    the result to qfq_peek_skb(), causing a NULL pointer dereference.
    
    Follow the same pattern used by tbf_segment() and taprio: count only
    successfully queued segments, propagate the difference between the
    original skb and those segments, and return NET_XMIT_SUCCESS whenever
    at least one segment was queued.
    
    Fixes: 8f9516daedd6 ("sched: Add enqueue/dequeue of dualpi2 qdisc")
    Cc: stable@vger.kernel.org
    Signed-off-by: Xingquan Liu <b1n@b1n.io>
    Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
    Reviewed-by: Victor Nogueira <victor@mojatatu.com>
    Link: https://patch.msgid.link/20260619151447.223640-1-b1n@b1n.io
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
net: af_key: initialize alg_key_len for IPComp states [+ + +]
Author: Zijing Yin <yzjaurora@gmail.com>
Date:   Mon Jun 8 07:44:41 2026 -0700

    net: af_key: initialize alg_key_len for IPComp states
    
    commit d129c3177d7b1138fd5066fcc63a698b3ba415b0 upstream.
    
    pfkey_msg2xfrm_state() handles the IPComp (SADB_X_SATYPE_IPCOMP) case by
    allocating x->calg and copying only the algorithm name:
    
            x->calg = kmalloc_obj(*x->calg);
            if (!x->calg) {
                    err = -ENOMEM;
                    goto out;
            }
            strcpy(x->calg->alg_name, a->name);
            x->props.calgo = sa->sadb_sa_encrypt;
    
    Unlike the authentication (x->aalg) and encryption (x->ealg) branches of
    the same function, the compression branch never initializes
    calg->alg_key_len.  IPComp carries no key and the allocation only
    reserves sizeof(struct xfrm_algo) (i.e. no room for a key), so the field
    is left containing uninitialized slab data.
    
    calg->alg_key_len is later used as a length by xfrm_algo_clone() when an
    IPComp state is cloned during XFRM_MSG_MIGRATE:
    
            xfrm_state_migrate()
              xfrm_state_clone_and_setup()
                x->calg = xfrm_algo_clone(orig->calg);
                  kmemdup(orig, xfrm_alg_len(orig));
    
    where xfrm_alg_len() returns sizeof(*alg) + (alg_key_len + 7) / 8.  With
    a non-zero garbage alg_key_len, kmemdup() reads past the end of the
    68-byte calg object.  Adding an IPComp SA via PF_KEY and then migrating
    it triggers (net-next, KASAN, init_on_alloc=0):
    
      BUG: KASAN: slab-out-of-bounds in kmemdup_noprof+0x44/0x60
      Read of size 4164 at addr ff11000025a74980 by task diag2/9287
      CPU: 3 UID: 0 PID: 9287 Comm: diag2 7.1.0-rc6-g903db046d557 #1
      Call Trace:
       <TASK>
       dump_stack_lvl+0x10e/0x1f0
       print_report+0xf7/0x600
       kasan_report+0xe4/0x120
       kasan_check_range+0x105/0x1b0
       __asan_memcpy+0x23/0x60
       kmemdup_noprof+0x44/0x60
       xfrm_state_migrate+0x70a/0x1da0
       xfrm_migrate+0x753/0x18a0
       xfrm_do_migrate+0xb47/0xf10
       xfrm_user_rcv_msg+0x411/0xb50
       netlink_rcv_skb+0x158/0x420
       xfrm_netlink_rcv+0x71/0x90
       netlink_unicast+0x584/0x850
       netlink_sendmsg+0x8b0/0xdc0
       ____sys_sendmsg+0x9f7/0xb90
       ___sys_sendmsg+0x134/0x1d0
       __sys_sendmsg+0x16d/0x220
       do_syscall_64+0x116/0x7d0
       entry_SYSCALL_64_after_hwframe+0x77/0x7f
       </TASK>
    
      Allocated by task 9287:
       kasan_save_stack+0x33/0x60
       kasan_save_track+0x14/0x30
       __kasan_kmalloc+0xaa/0xb0
       pfkey_add+0x2652/0x2ea0
       pfkey_process+0x6d0/0x830
       pfkey_sendmsg+0x42c/0x850
       __sys_sendto+0x461/0x4b0
       __x64_sys_sendto+0xe0/0x1c0
       do_syscall_64+0x116/0x7d0
       entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
      The buggy address belongs to the object at ff11000025a74980
       which belongs to the cache kmalloc-96 of size 96
      The buggy address is located 0 bytes inside of
       allocated 68-byte region [ff11000025a74980, ff11000025a749c4)
    
    Depending on the uninitialized value the same field can instead request
    an oversized kmemdup() allocation and make the migration clone fail.
    
    The XFRM netlink path is not affected: verify_one_alg() rejects an
    XFRMA_ALG_COMP attribute shorter than xfrm_alg_len(), so a calg added via
    XFRM_MSG_NEWSA is always self-consistent.
    
    Initialize calg->alg_key_len to 0, matching the aalg/ealg branches.
    
    Fixes: 80c9abaabf42 ("[XFRM]: Extension for dynamic update of endpoint address(es)")
    Cc: stable@vger.kernel.org
    Signed-off-by: Zijing Yin <yzjaurora@gmail.com>
    Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: ipv4: bound TCP reordering sysctl writes and MTU probe sizes [+ + +]
Author: Wyatt Feng <bronzed_45_vested@icloud.com>
Date:   Mon Jun 15 18:31:18 2026 +0800

    net: ipv4: bound TCP reordering sysctl writes and MTU probe sizes
    
    commit efb8763d7bbb40cff4cc55a6b62c3095a038149c upstream.
    
    Reject invalid `net.ipv4.tcp_reordering` values before they reach TCP
    socket state. The sysctl is stored as an `int` but copied into the
    `u32` `tp->reordering` field for new sockets, so negative writes wrap
    to large values.
    
    With `tcp_mtu_probing=2`, the wrapped value can overflow the
    `tcp_mtu_probe()` size calculation and drive the MTU probing path into
    an out-of-bounds read. Route `tcp_reordering` writes through
    `proc_dointvec_minmax()` and require it to be at least 1. Also require
    `tcp_max_reordering` to be at least 1 so the configured maximum cannot
    become negative either.
    
    When registering the table for a non-init network namespace, relocate
    `extra2` pointers that refer into `init_net.ipv4` so the
    `tcp_reordering` upper bound follows that namespace's
    `tcp_max_reordering`.
    
    Harden `tcp_mtu_probe()` itself by computing `size_needed` as `u64`.
    This keeps the send queue and window checks from being bypassed through
    signed integer overflow.
    
    Fixes: 91cc17c0e5e5 ("[TCP]: MTUprobe: receiver window & data available checks fixed")
    Cc: stable@vger.kernel.org
    Reported-by: Yuan Tan <yuantan098@gmail.com>
    Reported-by: Zhengchuan Liang <zcliangcn@gmail.com>
    Reported-by: Xin Liu <bird@lzu.edu.cn>
    Suggested-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: Wyatt Feng <bronzed_45_vested@icloud.com>
    Signed-off-by: Ren Wei <n05ec@lzu.edu.cn>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Link: https://patch.msgid.link/1a5b7e1ef4d70fbad8c8ee0b82d8405f3c964a3d.1781395200.git.bronzed_45_vested@icloud.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: usb: kalmia: bound RX frame length in kalmia_rx_fixup() [+ + +]
Author: Maoyi Xie <maoyixie.tju@gmail.com>
Date:   Mon Jun 22 16:01:57 2026 +0800

    net: usb: kalmia: bound RX frame length in kalmia_rx_fixup()
    
    commit 47b6bcef6e679593d2e86e04ee72c46a4e2f7139 upstream.
    
    kalmia_rx_fixup() computes usb_packet_length = skb->len - (2 *
    KALMIA_HEADER_LENGTH) as a u16, guarded only by a pre-loop check that
    skb->len is at least KALMIA_HEADER_LENGTH, which is 6. A device can
    deliver a short bulk-IN frame with skb->len in the 6 to 11 range, or
    leave a short trailing remainder on a later loop iteration. Either case
    underflows usb_packet_length to about 65530.
    
    That bypasses the usb_packet_length < ether_packet_length truncation path.
    The device-supplied ether_packet_length, a le16 up to 65535 read from
    header_start[2], then drives a memcmp() and the following skb_trim() and
    skb_pull() past the end of the rx buffer. The rx buffer is hard_mtu * 10,
    which is 14000 bytes. That is an out of bounds read.
    
    Require both the start and end framing headers to be present before
    subtracting them, on every loop iteration.
    
    Fixes: d40261236e8e ("net/usb: Add Samsung Kalmia driver for Samsung GT-B3730")
    Cc: stable@vger.kernel.org
    Signed-off-by: Maoyi Xie <maoyixie.tju@gmail.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Link: https://patch.msgid.link/178211531778.2216480.12637613349790980750@maoyixie.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
netfilter: ctnetlink: use nf_ct_exp_net() in expectation dump [+ + +]
Author: Pratham Gupta <pratham36gupta@gmail.com>
Date:   Mon May 4 22:11:57 2026 -0700

    netfilter: ctnetlink: use nf_ct_exp_net() in expectation dump
    
    commit a7f57320bbbc67e347bf5fff4b4a9bab980d5956 upstream.
    
    Commit 02a3231b6d82 ("netfilter: nf_conntrack_expect: store netns and zone in expectation")
    introduced exp->net so RCU-only expectation paths no longer need to
    dereference exp->master for netns lookups.
    
    Commit 3db5647984de ("netfilter: nf_conntrack_expect: skip expectations in other netns via proc")
    updated the proc path accordingly, but ctnetlink_exp_dump_table() still
    compares against nf_ct_net(exp->master).
    
    Use nf_ct_exp_net(exp) here as well so the netlink dump path matches
    the rest of the March 2026 expectation netns/RCU cleanup.
    
    Fixes: 02a3231b6d82 ("netfilter: nf_conntrack_expect: store netns and zone in expectation")
    Cc: stable@vger.kernel.org
    Signed-off-by: Pratham Gupta <pratham36gupta@gmail.com>
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

netfilter: ebtables: module names must be null-terminated [+ + +]
Author: Florian Westphal <fw@strlen.de>
Date:   Sat Jul 4 12:05:15 2026 +0200

    netfilter: ebtables: module names must be null-terminated
    
    commit 084d23f818321390509e9738a0b08bbf46df6425 upstream.
    
    We need to explicitly check the length, else we may pass non-null
    terminated string to request_module().
    
    Cc: stable@vger.kernel.org
    Fixes: bcf493428840 ("netfilter: ebtables: Fix extension lookup with identical name")
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

netfilter: ebtables: terminate table name before find_table_lock() [+ + +]
Author: Xiang Mei <xmei5@asu.edu>
Date:   Sun Jul 5 14:58:00 2026 -0700

    netfilter: ebtables: terminate table name before find_table_lock()
    
    commit a622d2e9608c9dff47fc2e5759ac7aa3a836b45d upstream.
    
    update_counters() and compat_update_counters() forward a user-supplied
    32-byte table name to find_table_lock() without NUL-terminating it. On a
    lookup miss, find_inlist_lock() calls try_then_request_module(..., "%s%s",
    "ebtable_", name), and vsnprintf() reads past the name field and the
    stack object until it hits a zero byte.
    
      BUG: KASAN: stack-out-of-bounds in string (lib/vsprintf.c:648 lib/vsprintf.c:730)
      Read of size 1 at addr ffff8880119dfb20 by task exploit/147
      Call Trace:
      ...
       string (lib/vsprintf.c:648 lib/vsprintf.c:730)
       vsnprintf (lib/vsprintf.c:2945)
       __request_module (kernel/module/kmod.c:150)
       do_update_counters.isra.0 (net/bridge/netfilter/ebtables.c:371 net/bridge/netfilter/ebtables.c:380)
       update_counters (net/bridge/netfilter/ebtables.c:1440)
       do_ebt_set_ctl (net/bridge/netfilter/ebtables.c:2573)
       nf_setsockopt (net/netfilter/nf_sockopt.c:101)
       ip_setsockopt (net/ipv4/ip_sockglue.c:1424)
       raw_setsockopt (net/ipv4/raw.c:847)
       __sys_setsockopt (net/socket.c:2393)
      ...
    
    compat_do_replace() shares the same unterminated name via
    compat_copy_ebt_replace_from_user(); terminate it there too so all
    find_table_lock() callers behave alike. The other callers already
    terminate the name after the copy.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Fixes: 81e675c227ec ("netfilter: ebtables: add CONFIG_COMPAT support")
    Cc: stable@vger.kernel.org
    Reported-by: Weiming Shi <bestswngs@gmail.com>
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: Xiang Mei <xmei5@asu.edu>
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

netfilter: ebtables: zero chainstack array [+ + +]
Author: Florian Westphal <fw@strlen.de>
Date:   Sat Jul 4 10:23:31 2026 +0200

    netfilter: ebtables: zero chainstack array
    
    commit cbfe53599eebffd188938ab6774cc41794f6f9d5 upstream.
    
    sashiko reports:
     looking at ebtables table
     translation, could a sparse cpu_possible_mask lead to an uninitialized pointer
     free?
    
     If cpu_possible_mask is sparse (for example, CPU 0 and CPU 2 are possible,
     but CPU 1 is not), the allocation loop skips CPU 1. If vmalloc_node() fails at
     CPU 2, the cleanup loop will blindly decrement and call vfree() on
     newinfo->chainstack[1].
    
    Not a real-world bug, such allocation isn't expected to fail
    in the first place.
    
    Cc: stable@vger.kernel.org
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

netfilter: flowtable: fix offloaded ct timeout never being extended [+ + +]
Author: Adrian Bente <adibente@gmail.com>
Date:   Thu May 28 10:08:51 2026 +0300

    netfilter: flowtable: fix offloaded ct timeout never being extended
    
    commit 53b3e60edb674b442b2b3bbdba484667b0f47a5d upstream.
    
    OpenWrt has recently migrated many platforms to kernel 6.18. On the
    MediaTek platform, which supports hardware network offloading, WiFi
    connections accelerated via the WED path were observed to drop after
    roughly 300 seconds.
    
    After several debugging sessions, assisted by the Claude LLM, the
    problem was narrowed down as follows:
    
    nf_flow_table_extend_ct_timeout() extends ct->timeout for offloaded
    flows using:
    
            cmpxchg(&ct->timeout, expires, new_timeout);
    
    'expires' comes from nf_ct_expires(ct) and is a relative value, while
    ct->timeout holds an absolute timestamp. The two are never equal, so
    the cmpxchg always fails and the timeout is never extended.
    
    This goes unnoticed for most flows, but a long-lived hardware (WED)
    offloaded flow on MediaTek MT7986 eventually has ct->timeout decay to
    zero, the conntrack entry is reaped and the connection breaks.
    
    Open-code the relative value from a single READ_ONCE(ct->timeout)
    snapshot and compare against that same absolute snapshot in the
    cmpxchg, so the timeout extension actually takes effect while the
    datapath remains authoritative if it updates ct->timeout concurrently.
    
    Fixes: 03428ca5cee9 ("netfilter: conntrack: rework offload nf_conn timeout extension logic")
    Cc: stable@vger.kernel.org
    Suggested-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Adrian Bente <adibente@gmail.com>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

netfilter: flowtable: IPIP tunnel hardware offload is not yet support [+ + +]
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date:   Tue Jun 30 11:40:55 2026 +0200

    netfilter: flowtable: IPIP tunnel hardware offload is not yet support
    
    commit 6c5dcab95f4cd42a1648739ec9300fbb4b1a021f upstream.
    
    No driver supports for IPIP tunnels yet, give up early on setting up the
    hardware offload for this scenario.
    
    This patch adds a stub that can be enhanced to add more configuration
    that are currently not supported. As of now, the offload work is
    enqueued to the worker, then ignored if the hardware offload
    configuration is not supported.
    
    Check the NF_FLOW_HW flag to know if this entry was already tried once
    to be offloaded so this is not retried on refresh when unsupported. Move
    NF_FLOW_HW flag check to nf_flow_offload_add(). If this NF_FLOW_HW flag
    is unset the _del and _stats variants are never called.
    
    This can be updated later on to skip hardware offload work to be queued
    in case hardware offload does not support it.
    
    Fixes: d98103575dcd ("netfilter: flowtable: Add IP6IP6 rx sw acceleration")
    Fixes: ab427db17885 ("netfilter: flowtable: Add IPIP rx sw acceleration")
    Cc: stable@vger.kernel.org
    Reported-by: Yuan Tan <yuantan098@gmail.com>
    Reported-by: Xin Liu <bird@lzu.edu.cn>
    Reported-by: Zhengyang Chen <chzhengyang2023@lzu.edu.cn>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

netfilter: handle unreadable frags [+ + +]
Author: Florian Westphal <fw@strlen.de>
Date:   Sun Jul 5 15:29:13 2026 +0200

    netfilter: handle unreadable frags
    
    commit da5b58478a9c1b85608c9e40a3b8432d071b409e upstream.
    
    sashiko reports:
     When an skb with unreadable fragments (such as from devmem TCP, where
     skb_frags_readable(skb) returns false) is processed by the u32 module,
     skb_copy_bits() will safely return a negative error code [..]
    
    xt_u32: bail out with hotdrop in this case.
    gather_frags: return -1, just as if we had no fragment header.
    nfnetlink_queue: restrict to the linear part.
    nfnetlink_log: restrict to the linear part.
    
    v2:
     - skb_zerocopy helpers don't copy readable flag, i.e. nfnetlink_queue
     is broken too
     xt_u32 shouldn't return true if hotdrop was set.
    
    Fixes: 65249feb6b3d ("net: add support for skbs with unreadable frags")
    Cc: stable@vger.kernel.org
    Acked-by: Mina Almasry <almasrymina@google.com>
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

netfilter: ipset: fix race between dump and ip_set_list resize [+ + +]
Author: Xiang Mei <xmei5@asu.edu>
Date:   Wed Jun 24 18:00:06 2026 -0700

    netfilter: ipset: fix race between dump and ip_set_list resize
    
    commit 7cd9103283b26b917360ec99d7d2f2d761bcf1ab upstream.
    
    The release path of ip_set_dump_do() and ip_set_dump_done() read
    inst->ip_set_list via ip_set_ref_netlink(), a plain rcu_dereference_raw()
    of the array pointer. These run from netlink_recvmsg() without the nfnl
    mutex and without an RCU read-side critical section.
    
    A concurrent ip_set_create() can grow the array: it publishes the new
    array, calls synchronize_net() and then kvfree()s the old one. Since the
    dump paths read the array outside any RCU reader, synchronize_net() does
    not wait for them and the old array can be freed while they still index
    into it, causing a use-after-free.
    
    The dumped set itself stays pinned via set->ref_netlink, so only the
    array load needs protecting. Take rcu_read_lock() around it, matching
    ip_set_get_byname() and __ip_set_put_byindex().
    
      BUG: KASAN: slab-use-after-free in ip_set_dump_do (net/netfilter/ipset/ip_set_core.c:1697)
      Read of size 8 at addr ffff88800b5c4018 by task exploit/150
      Call Trace:
       ...
       kasan_report (mm/kasan/report.c:595)
       ip_set_dump_do (net/netfilter/ipset/ip_set_core.c:1697)
       netlink_dump (net/netlink/af_netlink.c:2325)
       netlink_recvmsg (net/netlink/af_netlink.c:1976)
       sock_recvmsg (net/socket.c:1159)
       __sys_recvfrom (net/socket.c:2315)
       ...
      Oops: general protection fault, probably for non-canonical address ... KASAN NOPTI
      KASAN: maybe wild-memory-access in range [0x02d6...d0-0x02d6...d7]
      RIP: 0010:ip_set_dump_do (net/netfilter/ipset/ip_set_core.c:1698)
      Kernel panic - not syncing: Fatal exception
    
    Fixes: 8a02bdd50b2e ("netfilter: ipset: Fix calling ip_set() macro at dumping")
    Cc: stable@vger.kernel.org
    Reported-by: Weiming Shi <bestswngs@gmail.com>
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: Xiang Mei <xmei5@asu.edu>
    Acked-by: Jozsef Kadlecsik <kadlec@netfilter.org>
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
netpoll: fix a use-after-free on shutdown path [+ + +]
Author: Breno Leitao <leitao@debian.org>
Date:   Thu Jun 25 05:03:18 2026 -0700

    netpoll: fix a use-after-free on shutdown path
    
    commit 45f1458a85017a023f138b22ac5c76abd477db42 upstream.
    
    There is a use-after-free error on netpoll, which is clearly detected by
    KASAN.
    
          BUG: KASAN: slab-use-after-free in _raw_spin_lock_irqsave+0x3b/0x80
          Read of size 1 at addr ... by task kworker/9:1
          Workqueue: events queue_process
          Call Trace:
           skb_dequeue+0x1e/0xb0
           queue_process+0x2c/0x600
           process_scheduled_works+0x4b6/0x850
           worker_thread+0x414/0x5a0
          Allocated by task 242:
           __netpoll_setup+0x201/0x4a0
           netpoll_setup+0x249/0x550
           enabled_store+0x32f/0x380
          Freed by task 0:
           kfree+0x1b7/0x540
           rcu_core+0x3f8/0x7a0
    
    The problem happens when there is a pending TX worker running in
    parallel with the cleanup path.
    
    This is what happens on netpoll shutdown path:
    
    1) __netpoll_cleanup() is called
    2) set dev->npinfo to NULL
    3) call_rcu() with rcu_cleanup_netpoll_info()
      3.1) rcu_cleanup_netpoll_info() tries to cancel all workers with
           cancel_delayed_work(), but doesn't wait for the worker to finish
    4) and kfree(npinfo);
    
    Because 3.1) doesn't really cancel the work, as the comment says "we
    can't call cancel_delayed_work_sync here, as we are in softirq", the TX
    worker can run after 4).
    
    Tl;DR: queue_process() is not an RCU reader, it reaches npinfo through
    the work item via container_of().
    
    Use disable_delayed_work_sync() to ensure the worker is completely
    stopped and prevent any future re-arming attempts. Once npinfo is set
    to NULL, senders will bail out and not queue new work. The disable flag
    ensures any in-flight re-arming attempts also fail silently.
    
    In the future, we can do the cleanup inline here without needing the
    npinfo->rcu rcu_head, but that is net-next material.
    
    Cc: stable@vger.kernel.org
    Fixes: 38e6bc185d95 ("netpoll: make __netpoll_cleanup non-block")
    Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
    Signed-off-by: Breno Leitao <leitao@debian.org>
    Link: https://patch.msgid.link/20260625-netpoll_rcu_fix-v2-1-0748ffac1e98@debian.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
NFSv4: include MAY_WRITE in open permission mask for O_TRUNC [+ + +]
Author: Benjamin Coddington <ben.coddington@hammerspace.com>
Date:   Thu Jun 11 17:02:15 2026 -0400

    NFSv4: include MAY_WRITE in open permission mask for O_TRUNC
    
    commit 5140f099ecd8a2f2808b7f7b720ee1bad8468974 upstream.
    
    POSIX requires write permission to truncate a file, so an open() that
    specifies O_TRUNC must be authorized for write access regardless of the
    O_ACCMODE access mode.
    
    nfs_open_permission_mask() builds the access mask passed to
    nfs_may_open(), which is the local authorization gate for OPENs the
    client serves itself from a cached write delegation via the
    can_open_delegated() path in nfs4_try_open_cached().  The mask is
    derived from O_ACCMODE alone, so an open(O_RDONLY | O_TRUNC) against a
    file the caller cannot write requests only MAY_READ and passes the
    local check.  The OPEN is then satisfied locally and the truncation is
    issued to the server as a SETATTR(size=0) over the delegation stateid,
    which the server accepts under standard write-delegation semantics.
    POSIX requires that this open fail with EACCES.
    
    Include MAY_WRITE in the mask whenever O_TRUNC is set so the local
    check matches the access the server would have enforced.
    
    Suggested-by: Trond Myklebust <trondmy@kernel.org>
    Fixes: af22f94ae02a ("NFSv4: Simplify _nfs4_do_access()")
    Cc: stable@vger.kernel.org
    Signed-off-by: Benjamin Coddington <bcodding@hammerspace.com>
    Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
nilfs2: reject CLEAN_SEGMENTS ioctl with out-of-range segment numbers [+ + +]
Author: Deepanshu Kartikey <kartikey406@gmail.com>
Date:   Sun May 3 13:33:29 2026 +0900

    nilfs2: reject CLEAN_SEGMENTS ioctl with out-of-range segment numbers
    
    commit 0e7a690fe435f8d5ea3feb7c1d8d73ba7e8b8aa9 upstream.
    
    Syzbot reported a hung task in nilfs_transaction_begin() where multiple
    tasks performing chmod() on a nilfs2 mount blocked for over 143 seconds
    waiting to acquire ns_segctor_sem for read:
    
      INFO: task syz.0.17:5918 blocked for more than 143 seconds.
      Call Trace:
       schedule+0x164/0x360
       rwsem_down_read_slowpath+0x6d9/0x940
       down_read+0x99/0x2e0
       nilfs_transaction_begin+0x364/0x710 fs/nilfs2/segment.c:221
       nilfs_setattr+0x124/0x2c0 fs/nilfs2/inode.c:921
       notify_change+0xc1a/0xf40
       chmod_common+0x273/0x4a0
       do_fchmodat+0x12d/0x230
    
    The writer holding ns_segctor_sem was a concurrent
    NILFS_IOCTL_CLEAN_SEGMENTS caller, stuck inside printk while emitting
    per-element warnings from nilfs_sufile_updatev():
    
       __nilfs_msg+0x373/0x450 fs/nilfs2/super.c:78
       nilfs_sufile_updatev+0x21c/0x6d0 fs/nilfs2/sufile.c:186
       nilfs_sufile_freev fs/nilfs2/sufile.h:93 [inline]
       nilfs_free_segments fs/nilfs2/segment.c:1140 [inline]
       nilfs_segctor_collect_blocks fs/nilfs2/segment.c:1261 [inline]
       nilfs_segctor_do_construct+0x1f55/0x76c0
       nilfs_clean_segments+0x3bd/0xa50
       nilfs_ioctl_clean_segments fs/nilfs2/ioctl.c:922 [inline]
       nilfs_ioctl+0x261f/0x2780
    
    The root cause is that user-supplied segment numbers are not validated
    before nilfs_clean_segments() begins doing work; the range check on
    each segnum is performed deep inside the call chain by
    nilfs_sufile_updatev(), which emits a nilfs_warn() per invalid entry
    while still holding the segctor lock and the sufile mi_sem.  Under load
    (repeated invocations across multiple mounts saturating the global
    printk path), the cumulative printk latency keeps ns_segctor_sem held
    long enough to trip the hung_task watchdog, blocking concurrent
    operations such as chmod() that need ns_segctor_sem for read.
    
    Fix by validating the contents of kbufs[4] in nilfs_clean_segments()
    immediately after acquiring ns_segctor_sem via nilfs_transaction_lock().
    Holding ns_segctor_sem serializes the check against
    nilfs_ioctl_resize(), which can modify ns_nsegments, so the validation
    uses a consistent value.  Out-of-range segment numbers are rejected
    with -EINVAL before any segment-cleaning work begins, so the bad
    entries never reach the per-element diagnostic path inside
    nilfs_sufile_updatev().
    
    Reported-by: syzbot+62f0f99d2f2bb8e3bbd7@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=62f0f99d2f2bb8e3bbd7
    Tested-by: syzbot+62f0f99d2f2bb8e3bbd7@syzkaller.appspotmail.com
    Cc: stable@vger.kernel.org
    Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
    Fixes: 071cb4b81987 ("nilfs2: eliminate removal list of segments")
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
    Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
nouveau/vmm: fix another SPT/LPT race [+ + +]
Author: Dave Airlie <airlied@redhat.com>
Date:   Mon Jun 15 14:47:37 2026 +1000

    nouveau/vmm: fix another SPT/LPT race
    
    commit 6763a0aea6d658d69b9215ab9151d7bd4c1c314b upstream.
    
    We've had an unknown Turing issue for a while with page faults since
    large pages and compression.
    
    I've got a patch series that syncs all our L2 handling with ogkm and it
    made this fault happen more.
    
    After writing a bunch of debugging patches, I spotted an invalid LPT
    entry where there should have been a valid one.
    
    A 64K MAP succeeds on a range, but a subsequent SPT put drops SPT refs
    across multiple ranges,
    
    We shouldn't assume all ranges where SPTEs go away will have the same
    sparse/invalid/valid state, just iterate over each instead and do the
    right thing.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Fixes: d19512f5abb1 ("nouveau/vmm: start tracking if the LPT PTE is valid. (v6)")
    Link: https://patch.msgid.link/20260615044737.3419585-1-airlied@gmail.com
    [ Properly format commit message. - Danilo ]
    Signed-off-by: Danilo Krummrich <dakr@kernel.org>
    (cherry picked from commit d008141ed4ce924167a03d46fbce9ad1fe4efa29)
    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
NTB: epf: Avoid calling pci_irq_vector() from hardirq context [+ + +]
Author: Koichiro Den <den@valinux.co.jp>
Date:   Wed Mar 4 17:30:28 2026 +0900

    NTB: epf: Avoid calling pci_irq_vector() from hardirq context
    
    commit 4dcddc1c794d1c65eda68f1f8dd04a0fecc0870f upstream.
    
    ntb_epf_vec_isr() calls pci_irq_vector() in hardirq context to derive
    the vector number. pci_irq_vector() calls msi_get_virq() that takes a
    mutex and can therefore trigger "scheduling while atomic" splats:
    
      BUG: scheduling while atomic: kworker/u33:0/55/0x00010001
      ...
      Call trace:
       ...
       schedule+0x38/0x110
       schedule_preempt_disabled+0x28/0x50
       __mutex_lock.constprop.0+0x848/0x908
       __mutex_lock_slowpath+0x18/0x30
       mutex_lock+0x4c/0x60
       msi_domain_get_virq+0xe8/0x138
       pci_irq_vector+0x2c/0x60
       ntb_epf_vec_isr+0x28/0x120 [ntb_hw_epf]
       __handle_irq_event_percpu+0x70/0x3a8
       handle_irq_event+0x48/0x100
       handle_edge_irq+0x100/0x1c8
       ...
    
    Cache the Linux IRQ number for vector 0 when vectors are allocated and
    use it as a base in the ISR. Running the ISR in a threaded IRQ handler
    would also avoid the problem, but that would be unnecessary here.
    
    Fixes: 812ce2f8d14e ("NTB: Add support for EPF PCI Non-Transparent Bridge")
    Signed-off-by: Koichiro Den <den@valinux.co.jp>
    Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Dave Jiang <dave.jiang@intel.com>
    Cc: stable@vger.kernel.org # v5.12+
    Link: https://patch.msgid.link/20260304083028.1391068-3-den@valinux.co.jp
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

NTB: epf: Fix request_irq() unwind in ntb_epf_init_isr() [+ + +]
Author: Koichiro Den <den@valinux.co.jp>
Date:   Wed Mar 4 17:30:27 2026 +0900

    NTB: epf: Fix request_irq() unwind in ntb_epf_init_isr()
    
    commit fcba26efe5efc7441f5505f4ccc69791214b40be upstream.
    
    ntb_epf_init_isr() requests multiple MSI/MSI-X vectors in a loop. If
    request_irq() fails part-way through, it jumps straight to
    pci_free_irq_vectors() without freeing already requested IRQs.
    
    Fix the error path by freeing any successfully requested IRQs before
    releasing the vectors.
    
    Fixes: 812ce2f8d14e ("NTB: Add support for EPF PCI Non-Transparent Bridge")
    Signed-off-by: Koichiro Den <den@valinux.co.jp>
    Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Dave Jiang <dave.jiang@intel.com>
    Cc: stable@vger.kernel.org # v5.12+
    Link: https://patch.msgid.link/20260304083028.1391068-2-den@valinux.co.jp
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ntfs: avoid calling post_write_mst_fixup() for invalid index_block [+ + +]
Author: Valeriy Yashnikov <yashnikov.valeriy@gmail.com>
Date:   Sat Jul 4 19:38:57 2026 +1000

    ntfs: avoid calling post_write_mst_fixup() for invalid index_block
    
    commit 5b6eedd7cc2936f9238e852b553a1b326105bde8 upstream.
    
    ntfs_icx_ib_sync_write() calls post_write_mst_fixup() when ntfs_ib_write()
    returns an error, intending to restore the buffer after a failed write.
    
    However, ntfs_ib_write() returns an error immediately if
    pre_write_mst_fixup() validation fails. The caller,
    ntfs_icx_ib_sync_write(), interprets any error as a write failure
    requiring rollback. It does not differentiate between I/O errors and
    validation failures, and calls post_write_mst_fixup() anyway.
    
    Since post_write_mst_fixup() assumes that the index_block contents is
    correct, it doesn't perform the boundary checks, which results in
    out-of-bounds memory access.
    
    An attacker can craft a malicious NTFS image with:
      - large index_block.usa_ofs offset, pointing outside the ntfs_record
      - index_block.usa_count = 0, causing integer underflow
      - or index_block.usa_count larger than actual number of sectors in the
        ntfs_record, causing out-of-bounds access
    
    KASAN reports describing the memory corruption:
      ==================================================================
      BUG: KASAN: slab-out-of-bounds in post_write_mst_fixup+0x19c/0x1d0
      Read of size 2 at addr ffff8881586c9018 by task p/9428
      Call Trace:
       <TASK>
       dump_stack_lvl+0x100/0x190
       print_report+0x139/0x4ad
       ? post_write_mst_fixup+0x19c/0x1d0
       ? __virt_addr_valid+0x262/0x500
       ? post_write_mst_fixup+0x19c/0x1d0
       kasan_report+0xe4/0x1d0
       ? post_write_mst_fixup+0x19c/0x1d0
       post_write_mst_fixup+0x19c/0x1d0
       ntfs_icx_ib_sync_write+0x179/0x220
       ntfs_inode_sync_filename+0x83d/0x1080
       __ntfs_write_inode+0x1049/0x1480
       ntfs_file_fsync+0x131/0x9b0
      ==================================================================
      BUG: KASAN: slab-out-of-bounds in post_write_mst_fixup+0x1aa/0x1d0
      Write of size 2 at addr ffff8881586c91fe by task p/9428
      Call Trace:
       <TASK>
       dump_stack_lvl+0x100/0x190
       print_report+0x139/0x4ad
       ? post_write_mst_fixup+0x1aa/0x1d0
       ? __virt_addr_valid+0x262/0x500
       ? post_write_mst_fixup+0x1aa/0x1d0
       kasan_report+0xe4/0x1d0
       ? post_write_mst_fixup+0x1aa/0x1d0
       post_write_mst_fixup+0x1aa/0x1d0
       ntfs_icx_ib_sync_write+0x179/0x220
       ntfs_inode_sync_filename+0x83d/0x1080
       __ntfs_write_inode+0x1049/0x1480
       ntfs_file_fsync+0x131/0x9b0
      ==================================================================
    
    Let's move the post_write_mst_fixup() call to ntfs_ib_write().
    The ntfs_ib_write() function calls pre_write_mst_fixup() at the beginning.
    If the index_block contents is invalid, pre_write_mst_fixup() fails and
    ntfs_ib_write() returns early without calling post_write_mst_fixup() on
    bad index_block.
    
    Fixes: 0a8ac0c1fa0b ("ntfs: update directory operations")
    Cc: stable@vger.kernel.org
    Signed-off-by: Valeriy Yashnikov <yashnikov.valeriy@gmail.com>
    Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>
    Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
nvme-multipath: set BIO_REMAPPED on bios remapped to per-path namespace disks [+ + +]
Author: Achkinazi, Igor <Igor.Achkinazi@dell.com>
Date:   Thu May 28 15:24:27 2026 +0000

    nvme-multipath: set BIO_REMAPPED on bios remapped to per-path namespace disks
    
    commit 88bac2c1a72b8f4f71e9845699aa872df04e5850 upstream.
    
    When nvme_ns_head_submit_bio() remaps a bio from the multipath head to a
    per-path namespace, bio_set_dev() clears BIO_REMAPPED.  The remapped bio
    is then resubmitted through submit_bio_noacct() which calls
    bio_check_eod() because BIO_REMAPPED is not set.
    
    This races with nvme_ns_remove() which zeroes the per-path capacity
    before synchronize_srcu():
    
      CPU 0 (IO submission)
      ---------------------
      srcu_read_lock()
      nvme_find_path() -> ns
        [NVME_NS_READY is set]
    
      CPU 1 (namespace removal)
      -------------------------
      clear_bit(NVME_NS_READY)
      set_capacity(ns->disk, 0)
      synchronize_srcu()  <- blocks
    
      CPU 0 (IO submission)
      ---------------------
      bio_set_dev(bio, ns->disk->part0)
        [clears BIO_REMAPPED]
      submit_bio_noacct(bio)
        -> bio_check_eod() sees capacity=0
        -> bio fails with IO error
    
    The SRCU read lock prevents synchronize_srcu() from completing, but does
    not prevent set_capacity(0) from executing.  The bio fails the EOD check
    before it reaches the NVMe driver, so nvme_failover_req() never gets a
    chance to redirect it to another path of multipath.  IO errors are
    reported to the application despite another path being available.
    
    On older kernels (before commit 0b64682e78f7 "block: skip unnecessary
    checks for split bio"), the same race was also reachable through split
    remainders resubmitted via submit_bio_noacct().
    
    Fix this by setting BIO_REMAPPED after bio_set_dev() in
    nvme_ns_head_submit_bio().  This skips bio_check_eod() on the per-path
    device; the EOD check already passed on the multipath head.
    
    NVMe per-path namespace devices are always whole disks (bd_partno=0), so
    the blk_partition_remap() skip also gated by BIO_REMAPPED is a no-op.
    The flag does not persist across failover and cannot go stale if the
    namespace geometry changes between attempts: nvme_failover_req() calls
    bio_set_dev() to redirect the bio back to the multipath head, which
    clears BIO_REMAPPED.  When nvme_requeue_work() resubmits through
    submit_bio_noacct(), bio_check_eod() runs normally against the current
    capacity.
    
    Same approach as commit 3a905c37c351 ("block: skip bio_check_eod for
    partition-remapped bios").
    
    Fixes: a7c7f7b2b641 ("nvme: use bio_set_dev to assign ->bi_bdev")
    Cc: stable@vger.kernel.org
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Igor Achkinazi <igor.achkinazi@dell.com>
    Signed-off-by: Keith Busch <kbusch@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
nvme: target: rdma: fix ndev refcount leak on queue connect [+ + +]
Author: Wentao Liang <vulab@iscas.ac.cn>
Date:   Wed May 27 08:45:44 2026 +0000

    nvme: target: rdma: fix ndev refcount leak on queue connect
    
    commit badc53620fe813b3a9f727ef9526f98567c2c898 upstream.
    
    nvmet_rdma_queue_connect() calls nvmet_rdma_find_get_device() which
    acquires a reference on the returned ndev via kref_get(). On the path
    where the host queue backlog is exceeded and the function returns
    NVME_SC_CONNECT_CTRL_BUSY, reference of ndev is not released, leaking
    the kref.
    
    Fix this by adding a goto to the existing put_device label before the
    early return.
    
    Fixes: 31deaeb11ba7 ("nvmet-rdma: avoid circular locking dependency on install_queue()")
    Cc: stable@vger.kernel.org
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
    Signed-off-by: Keith Busch <kbusch@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
nvmet-auth: validate reply message payload bounds against transfer length [+ + +]
Author: Tianchu Chen <flynnnchen@tencent.com>
Date:   Fri May 29 14:18:39 2026 +0000

    nvmet-auth: validate reply message payload bounds against transfer length
    
    commit 3a413ece2504c70aa34a20be4dafec04e8c741f9 upstream.
    
    nvmet_auth_reply() accesses the variable-length rval[] array using
    attacker-controlled hl (hash length) and dhvlen (DH value length) fields
    without verifying they fit within the allocated buffer of tl bytes.
    
    A malicious NVMe-oF initiator can craft a DHCHAP_REPLY message with a
    small transfer length but large hl/dhvlen values, causing out-of-bounds
    heap reads when the target processes the DH public key (rval + 2*hl) or
    performs the host response memcmp.
    
    With DH authentication configured, the OOB pointer is passed directly to
    sg_init_one() and read by crypto_kpp_compute_shared_secret(), reaching
    up to 526 bytes past the buffer. This is exploitable pre-authentication.
    
    Add bounds validation ensuring sizeof(*data) + 2*hl + dhvlen <= tl before
    any access to the variable-length fields.
    
    Discovered by Atuin - Automated Vulnerability Discovery Engine.
    
    Fixes: db1312dd9548 ("nvmet: implement basic In-Band Authentication")
    Cc: stable@vger.kernel.org
    Reviewed-by: Hannes Reinecke <hare@kernel.org>
    Signed-off-by: Tianchu Chen <flynnnchen@tencent.com>
    Signed-off-by: Keith Busch <kbusch@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
nvmet: fix pre-auth out-of-bounds heap read in Discovery Get Log Page [+ + +]
Author: Bryam Vargas <hexlabsecurity@proton.me>
Date:   Wed May 27 15:00:00 2026 -0500

    nvmet: fix pre-auth out-of-bounds heap read in Discovery Get Log Page
    
    commit 53cd102a7a56079b11b897835bd9b94c14e6322c upstream.
    
    nvmet_execute_disc_get_log_page() validates only the dword alignment
    of the host-supplied Log Page Offset (lpo).  The 64-bit offset is then
    added to a small kzalloc'd buffer that holds the discovery log page
    and the result is passed straight to nvmet_copy_to_sgl(), which
    memcpy()s data_len bytes out to the host with no source-side bound
    check:
    
        u64 offset      = nvmet_get_log_page_offset(req->cmd);  /* 64-bit host */
        size_t data_len = nvmet_get_log_page_len(req->cmd);     /* 32-bit host */
        ...
        if (offset & 0x3) { ... }                               /* only check */
        ...
        alloc_len = sizeof(*hdr) + entry_size * discovery_log_entries(req);
        buffer = kzalloc(alloc_len, GFP_KERNEL);
        ...
        status = nvmet_copy_to_sgl(req, 0, buffer + offset, data_len);
    
    The Discovery controller is unauthenticated -- nvmet_host_allowed()
    returns true unconditionally for the discovery subsystem -- so the call
    is reachable pre-authentication by any TCP/RDMA/FC peer that can reach
    the nvmet target.  With a discovery log page of ~1 KiB, an attacker
    requesting up to 4 KiB starting at offset == alloc_len reads the next
    slab page out and gets its content returned over the fabric (an
    empirical run on a default nvmet-tcp loopback target leaked 81
    canonical kernel pointers in one Get Log Page response).  Pointing the
    offset at unmapped kernel memory faults the in-kernel memcpy and
    crashes (or panics, on panic_on_oops=1) the target host instead.
    
    The attacker-controlled source-side offset pattern
    "nvmet_copy_to_sgl(req, 0, buffer + ATTACKER_OFFSET, ...)" is unique
    to nvmet_execute_disc_get_log_page in the entire nvmet codebase: every
    other Get Log Page handler in admin-cmd.c either ignores lpo (and
    silently starts every response at offset 0) or tracks a local
    destination offset with a fixed source pointer.
    
    Validate the host-supplied offset against the log page size, cap the
    copy length to what is actually available, and zero-fill any remainder
    of the host transfer buffer.  The zero-fill matches the existing
    short-response pattern in nvmet_execute_get_log_changed_ns()
    (admin-cmd.c) and prevents leaking transport SGL contents when the
    host asks for more bytes than the log page contains.
    
    Fixes: a07b4970f464 ("nvmet: add a generic NVMe target")
    Cc: stable@vger.kernel.org
    Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>
    Signed-off-by: Keith Busch <kbusch@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
OPP: of: Fix potential memory leak in opp_parse_supplies() [+ + +]
Author: Abdun Nihaal <nihaal@cse.iitm.ac.in>
Date:   Mon May 11 12:12:11 2026 +0530

    OPP: of: Fix potential memory leak in opp_parse_supplies()
    
    commit 69f888381d2ecbe18ed9f112c096f8fd3623db98 upstream.
    
    The memory allocated for microvolt, microamp and microwatt is not freed
    in one of the paths in opp_parse_supplies() which returns directly.
    Fix that by adding a goto to the error unwind ladder.
    
    Fixes: 2eedf62e66c2 ("OPP: decouple dt properties in opp_parse_supplies()")
    Cc: stable@vger.kernel.org
    Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
    Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
partitions: aix: bound the pp_count scan to the ppe array [+ + +]
Author: Bryam Vargas <hexlabsecurity@proton.me>
Date:   Sun Jun 7 06:41:43 2026 +0000

    partitions: aix: bound the pp_count scan to the ppe array
    
    commit 2dc0bfd2fe355fb930de63c2f2eb8ced8570c579 upstream.
    
    aix_partition() reads the physical volume descriptor into a fixed-size
    struct pvd and then scans its physical-partition-extent array:
    
            int numpps = be16_to_cpu(pvd->pp_count);
            ...
            for (i = 0; i < numpps; i += 1) {
                    struct ppe *p = pvd->ppe + i;
                    ...
                    lp_ix = be16_to_cpu(p->lp_ix);
    
    pvd points at a single kmalloc()'d struct pvd whose ppe[] member holds a
    fixed ARRAY_SIZE(pvd->ppe) (1016) entries, but the loop runs up to the
    on-disk pp_count.  pp_count is an unvalidated __be16 read straight from
    the descriptor, so a crafted AIX image with pp_count larger than 1016
    drives the loop to read pvd->ppe[i] past the end of the allocation (up
    to 65535 entries, ~2 MB out of bounds).
    
    The partition scan runs without mounting anything, when a block device
    with a crafted AIX/IBM partition table appears (an attacker-supplied
    image attached with losetup -P, or a device auto-scanned by udev), via
    msdos_partition() -> aix_partition().
    
    Clamp the scan to the number of entries the ppe[] array can hold.
    
    Fixes: 6ceea22bbbc8 ("partitions: add aix lvm partition support files")
    Cc: stable@vger.kernel.org
    Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>
    Acked-by: Philippe De Muyter <phdm@macqel.be>
    Link: https://patch.msgid.link/20260607064137.302574-1-hexlabsecurity@proton.me
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
PCI/IOV: Skip VF Resizable BAR restore on read error [+ + +]
Author: Marco Nenciarini <mnencia@kcore.it>
Date:   Fri Apr 17 15:24:37 2026 +0200

    PCI/IOV: Skip VF Resizable BAR restore on read error
    
    commit f34f1712229d71ce4286440fef12526fd4590b37 upstream.
    
    sriov_restore_vf_rebar_state() uses the VF Resizable BAR Control register
    to decide how many VF BARs to restore (nbars) and which VF BAR each
    iteration addresses (bar_idx). bar_idx indexes into dev->sriov->barsz[],
    which has only PCI_SRIOV_NUM_BARS (6) entries.
    
    When a device does not respond, config reads typically return
    PCI_ERROR_RESPONSE (~0).  Both fields are 3 bits wide, so nbars and bar_idx
    both evaluate to 7. The barsz[] access then goes out of bounds.  UBSAN
    reports this as:
    
      UBSAN: array-index-out-of-bounds in drivers/pci/iov.c:948:51 index 7 is out of range for type 'resource_size_t [6]'
    
    Observed on an NVIDIA RTX PRO 1000 GPU (GB207GLM) that stopped responding
    during a failed GC6 power state exit. The subsequent pci_restore_state()
    invoked sriov_restore_vf_rebar_state() while config reads returned
    0xffffffff, triggering the splat.
    
    Bail out if any VF Resizable BAR Control read returns PCI_ERROR_RESPONSE.
    No further VF BARs are touched, which is safe because a config read that
    returns PCI_ERROR_RESPONSE indicates the device is unreachable and
    restoration is pointless. This mirrors the guard in
    pci_restore_rebar_state().
    
    Fixes: 5a8f77e24a30 ("PCI/IOV: Restore VF resizable BAR state after reset")
    Signed-off-by: Marco Nenciarini <mnencia@kcore.it>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/44a4ae53ec2825816b816c85cd378430d9a95cc6.1776429882.git.mnencia@kcore.it
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
PCI: altera: Do not dispose parent IRQ mapping [+ + +]
Author: Mahesh Vaidya <mahesh.vaidya@altera.com>
Date:   Thu Apr 30 13:43:29 2026 -0700

    PCI: altera: Do not dispose parent IRQ mapping
    
    commit 5ef4bac02189bee0b7c170e352d7a38e13fe9678 upstream.
    
    altera_pcie_irq_teardown() calls irq_dispose_mapping() on pcie->irq.
    However, pcie->irq is the parent IRQ returned by platform_get_irq(), not
    the mapping created by Altera INTx irq_domain.
    
    The Altera driver only sets the chained handler on the parent IRQ. It
    should detach that handler during teardown, but it should not dispose the
    parent IRQ mapping, which belongs to the parent interrupt controller's
    irq_domain.
    
    Drop irq_dispose_mapping(pcie->irq) from the teardown path.
    
    Note that during irqchip remove(), the child IRQs should've disposed. But
    since the chained handler itself is removed, there is no way the stale
    child IRQs (if exists) could fire. So it is safe here.
    
    Fixes: ec15c4d0d5d2 ("PCI: altera: Allow building as module")
    Signed-off-by: Mahesh Vaidya <mahesh.vaidya@altera.com>
    [mani: added a note about IRQ disposal]
    Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
    Reviewed-by: Subhransu S. Prusty <subhransu.sekhar.prusty@altera.com>
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20260430204330.3121003-2-mahesh.vaidya@altera.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

PCI: altera: Fix resource leaks on probe failure [+ + +]
Author: Mahesh Vaidya <mahesh.vaidya@altera.com>
Date:   Thu Apr 30 13:43:30 2026 -0700

    PCI: altera: Fix resource leaks on probe failure
    
    commit 7a94138caeb27f3c49c1dbd93bf422098925bb28 upstream.
    
    The chained IRQ handler is set during probe, but is only removed during the
    driver remove(). If pci_host_probe() fails, the handler and INTx IRQ
    domain remain set even though the devm-managed host bridge storage
    containing struct altera_pcie will be released, leaving the handler with
    a stale data pointer.
    
    Interrupts are also enabled before pci_host_probe() is called. If probe
    fails after that point, the controller interrupt source should be disabled
    before the chained handler and INTx domain are removed.
    
    So set the chained handler only after the INTx domain has been created.
    Disable controller interrupts during IRQ teardown, and tear the IRQ setup
    down if pci_host_probe() fails.
    
    Fixes: c63aed7334c2 ("PCI: altera: Use pci_host_probe() to register host")
    Signed-off-by: Mahesh Vaidya <mahesh.vaidya@altera.com>
    [mani: commit log]
    Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
    Reviewed-by: Subhransu S. Prusty <subhransu.sekhar.prusty@altera.com>
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20260430204330.3121003-3-mahesh.vaidya@altera.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

PCI: Always lift 2.5GT/s restriction in PCIe failed link retraining [+ + +]
Author: Maciej W. Rozycki <macro@orcam.me.uk>
Date:   Mon Dec 8 19:24:29 2025 +0000

    PCI: Always lift 2.5GT/s restriction in PCIe failed link retraining
    
    commit 72780f7964684939d7d2f69c348876213b184484 upstream.
    
    Discard Vendor:Device ID matching in the PCIe failed link retraining quirk
    and ignore the link status for the removal of the 2.5GT/s speed clamp,
    whether applied by the quirk itself or the firmware earlier on.  Revert to
    the original target link speed if this final link retraining has failed.
    
    This is so that link training noise in hot-plug scenarios does not make a
    link remain clamped to the 2.5GT/s speed where an event race has led the
    quirk to apply the speed clamp for one device, only to leave it in place
    for a subsequent device to be plugged in.
    
    Refer to the Link Capabilities register directly for the maximum link speed
    determination so as to streamline backporting.
    
    Fixes: a89c82249c37 ("PCI: Work around PCIe link training failures")
    Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Tested-by: Alok Tiwari <alok.a.tiwari@oracle.com>
    Cc: stable@vger.kernel.org # v6.5+
    Link: https://patch.msgid.link/alpine.DEB.2.21.2512080331530.49654@angie.orcam.me.uk
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

PCI: host-common: Request bus reassignment when not probe-only [+ + +]
Author: Ratheesh Kannoth <rkannoth@marvell.com>
Date:   Tue Apr 14 13:47:30 2026 +0530

    PCI: host-common: Request bus reassignment when not probe-only
    
    commit fda8749ba73638f5bbca3ffb39bc6861eb3b23fa upstream.
    
    pci_host_common_init() is used by several generic ECAM host drivers.
    After PCI core changes around pci_flags and preserve_config, these hosts
    no longer opted into full bus number reassignment the way they did
    before, which broke enumeration of devices on a Marvell CN106XX board.
    
    When PCI_PROBE_ONLY is not set, add PCI_REASSIGN_ALL_BUS so
    pci_scan_bridge_extend() takes the reassignment path: bus numbers can be
    assigned from firmware EA data (e.g. pci_ea_fixed_busnrs()). Skip the
    flag in probe-only mode so existing assignments are not overridden.
    
    Fixes: 7246a4520b4b ("PCI: Use preserve_config in place of pci_flags")
    Closes: https://lore.kernel.org/all/abkqm_LCd9zAM8cW@rkannoth-OptiPlex-7090/
    Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
    [mani: added stable tag]
    Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
    [bhelgaas: add problem report link]
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Cc: stable@vger.kernel.org
    Cc: Vidya Sagar <vidyas@nvidia.com>
    Link: https://patch.msgid.link/20260414081730.3864372-1-rkannoth@marvell.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

PCI: imx6: Assert ref_clk_en after reference clock stabilizes on i.MX95 [+ + +]
Author: Richard Zhu <hongxing.zhu@nxp.com>
Date:   Mon May 18 15:27:15 2026 +0800

    PCI: imx6: Assert ref_clk_en after reference clock stabilizes on i.MX95
    
    commit 9dda3f83ba677b9cc2613cecd9120123000ae50f upstream.
    
    According to the PHY Databook Common Block Signals section, the
    ref_clk_en signal must remain de-asserted until the reference clock is
    running at the appropriate frequency. Once the clock is stable,
    ref_clk_en can be asserted. For lower power states where the reference
    clock to the PHY is disabled, ref_clk_en should also be de-asserted.
    
    Move the ref_clk_en bit manipulation into imx95_pcie_enable_ref_clk()
    to ensure the reference clock stabilizes before ref_clk_en is asserted
    and before the PHY reset is de-asserted. This aligns with the timing
    requirements specified in the PHY documentation.
    
    Fixes: d8574ce57d76 ("PCI: imx6: Add external reference clock input mode support")
    Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
    Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20260518072715.3166514-3-hongxing.zhu@nxp.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

PCI: imx6: Configure REF_USE_PAD before PHY reset for i.MX95 [+ + +]
Author: Richard Zhu <hongxing.zhu@nxp.com>
Date:   Mon May 18 15:27:14 2026 +0800

    PCI: imx6: Configure REF_USE_PAD before PHY reset for i.MX95
    
    commit 0c26b1c34d12d4debfb5363cc0be6cdf68e87ba2 upstream.
    
    According to the i.MX95 PCIe PHY Databook, the ref_use_pad signal in the
    Common Block Signals section selects the reference clock source connected
    to the PHY pads. Per the specification, any change to this input must be
    followed by a PHY reset assertion to take effect.
    
    Move the REF_USE_PAD configuration before the PHY reset toggle to comply
    with the required initialization sequence.
    
    Fixes: 47f54a902dcd ("PCI: imx6: Toggle the core reset for i.MX95 PCIe")
    Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
    [mani: renamed the callback and helper to match the usecase]
    Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20260518072715.3166514-2-hongxing.zhu@nxp.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

PCI: imx6: Fix IMX6SX_GPR12_PCIE_TEST_POWERDOWN handling [+ + +]
Author: Richard Zhu <hongxing.zhu@nxp.com>
Date:   Thu Mar 19 17:08:44 2026 +0800

    PCI: imx6: Fix IMX6SX_GPR12_PCIE_TEST_POWERDOWN handling
    
    commit aad953fb4eed0df5486cd54ccad80ac197678e01 upstream.
    
    The IMX6SX_GPR12_PCIE_TEST_POWERDOWN bit does not control the PCIe
    reference clock on i.MX6SX. Instead, it is part of i.MX6SX PCIe core
    reset sequence.
    
    Move the IMX6SX_GPR12_PCIE_TEST_POWERDOWN assertion/deassertion into
    the core reset functions to properly reflect its purpose. Remove the
    .enable_ref_clk() callback for i.MX6SX since it was incorrectly
    manipulating this bit.
    
    Fixes: e3c06cd063d6 ("PCI: imx6: Add initial imx6sx support")
    Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
    Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20260319090844.444987-1-hongxing.zhu@nxp.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

PCI: loongson: Override PCIe bridge supported speeds for Loongson-3C6000 series [+ + +]
Author: Ziyao Li <liziyao@uniontech.com>
Date:   Sun Apr 12 18:17:31 2026 +0800

    PCI: loongson: Override PCIe bridge supported speeds for Loongson-3C6000 series
    
    commit e373c789bac0ad73b472d8b44714df3bd18a4edf upstream.
    
    Older steppings of the Loongson-3C6000 series incorrectly report the
    supported link speeds on their PCIe bridges (device IDs 0x3c19, 0x3c29)
    as only 2.5 GT/s, despite the upstream bus supporting speeds from
    2.5 GT/s up to 16 GT/s.
    
    As a result, since commit 774c71c52aa4 ("PCI/bwctrl: Enable only if more
    than one speed is supported"), bwctrl will be disabled if there's only
    one 2.5 GT/s value in vector 'supported_speeds'.
    
    Manually override the 'supported_speeds' field for affected PCIe bridges
    with those found on the upstream bus to correctly reflect the supported
    link speeds.  Updating the speeds to reflect what the hardware actually
    supports avoids quirks in drivers consuming the speed information.
    
    This commit was originally found from AOSC OS[1].
    
    Fixes: cd89edda4002 ("PCI: loongson: Add ACPI init support")
    Signed-off-by: Ayden Meng <aydenmeng@yeah.net>
    Signed-off-by: Mingcong Bai <jeffbai@aosc.io>
    [Ziyao Li: move from drivers/pci/quirks.c to drivers/pci/controller/pci-loongson.c]
    Signed-off-by: Ziyao Li <liziyao@uniontech.com>
    [Xi Ruoyao: Fixed falling through logic, added debug log, Fixes tag and rebased to 7.0-rc7]
    Signed-off-by: Xi Ruoyao <xry111@xry111.site>
    Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
    [bhelgaas: commit log, https://lore.kernel.org/all/9d815df3b33a63223112b97440c01247935363c1.camel@xry111.site]
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Tested-by: Lain Fearyncess Yang <fsf@live.com>
    Tested-by: Ayden Meng <aydenmeng@yeah.net>
    Tested-by: Mingcong Bai <jeffbai@aosc.io>
    Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
    Cc: stable@vger.kernel.org
    Link: https://github.com/AOSC-Tracking/linux/commit/4392f441363abdf6fa0a0433d73175a17f493454
    Link: https://github.com/AOSC-Tracking/linux/pull/2 #1
    Link: https://patch.msgid.link/20260412101731.107059-1-xry111@xry111.site
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

PCI: mediatek: Fix IRQ domain leak when port fails to enable [+ + +]
Author: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Date:   Thu May 21 23:16:17 2026 +0530

    PCI: mediatek: Fix IRQ domain leak when port fails to enable
    
    commit f865a57896bd92d7662eb2818d8f48872e2cbbc7 upstream.
    
    When mtk_pcie_enable_port() fails, mtk_pcie_port_free() removes the port
    from pcie->ports and frees the port structure. However, the IRQ domains set
    up earlier by mtk_pcie_init_irq_domain() are never freed.
    
    Fix this by refactoring mtk_pcie_irq_teardown() into a per-port helper,
    mtk_pcie_irq_teardown_port(), and calling it from mtk_pcie_setup() when
    mtk_pcie_enable_port() fails. Since the IRQ teardown must only happen in
    the probe error path (during resume, child devices may have active MSI
    mappings and the NOIRQ context prohibits sleeping locks),
    mtk_pcie_enable_port() is changed to return an error code so callers can
    distinguish the two paths and act accordingly.
    
    This issue was reported by Sashiko while reviewing the EcoNet EN7528 SoC
    support series.
    
    Fixes: b099631df160 ("PCI: mediatek: Add controller support for MT2712 and MT7622")
    Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
    Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
    Cc: stable@vger.kernel.org # 5.10
    Cc: Caleb James DeLisle <cjd@cjdns.fr>
    Link: https://patch.msgid.link/20260521174617.17692-1-mani@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

PCI: qcom: Initialize DWC MSI lock for firmware-managed ECAM hosts [+ + +]
Author: Yadu M G <yadu.mg@oss.qualcomm.com>
Date:   Thu Jun 4 17:54:18 2026 +0530

    PCI: qcom: Initialize DWC MSI lock for firmware-managed ECAM hosts
    
    commit e0779713a1e2f891aeec53e629dbbd33f423c629 upstream.
    
    A lockdep warning is observed during boot on a Qcom firmware-managed
    platform:
    
      INFO: trying to register non-static key.
      The code is fine but needs lockdep annotation, or maybe
      you didn't initialize this object before use?
      turning off the locking correctness validator.
      ...
      Call trace:
       register_lock_class+0x128/0x4d8
       __lock_acquire+0x110/0x1db0
       lock_acquire+0x278/0x3d8
       _raw_spin_lock_irq+0x6c/0xc0
       dw_pcie_irq_domain_alloc+0x48/0x190
       irq_domain_alloc_irqs_parent+0x2c/0x48
       msi_domain_alloc+0x90/0x160
      ...
    
    dw_pcie_irq_domain_alloc() takes pp->lock while allocating MSI
    interrupts. pp->lock is normally initialized by dw_pcie_host_init(), but
    Qcom firmware-managed hosts use the ECAM init path instead:
    
      pci_host_common_ecam_create()
        pci_ecam_create()
          qcom_pcie_ecam_host_init()
            dw_pcie_msi_host_init()
              dw_pcie_allocate_domains()
    
    That path constructs a fresh struct dw_pcie_rp and calls
    dw_pcie_msi_host_init() directly, without going through
    dw_pcie_host_init(). As a result, pp->lock was not initialized, which
    triggers the warning.
    
    Initialize pp->lock in qcom_pcie_ecam_host_init() before registering the
    MSI domains so the firmware-managed ECAM path matches the normal DWC host
    initialization sequence.
    
    Fixes: 7d944c0f1469 ("PCI: qcom: Add support for Qualcomm SA8255p based PCIe Root Complex")
    Signed-off-by: Yadu M G <yadu.mg@oss.qualcomm.com>
    [mani: added fixes tag and CCed stable]
    Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
    Cc: stable@kernel.org
    Link: https://patch.msgid.link/20260604122418.727274-1-yadu.mg@oss.qualcomm.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

PCI: Skip Resizable BAR restore on read error [+ + +]
Author: Marco Nenciarini <mnencia@kcore.it>
Date:   Fri Apr 17 15:24:36 2026 +0200

    PCI: Skip Resizable BAR restore on read error
    
    commit ee7471fe968d210939be9046089a924cd23c8c3b upstream.
    
    pci_restore_rebar_state() uses the Resizable BAR Control register to decide
    how many BARs to restore (nbars) and which BAR each iteration addresses
    (bar_idx).
    
    When a device does not respond, config reads typically return
    PCI_ERROR_RESPONSE (~0).  Both fields are 3 bits wide, so nbars and bar_idx
    both evaluate to 7, past the spec's valid ranges for both fields.
    pci_resource_n() then returns an unrelated resource slot, whose size is
    used to derive a nonsensical value written back to the Resizable BAR
    Control register.
    
    Bail out if any Resizable BAR Control read returns PCI_ERROR_RESPONSE. No
    further BARs are touched, which is safe because a config read that returns
    PCI_ERROR_RESPONSE indicates the device is unreachable and restoration is
    pointless.
    
    Fixes: d3252ace0bc6 ("PCI: Restore resized BAR state on resume")
    Signed-off-by: Marco Nenciarini <mnencia@kcore.it>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/666cac19b5daa0ab0e0ab64454e76b4d24465dbd.1776429882.git.mnencia@kcore.it
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
perf trace beauty fcntl: Fix build with older kernel headers [+ + +]
Author: Florian Fainelli <florian.fainelli@broadcom.com>
Date:   Wed May 13 12:23:46 2026 -0700

    perf trace beauty fcntl: Fix build with older kernel headers
    
    commit 7ee7f48413c42b90230de4a8e40898b757bc8e82 upstream.
    
    Toolchains with older kernel headers that do not include upstream commit
    c75b1d9421f80f41 ("fs: add fcntl() interface for setting/getting write
    life time hints") will now fail to build perf due to missing definitions
    for F_GET_RW_HINT/F_SET_RW_HINT/F_GET_FILE_RW_HINT/F_SET_FILE_RW_HINT.
    
    Provide a fallback definition for these when they are not already
    defined.
    
    Fixes: 9c47f66748381ecb ("perf trace beauty fcntl: Basic 'arg' beautifier")
    Reviewed-by: Ian Rogers <irogers@google.com>
    Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: James Clark <james.clark@linaro.org>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Markus Mayer <mmayer@broadcom.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
perf/arm-cmn: Fix DVM node events [+ + +]
Author: Robin Murphy <robin.murphy@arm.com>
Date:   Fri May 29 15:33:45 2026 +0100

    perf/arm-cmn: Fix DVM node events
    
    commit 5936245125f78d896fdb1bbc2ae79213e28a6579 upstream.
    
    The new DVM node events added in CMN-700 also apply to CMN S3; fix
    the model encoding so that we can expose the aliases and handle
    occupancy filtering on newer CMNs too.
    
    Cc: stable@vger.kernel.org
    Fixes: 0dc2f4963f7e ("perf/arm-cmn: Support CMN S3")
    Signed-off-by: Robin Murphy <robin.murphy@arm.com>
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
perf/aux: Fix page UAF in map_range() [+ + +]
Author: Lee Jia Jie <jiajie.lee@starlabs.sg>
Date:   Thu Jul 9 21:56:19 2026 +0800

    perf/aux: Fix page UAF in map_range()
    
    commit 5948aaf64f81f217a25dcc2bf6c0779bca19566c upstream.
    
    map_range() reads rb->aux_pages[], rb->aux_nr_pages and rb->aux_pgoff via
    perf_mmap_to_page() while holding only event->mmap_mutex. Those fields are
    serialized by rb->aux_mutex, and mmap_mutex is per event.
    
    Thus, two events sharing one rb via PERF_EVENT_IOC_SET_OUTPUT can race
    rb_alloc_aux() with map_range(), leading to a page-UAF scenario as follows:
    
      CPU 0                           CPU 1
      =====                           =====
      rb_alloc_aux()                  map_range()
      [1]: allocate rb->aux_pages[0]
      [2]: rb->aux_nr_pages++
                                      [3]: perf_mmap_to_page()
                                             returns rb->aux_pages[0]
                                      [4]: map it as VM_PFNMAP
      [5]: rb->aux_pgoff = 1
    
      munmap the page
      [6]: free rb->aux_pages[0]
    
    Pages mapped as VM_PFNMAP have no refcount protection, so CPU 1 holds a
    mapping to a freed physical frame.
    
    Fix this by taking rb->aux_mutex across the page walk in map_range().
    
    Fixes: b709eb872e19 ("perf: map pages in advance")
    Signed-off-by: Lee Jia Jie <jiajie.lee@starlabs.sg>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Cc: stable@vger.kernel.org
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
perf/core: Detach event groups during remove_on_exec [+ + +]
Author: Taeyang Lee <0wn@theori.io>
Date:   Sun Jun 14 23:22:18 2026 +0900

    perf/core: Detach event groups during remove_on_exec
    
    [ Upstream commit 037a3c43edfb597665dd34457cd22b14692f2ba3 ]
    
    perf_event_remove_on_exec() removes events by calling
    perf_event_exit_event(). For top-level events, this removes the event from
    the context with DETACH_EXIT only.
    
    This can leave inconsistent group state when a removed event is a group
    leader and the group contains siblings without remove_on_exec. If the group
    was active, the surviving siblings can remain active and attached to the
    removed leader's sibling list, but are no longer represented by a valid
    group leader on the PMU context active lists.
    
    A later close of the removed leader uses DETACH_GROUP and can promote the
    still-active siblings from this stale group state. The next schedule-in can
    then add an already-linked active_list entry again, corrupting the PMU
    context active list.
    
    With DEBUG_LIST enabled, this is caught as a list_add double-add in
    merge_sched_in().
    
    Fix this by detaching group relationships when remove_on_exec removes an
    event. This preserves the existing task-exit and revoke behavior, while
    ensuring surviving siblings are ungrouped before the removed event leaves
    the context.
    
    Fixes: 2e498d0a74e5 ("perf: Add support for event removal on exec")
    Signed-off-by: Taeyang Lee <0wn@theori.io>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Link: https://patch.msgid.link/ai65GgZcC0LAlWLG@Taeyangs-MacBook-Pro.local
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
perf/x86/intel/uncore: Defer ADL global PMON enable to enable_box() [+ + +]
Author: Zide Chen <zide.chen@intel.com>
Date:   Tue Jun 2 07:49:05 2026 -0700

    perf/x86/intel/uncore: Defer ADL global PMON enable to enable_box()
    
    commit 9a0bb848a37150aeccc10088e141339917d995dc upstream.
    
    On some Raptor Cove CPUs, enabling uncore PMON globally at driver init
    may increase power consumption even when no perf events are in use.
    
    Drop adl_uncore_msr_init_box() and defer programming the global control
    register to enable_box(), so it is only set when a box is actually used.
    
    IMC and IMC freerunning counters use a separate control path and are
    unaffected.
    
    Fixes: 772ed05f3c5c ("perf/x86/intel/uncore: Add Alder Lake support")
    Signed-off-by: Zide Chen <zide.chen@intel.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Reviewed-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20260602144908.263680-5-zide.chen@intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
platform/x86: intel-hid: Protect ACPI notify handler against recursion [+ + +]
Author: HyeongJun An <sammiee5311@gmail.com>
Date:   Sat Jun 6 02:49:05 2026 +0900

    platform/x86: intel-hid: Protect ACPI notify handler against recursion
    
    commit c085d82613d5618814b84406c8b2d64f1bc305e7 upstream.
    
    Since commit e2ffcda16290 ("ACPI: OSL: Allow Notify () handlers to run on
    all CPUs") ACPI notify handlers like the intel-hid notify_handler() may
    run on multiple CPU cores racing with themselves.
    
    On convertibles and detachables (matched by DMI chassis-type 31 and 32 in
    dmi_auto_add_switch[]) the SW_TABLET_MODE input device is registered
    lazily from notify_handler() on the first tablet-mode event, via
    intel_hid_switches_setup(). When two such events race on different CPUs
    both can pass the !priv->switches check and register the priv->switches
    input device twice, resulting in a duplicate sysfs entry and a subsequent
    NULL pointer dereference.
    
    This is the same class of bug fixed by commit e075c3b13a0a ("platform/x86:
    intel-vbtn: Protect ACPI notify handler against recursion") for the
    sibling intel-vbtn driver.
    
    Protect intel-hid notify_handler() from racing with itself with a mutex
    to fix this.
    
    Fixes: e2ffcda16290 ("ACPI: OSL: Allow Notify () handlers to run on all CPUs")
    Cc: stable@vger.kernel.org
    Signed-off-by: HyeongJun An <sammiee5311@gmail.com>
    Link: https://patch.msgid.link/20260605174905.131095-1-sammiee5311@gmail.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
posix-cpu-timers: Fix pid refcount leak in do_cpu_nanosleep() error path [+ + +]
Author: WenTao Liang <vulab@iscas.ac.cn>
Date:   Fri Jun 12 00:17:38 2026 +0800

    posix-cpu-timers: Fix pid refcount leak in do_cpu_nanosleep() error path
    
    commit 87bd2ad568e15b90d5f7d4bcd70342d05dad649c upstream.
    
    In do_cpu_nanosleep(), posix_cpu_timer_create() takes a pid reference
    via get_pid() and stores it in timer.it.cpu.pid. If the subsequent
    posix_cpu_timer_set() call fails, the function returns immediately
    without calling posix_cpu_timer_del() to release the pid reference,
    causing a leak.
    
    Fix it by calling posix_cpu_timer_del() before the unlock-and-return
    on the error path, consistent with the other exit paths in the same
    function.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>
    Signed-off-by: Thomas Gleixner <tglx@kernel.org>
    Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20260611161738.97043-1-vulab@iscas.ac.cn
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
proc: protect ptrace_may_access() with exec_update_lock (FD links) [+ + +]
Author: Jann Horn <jannh@google.com>
Date:   Mon May 18 18:35:16 2026 +0200

    proc: protect ptrace_may_access() with exec_update_lock (FD links)
    
    commit 6255da28d4bb5349fe18e84cb043ccd394eba75d upstream.
    
    proc_pid_get_link() and proc_pid_readlink() currently look up the task from
    the pid once, then do the ptrace access check on that task, then look up
    the task from the pid a second time to do the actual access.
    That's racy in several ways.
    
    To fix it, pass the task to the ->proc_get_link() handler, and instead of
    proc_fd_access_allowed(), introduce a new helper call_proc_get_link() that
    looks up and locks the task, does the access check, and calls
    ->proc_get_link().
    
    Fixes: 778c1144771f ("[PATCH] proc: Use sane permission checks on the /proc/<pid>/fd/ symlinks")
    Cc: stable@vger.kernel.org
    Signed-off-by: Jann Horn <jannh@google.com>
    Link: https://patch.msgid.link/20260518-procfs-lockfix-part1-v1-2-5c3d20e0ac33@google.com
    Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

proc: protect ptrace_may_access() with exec_update_lock (part 1) [+ + +]
Author: Jann Horn <jannh@google.com>
Date:   Mon May 18 18:35:15 2026 +0200

    proc: protect ptrace_may_access() with exec_update_lock (part 1)
    
    commit 6650527444dadc63d84aa939d14ecba4fadb2f69 upstream.
    
    Fix the easy cases where procfs currently calls ptrace_may_access() without
    exec_update_lock protection, where the fix is to simply add the extra lock
    or use mm_access():
    
     - do_task_stat(): grab exec_update_lock
     - proc_pid_wchan(): grab exec_update_lock
     - proc_map_files_lookup(): use mm_access() instead of get_task_mm()
     - proc_map_files_readdir(): use mm_access() instead of get_task_mm()
     - proc_ns_get_link(): grab exec_update_lock
     - proc_ns_readlink(): grab exec_update_lock
    
    Fixes: f83ce3e6b02d ("proc: avoid information leaks to non-privileged processes")
    Cc: stable@vger.kernel.org
    Signed-off-by: Jann Horn <jannh@google.com>
    Link: https://patch.msgid.link/20260518-procfs-lockfix-part1-v1-1-5c3d20e0ac33@google.com
    Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
RDMA/core: Fix broadcast address falsely detected as local [+ + +]
Author: Maher Sanalla <msanalla@nvidia.com>
Date:   Tue Jun 9 14:16:38 2026 +0300

    RDMA/core: Fix broadcast address falsely detected as local
    
    commit 942cd47faa2047b46dfd85745603eba9006973e6 upstream.
    
    When rdma_resolve_addr() is invoked with a broadcast destination on an
    IPoIB interface, is_dst_local() inspects the resolved route and
    incorrectly concludes that the address is local. As a result, the
    resolution fails with -ENODEV.
    The issue stems from using '&' to compare rt_type with RTN_LOCAL. The
    RTN_* values form a sequential enum, not a bitmask (RTN_LOCAL=2,
    RTN_BROADCAST=3). Thus, "rt_type & RTN_LOCAL" yields a non-zero result
    for a broadcast route as well.
    
    Replace '&' with '==' when comparing rt_type against RTN_LOCAL.
    
    Link: https://patch.msgid.link/r/20260609-fix-rdma-resolve-addr-v1-1-449b8b4e6c09@nvidia.com
    Cc: stable@vger.kernel.org
    Fixes: c31e4038c97f ("RDMA/core: Use route entry flag to decide on loopback traffic")
    Signed-off-by: Maher Sanalla <msanalla@nvidia.com>
    Reviewed-by: Vlad Dumitrescu <vdumitrescu@nvidia.com>
    Signed-off-by: Edward Srouji <edwards@nvidia.com>
    Reviewed-by: Parav Pandit <parav@nvidia.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
RDMA/rtrs-srv: Bound RDMA-Write length to chunk size in rdma_write_sg [+ + +]
Author: Zhenhao Wan <whi4ed0g@gmail.com>
Date:   Fri Jun 12 01:15:54 2026 +0800

    RDMA/rtrs-srv: Bound RDMA-Write length to chunk size in rdma_write_sg
    
    commit 963af8d97a8c6a117134a8d0db1415e0489200b1 upstream.
    
    When the server answers an RTRS READ, rdma_write_sg() builds the source
    scatter/gather entry for the IB_WR_RDMA_WRITE that returns data to the
    peer. Its length is taken directly from the wire descriptor:
    
      plist->length = le32_to_cpu(id->rd_msg->desc[0].len);
    
    rd_msg points into the chunk buffer that the remote peer filled via
    RDMA-WRITE-WITH-IMM (rtrs_srv_rdma_done() -> process_io_req() ->
    process_read()), so desc[0].len is attacker-controlled and, before this
    change, was only rejected when zero. The source address is the fixed
    chunk start (dma_addr[msg_id]) and the source lkey is the PD-wide
    local_dma_lkey, which is not tied to the chunk's MR mapping, so the verbs
    layer does not constrain the transfer length to max_chunk_size. msg_id
    and off are bounded against queue_depth and max_chunk_size in
    rtrs_srv_rdma_done(), but desc[0].len is a separate field that was not
    checked against the chunk size.
    
    A peer that advertises desc[0].len larger than max_chunk_size can make
    the posted RDMA write read past the chunk's mapped region. The resulting
    behaviour depends on the IOMMU configuration: with no IOMMU or in
    passthrough mode the read may extend into memory adjacent to the chunk
    and be returned to the peer, which can disclose host memory; with a
    translating IOMMU the out-of-range access is expected to fault and abort
    the connection. In either case the transfer exceeds what the protocol
    permits and is driven by a remote peer.
    
    Reject a descriptor length above max_chunk_size, mirroring the existing
    off >= max_chunk_size bound in rtrs_srv_rdma_done(). Legitimate clients
    do not exceed it: the client sets desc[0].len to its MR length, which is
    capped at the negotiated max_io_size (max_chunk_size - MAX_HDR_SIZE).
    
    Fixes: 9cb837480424 ("RDMA/rtrs: server: main functionality")
    Link: https://patch.msgid.link/r/20260612-master-v1-1-70cde5c6fdc9@gmail.com
    Reported-by: Yuhao Jiang <danisjiang@gmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Zhenhao Wan <whi4ed0g@gmail.com>
    Reviewed-by: Md Haris Iqbal <haris.iqbal@ionos.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
RDMA/siw: bound Read Response placement to the RREAD length [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
Date:   Tue Jun 2 15:47:00 2026 -0400

    RDMA/siw: bound Read Response placement to the RREAD length
    
    commit 7d29f7e9dbd844cae4d3e559cf78324b9642fd6b upstream.
    
    In drivers/infiniband/sw/siw/siw_qp_rx.c, siw_proc_rresp() places each
    inbound Read Response DDP segment at sge->laddr + wqe->processed and then
    accumulates wqe->processed, but it never checks the running total against
    the sink buffer length on continuation segments. siw_check_sge() resolves
    and validates the sink memory only on the first fragment (the if (!*mem)
    branch), and siw_rresp_check_ntoh() compares the cumulative length against
    wqe->bytes only on the final segment (the !frx->more_ddp_segs guard).
    
    A connected siw peer that answers an outstanding RREAD with Read Response
    segments that keep the DDP Last flag clear, carrying more total payload
    than the RREAD requested, drives wqe->processed past the validated sink
    buffer; the next siw_rx_data() call writes out of bounds at
    sge->laddr + wqe->processed. siw runs iWARP over ordinary routable TCP,
    so the peer is the remote end of an established RDMA connection and needs
    no local privilege.
    
    Bound every segment before placement, exactly as siw_proc_send() and
    siw_proc_write() already do for their tagged and untagged paths, and
    terminate the connection with a base-or-bounds DDP error when the
    Read Response would overrun the sink buffer.
    
    This is the second receive-path length fix for this file. A separate
    change rejects an MPA FPDU length that underflows the per-fragment
    remainder in the header decode; that guard does not cover this case,
    because here each individual segment length is self-consistent and only
    the accumulated placement offset overruns the buffer.
    
    Fixes: 8b6a361b8c48 ("rdma/siw: receive path")
    Link: https://patch.msgid.link/r/20260602194700.2273758-1-michael.bommarito@gmail.com
    Cc: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
regulator: scmi: fix of_node refcount leak in scmi_regulator_probe() [+ + +]
Author: Wentao Liang <vulab@iscas.ac.cn>
Date:   Wed May 27 10:48:50 2026 +0000

    regulator: scmi: fix of_node refcount leak in scmi_regulator_probe()
    
    commit fa11039d6cdff84584a3ef8cc1f5e1b56e045da2 upstream.
    
    scmi_regulator_probe() calls of_find_node_by_name() which takes a
    reference on the returned device node. On the error path where
    process_scmi_regulator_of_node() fails, the function returns without
    calling of_node_put() on the child node, leaking the reference.
    
    Add of_node_put(np) on the error path to properly release the
    reference.
    
    Cc: stable@vger.kernel.org
    Fixes: 0fbeae70ee7c ("regulator: add SCMI driver")
    Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
    Link: https://patch.msgid.link/20260527104850.872415-1-vulab@iscas.ac.cn
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Revert "fuse: fix conversion of fuse_reverse_inval_entry() to start_removing()" [+ + +]
Author: Miklos Szeredi <mszeredi@redhat.com>
Date:   Wed Jun 10 12:57:21 2026 +0200

    Revert "fuse: fix conversion of fuse_reverse_inval_entry() to start_removing()"
    
    commit c12bbaf7c2d19325913ffd7002e580e63952d9e2 upstream.
    
    This reverts commit cab012375122304a6343c1ed09404e5143b9dc01.
    
    Commit c9ba789dad15 ("VFS: introduce start_creating_noperm() and
    start_removing_noperm()") caused a regression in FUSE_NOTIFY_INVAL_ENTRY,
    which failed to invalidate negative dentries.
    
    This manifests in the filesystem returning -ENOENT for operations on an
    existing file.
    
    Fixing it properly while still keeping the start_removing* infrastructure
    would add much additional complexity.
    
    Instead revert to the original simple implementation.
    
    The start_removing* infrastructure is needed in VFS to abstract the
    filesystem locking.  However filesystem code can still safely use the raw
    locking primitives without affacting other filesystems.
    
    This is part one of the revert.
    
    Reported-by: Артем Лабазов <123321artyom@gmail.com>
    Closes: https://lore.kernel.org/all/CAFbF8N7++zopZuEcsKRxBV_sgOGCbzCY0hOyMw1SiGAtuzGhyQ@mail.gmail.com/
    Fixes: c9ba789dad15 ("VFS: introduce start_creating_noperm() and start_removing_noperm()")
    Cc: stable@vger.kernel.org # 6.19
    Cc: NeilBrown <neilb@ownmail.net>
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Revert "svcrdma: Use contiguous pages for RDMA Read sink buffers" [+ + +]
Author: Chuck Lever <cel@kernel.org>
Date:   Sat Jun 6 22:24:56 2026 -0400

    Revert "svcrdma: Use contiguous pages for RDMA Read sink buffers"
    
    commit a39f0ce0c9da20986b429e2db3e4e8739035d61b upstream.
    
    Jonathan Flynn reports that commit 18755b8c2f24 ("svcrdma: Use
    contiguous pages for RDMA Read sink buffers") regresses NFS/RDMA
    WRITE throughput from 73.9 GiB/s to 30.3 GiB/s on a 128-core
    single-NUMA-node server driving dual 400Gb/s links with 640 nfsd
    threads. Server CPU utilization rises from 8.5% to 76%, with
    roughly three quarters of all cycles spent spinning on zone->lock.
    
    The sink buffers are allocated as high-order page blocks, split
    into single pages so each sub-page carries an independent refcount,
    and later released one page at a time through folio batches. The
    per-CPU page caches cannot satisfy an allocation stream whose alloc
    order differs from its free order, so every sink buffer page makes
    a round trip through the buddy allocator's free lists, serialized
    on the zone lock of the single NUMA node. The rq_pages entries that
    the split pages displace, bulk-allocated moments earlier by
    svc_alloc_arg(), are freed without ever being used, doubling the
    allocator traffic.
    
    The regression cannot be addressed trivially. Revert the commit
    now; a reworked approach can return in an upcoming merge window.
    
    Reported-by: Jonathan Flynn <jonathan.flynn@hammerspace.com>
    Reported-by: Mike Snitzer <snitzer@kernel.org>
    Closes: https://lore.kernel.org/linux-nfs/aiHlPmeZq3WgMwoJ@kernel.org/
    Closes: https://lore.kernel.org/linux-nfs/3cb119b4b2a8aada30c0c60286778a54@mail.gmail.com/
    Fixes: 18755b8c2f24 ("svcrdma: Use contiguous pages for RDMA Read sink buffers")
    Cc: stable@vger.kernel.org
    Tested-by: Jonathan Flynn <jonathan.flynn@hammerspace.com>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Revert "usb: typec: mux: avoid duplicated mux switches" [+ + +]
Author: Jens Glathe <jens.glathe@oldschoolsolutions.biz>
Date:   Sat May 30 10:20:22 2026 +0200

    Revert "usb: typec: mux: avoid duplicated mux switches"
    
    commit f576c75f95a52c71b30167d7efb6d47148f9c279 upstream.
    
    This reverts commit b145c3f29d62f71cc9d2d714e2d4ae4c8d3f863d.
    
    The deduplication logic appears to cause issues with separate
    SBU muxes. The mode-switch call on these (like gpio-sbu-mux)
    never appeared, so no successful mode-switch happened. The more
    high-end Parade PS883X redrivers are not affected due to being
    retimer-switch. The revert fixes dp altmode mode-switch for both.
    
    Tested on:
      Lenovo Thinkbook 16 G7 QOY
      Lenovo Ideapad 5 2in1 14Q8X9
      Microsoft Windows Dev Kit 2023 (Blackrock)
      Lenovo Thinkpad T14s G6
    
    Fixes: b145c3f29d62 ("usb: typec: mux: avoid duplicated mux switches")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Jens Glathe <jens.glathe@oldschoolsolutions.biz>
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Link: https://patch.msgid.link/20260530-typc-mux-modeset-v1-1-64b0281e2cd6@oldschoolsolutions.biz
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
riscv: dts: sophgo: Add dma-coherent to SG2042 PCIe controllers [+ + +]
Author: Han Gao <gaohan@iscas.ac.cn>
Date:   Wed Apr 1 01:12:48 2026 +0800

    riscv: dts: sophgo: Add dma-coherent to SG2042 PCIe controllers
    
    commit 2647eabde8de748ee2c9a2816615d4af3bd4bf9d upstream.
    
    SG2042's PCIe root complexes are cache-coherent with the CPU. Mark all
    four PCIe controller nodes (pcie_rc0 through pcie_rc3) as dma-coherent
    so the kernel uses coherent DMA mappings instead of non-coherent bounce
    buffering.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
    Link: https://patch.msgid.link/20260331171248.973014-3-gaohan@iscas.ac.cn
    Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
    Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

riscv: mm: Define DIRECT_MAP_PHYSMEM_END [+ + +]
Author: Vivian Wang <wangruikang@iscas.ac.cn>
Date:   Sat Jun 6 20:17:54 2026 -0600

    riscv: mm: Define DIRECT_MAP_PHYSMEM_END
    
    commit f3336b48cf9d3f2d1fc78e3289c0ded2f00876ee upstream.
    
    On RISC-V, the actual mappable range of physical address space is
    dependent on the current MMU mode i.e. satp_mode (See
    Documentation/arch/riscv/vm-layout.rst).
    
    Define the DIRECT_MAP_PHYSMEM_END macro based on the existing virtual
    address space layout macros to expose this information to
    get_free_mem_region(). Otherwise, it returns a region that couldn't be
    mapped, which breaks ZONE_DEVICE.
    
    Cc: stable@vger.kernel.org # v6.13+
    Tested-by: Han Gao <gaohan@iscas.ac.cn> # SG2044
    Signed-off-by: Vivian Wang <wangruikang@iscas.ac.cn>
    Link: https://patch.msgid.link/20260309-riscv-sparsemem-vmemmap-limits-v1-2-f40efe18e3cd@iscas.ac.cn
    Signed-off-by: Paul Walmsley <pjw@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

riscv: mm: Unconditionally sfence.vma for spurious fault [+ + +]
Author: Vivian Wang <wangruikang@iscas.ac.cn>
Date:   Tue Mar 3 13:29:49 2026 +0800

    riscv: mm: Unconditionally sfence.vma for spurious fault
    
    commit 1b2c6b56a9fa0dcbef461039937de22b1cbecc7d upstream.
    
    Svvptc does not guarantee that it's safe to just return here. Since we
    have already cleared our bit, if, theoretically, the bounded timeframe
    for the accessed page to become valid still hasn't happened after sret,
    we could fault again and actually crash.
    
    Hopefully, these spurious faults should be rare enough that this is an
    acceptable slowdown.
    
    Cc: stable@vger.kernel.org
    Fixes: 503638e0babf ("riscv: Stop emitting preventive sfence.vma for new vmalloc mappings")
    Signed-off-by: Vivian Wang <wangruikang@iscas.ac.cn>
    Link: https://patch.msgid.link/20260303-handle-kfence-protect-spurious-fault-v2-5-f80d8354d79d@iscas.ac.cn
    Signed-off-by: Paul Walmsley <pjw@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
rqspinlock: Fix order in raw_res_spin_(un)lock_irq to allow schedule [+ + +]
Author: Gabriele Monaco <gmonaco@redhat.com>
Date:   Wed Jun 10 11:04:29 2026 +0200

    rqspinlock: Fix order in raw_res_spin_(un)lock_irq to allow schedule
    
    commit b48bd16eb9fc57a463a337ca148516cdf3212d61 upstream.
    
    raw_res_spin_unlock_irqrestore() calls raw_res_spin_unlock() and then
    restores interrupts, this means preemption is enabled when interrupts
    are still disabled (as part of raw_res_spin_unlock()) so this cannot
    trigger an actual preemption.
    This is inconsistent with other spinlock implementations
    (raw_spin_unlock_irqrestore() and bpf_res_spin_unlock_irqrestore()
    itself).
    
    Adjust the macro to ensure interrupts are enabled before enabling
    preemption, allowing to schedule at that point. Make the same
    modification in the error path of raw_res_spin_lock_irqsave().
    
    Fixes: 101acd2e78b1 ("rqspinlock: Add macros for rqspinlock usage")
    Cc: stable@vger.kernel.org
    Acked-by: Arnd Bergmann <arnd@arndb.de> # asm-generic
    Acked-by: Waiman Long <longman@redhat.com>
    Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
    Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
    Link: https://lore.kernel.org/r/20260610090431.32427-1-gmonaco@redhat.com
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
rust: block: fix GenDisk cleanup paths [+ + +]
Author: Haoze Xie <royenheart@gmail.com>
Date:   Sat May 30 14:11:54 2026 +0800

    rust: block: fix GenDisk cleanup paths
    
    commit 2957771379fa335103a4b539db57bb2271e12142 upstream.
    
    GenDiskBuilder::build() still has fallible work after
    __blk_mq_alloc_disk(), but its error path only recovers the
    foreign queue data. That leaks the temporary gendisk and
    request_queue until later teardown. If the caller moved the last
    Arc<TagSet<T>> into build(), the leaked queue can retain blk-mq
    state after the tag set is dropped.
    
    Fix the pre-registration failure path by dropping the temporary
    gendisk reference with put_disk() before recovering queue_data,
    so disk_release() can tear down the owned queue.
    
    Also pair GenDisk::drop() with put_disk() after del_gendisk().
    Once a Rust GenDisk has been added with device_add_disk(),
    del_gendisk() only unregisters it; the final gendisk reference
    still has to be dropped to complete the release path.
    
    Fixes: 3253aba3408a ("rust: block: introduce `kernel::block::mq` module")
    Cc: stable@kernel.org
    Reported-by: Yuan Tan <yuantan098@gmail.com>
    Reported-by: Xin Liu <bird@lzu.edu.cn>
    Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org>
    Signed-off-by: Haoze Xie <royenheart@gmail.com>
    Signed-off-by: Ren Wei <n05ec@lzu.edu.cn>
    Link: https://patch.msgid.link/b70aff9a920cc42110fe5cf454c3099561863519.1780063368.git.royenheart@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

rust: cpufreq: clean new `clippy::map_or_identity` lint for Rust 1.98.0 [+ + +]
Author: Miguel Ojeda <ojeda@kernel.org>
Date:   Sat May 30 11:58:09 2026 +0200

    rust: cpufreq: clean new `clippy::map_or_identity` lint for Rust 1.98.0
    
    commit 3473e0a219fdb2cb013da0a5d917e66fef052325 upstream.
    
    Starting with Rust 1.98.0 (expected 2026-08-20), Clippy is likely
    introducing a new lint `clippy::map_or_identity` [1][2], which currently
    triggers in a single case:
    
        warning: expression can be simplified using `Result::unwrap_or()`
            --> rust/kernel/cpufreq.rs:1326:60
             |
        1326 |         PolicyCpu::from_cpu(cpu_id).map_or(0, |mut policy| T::get(&mut policy).map_or(0, |f| f))
             |                                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
             |
             = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_or_identity
             = note: `-W clippy::map-or-identity` implied by `-W clippy::all`
             = help: to override `-W clippy::all` add `#[allow(clippy::map_or_identity)]`
        help: consider using `unwrap_or`
             |
        1326 -         PolicyCpu::from_cpu(cpu_id).map_or(0, |mut policy| T::get(&mut policy).map_or(0, |f| f))
        1326 +         PolicyCpu::from_cpu(cpu_id).map_or(0, |mut policy| T::get(&mut policy).unwrap_or(0))
             |
    
    The suggestion is valid, thus clean it up.
    
    Cc: stable@vger.kernel.org # Needed in 6.18.y and later.
    Link: https://github.com/rust-lang/rust-clippy/issues/15801 [1]
    Link: https://github.com/rust-lang/rust-clippy/pull/16052 [2]
    Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
    Reviewed-by: Gary Guo <gary@garyguo.net>
    Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
    Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
    Link: https://patch.msgid.link/20260530095809.213611-1-ojeda@kernel.org
    Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

rust: doctest: fix incorrect pattern in replacement [+ + +]
Author: Gary Guo <gary@garyguo.net>
Date:   Tue Jun 16 14:25:56 2026 +0100

    rust: doctest: fix incorrect pattern in replacement
    
    commit ac4d1caa82d487e7ed46d0597da1adc9c1a51c70 upstream.
    
    The `-> Result<(), impl core::fmt::Debug>` string is generated by rustdoc
    and by adding "::" into the string it no longer finds anything, making
    the line useless.
    
    Remove the "::" in the pattern. Omit it in the replacement too, for
    consistency with upstream rustdoc.
    
    Fixes: de7cd3e4d638 ("rust: use absolute paths in macros referencing core and kernel")
    Signed-off-by: Gary Guo <gary@garyguo.net>
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20260616132559.2245814-1-gary@kernel.org
    [ Added link in code comment to `rustdoc`'s 1.87 PR that fully qualified
      it for context. Improved comments for consistency. Reworded to drop
      changelog and to fix typo. - Miguel ]
    Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

rust: kasan: KASAN+RUST requires clang [+ + +]
Author: Alice Ryhl <aliceryhl@google.com>
Date:   Wed Apr 8 08:32:16 2026 +0000

    rust: kasan: KASAN+RUST requires clang
    
    commit 5b271543d0f08e9733d4732721e960e285f6448f upstream.
    
    Kernel KASAN involves passing various llvm/gcc specific arguments to
    the C and Rust compiler. Since these arguments differ between llvm and
    gcc, it's not safe to mix an llvm-based rustc with a gcc build when
    kasan is enabled.
    
    Signed-off-by: Alice Ryhl <aliceryhl@google.com>
    Reviewed-by: Gary Guo <gary@garyguo.net>
    Cc: stable@vger.kernel.org
    Fixes: e3117404b411 ("kbuild: rust: Enable KASAN support")
    Link: https://patch.msgid.link/20260408-kasan-rust-sw-tags-v3-1-e07964d14363@google.com
    Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

rust: Kbuild: set frame-pointer llvm module flag for CONFIG_FRAME_POINTER [+ + +]
Author: Alice Ryhl <aliceryhl@google.com>
Date:   Tue Jun 16 12:30:38 2026 +0000

    rust: Kbuild: set frame-pointer llvm module flag for CONFIG_FRAME_POINTER
    
    commit 191f49f1e38b1c10eb44b0f967c6175c884ef7db upstream.
    
    Due to a rustc bug, the -Cforce-frame-pointers=y flag only emits the
    frame-pointer annotation for functions, but not for the module. This
    means that functions generated by the LLVM backend such as
    'asan.module_ctor' do not receive the frame-pointer annotation.
    
    This is likely to lead to broken backtraces and may also cause issues
    with ftrace if these features are used with functions generated by the
    LLVM backend.
    
    Thus, use -Zllvm_module_flag to work around this rustc bug if using a
    rustc without the fix.
    
    [ The fix [1] has landed for Rust 1.98.0 (expected release on
      2026-08-20). - Miguel ]
    
    Cc: stable@vger.kernel.org # 6.12.y and later (flag not available in pinned Rust in older LTSs).
    Fixes: 2f7ab1267dc9 ("Kbuild: add Rust support")
    Link: https://github.com/rust-lang/rust/pull/156980 [1]
    Signed-off-by: Alice Ryhl <aliceryhl@google.com>
    Link: https://patch.msgid.link/20260616-frame-ptr-fix-v1-1-dc6b29a631d9@google.com
    [ - Adjusted Cc: stable@ as discussed.
      - Added comment with link to the PR, similar to what we did in commit
        ac35b5580ace ("rust: arm64: set uwtable llvm module flag for
        CONFIG_UNWIND_TABLES").
        - Miguel ]
    Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

rust: pci: use 'static lifetime for PCI BAR resource names [+ + +]
Author: Danilo Krummrich <dakr@kernel.org>
Date:   Mon May 25 22:20:48 2026 +0200

    rust: pci: use 'static lifetime for PCI BAR resource names
    
    commit e566a9e17f3774c962b6d2522750f227f027edc6 upstream.
    
    pci_request_region() stores the name pointer directly in struct
    resource; use &'static CStr to ensure the pointer remains valid even if
    the Bar is leaked.
    
    Cc: stable@vger.kernel.org
    Reported-by: Sashiko <sashiko-bot@kernel.org>
    Closes: https://lore.kernel.org/all/20260522004943.CDA7C1F000E9@smtp.kernel.org/
    Fixes: 3c2e31d717ac ("rust: pci: move I/O infrastructure to separate file")
    Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
    Reviewed-by: Eliot Courtney <ecourtney@nvidia.com>
    Reviewed-by: Gary Guo <gary@garyguo.net>
    Link: https://patch.msgid.link/20260525202921.124698-2-dakr@kernel.org
    Signed-off-by: Danilo Krummrich <dakr@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

rust: str: clean unused import for Rust >= 1.98 [+ + +]
Author: Miguel Ojeda <ojeda@kernel.org>
Date:   Tue Jun 9 12:41:52 2026 +0200

    rust: str: clean unused import for Rust >= 1.98
    
    [ Upstream commit 3fff4271809b57182c4011811e96556bdd4cb2f9 ]
    
    Starting with Rust 1.98.0 (expected 2026-08-20), the compiler has changed
    how the resolution algorithm works [1] in upstream commit c4d84db5f184
    ("Resolver: Batched import resolution."), and it now spots:
    
        error: unused import: `flags::*`
         --> rust/kernel/str.rs:7:9
          |
        7 |         flags::*,
          |         ^^^^^^^^
          |
          = note: `-D unused-imports` implied by `-D warnings`
          = help: to override `-D warnings` add `#[allow(unused_imports)]`
    
    It happens to not be needed because the `prelude::*` already provides
    the flags.
    
    Thus clean it up.
    
    Cc: stable@vger.kernel.org # Needed in 6.18.y and later (prelude added to `str`).
    Link: https://github.com/rust-lang/rust/pull/145108 [1]
    Reviewed-by: Gary Guo <gary@garyguo.net>
    Reviewed-by: Alice Ryhl <aliceryhl@google.com>
    Link: https://patch.msgid.link/20260609104152.261145-2-ojeda@kernel.org
    Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

rust: str: use the "kernel vertical" imports style [+ + +]
Author: Miguel Ojeda <ojeda@kernel.org>
Date:   Tue Jun 9 12:41:51 2026 +0200

    rust: str: use the "kernel vertical" imports style
    
    [ Upstream commit 724a93a9f6033800b02a3530dbcb464638448e7f ]
    
    Convert the imports to use the "kernel vertical" imports style [1].
    
    No functional changes intended.
    
    Link: https://docs.kernel.org/rust/coding-guidelines.html#imports [1]
    Reviewed-by: Gary Guo <gary@garyguo.net>
    Link: https://patch.msgid.link/20260609104152.261145-1-ojeda@kernel.org
    Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
    Stable-dep-of: 3fff4271809b ("rust: str: clean unused import for Rust >= 1.98")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
 
rust_binder: clear freeze listener on node removal [+ + +]
Author: Alice Ryhl <aliceryhl@google.com>
Date:   Fri Jul 3 11:25:12 2026 +0000

    rust_binder: clear freeze listener on node removal
    
    commit bc4a9828897871ff3e5a1f8a1d346decbf4ee95e upstream.
    
    Generally userspace is supposed to explicitly clear freeze listeners
    before they drop the refcount on the node ref to zero, but there's
    nothing forcing that. Currently, in this scenario the freeze listener
    remains in the freeze_listeners rbtree and in the remote node's freeze
    listener list, even though the ref for which the listener is registered
    is gone. This could potentially lead to a memory leak due to a refcount
    cycle. Thus, remove the freeze listener in this scenario.
    
    Cc: stable <stable@kernel.org>
    Fixes: eafedbc7c050 ("rust_binder: add Rust Binder driver")
    Signed-off-by: Alice Ryhl <aliceryhl@google.com>
    Link: https://patch.msgid.link/20260703-remove-freeze-on-remove-node-v3-1-6e0c4547af46@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

rust_binder: fix BINDER_GET_EXTENDED_ERROR [+ + +]
Author: Alice Ryhl <aliceryhl@google.com>
Date:   Fri Jun 5 11:13:50 2026 +0000

    rust_binder: fix BINDER_GET_EXTENDED_ERROR
    
    commit 77bfebf110773f5a0d6b5ff8110896adb2c9c335 upstream.
    
    This code currently copies the ExtendedError struct to the stack,
    modifies the copy, and then doesn't modify the original. Thus, fix it.
    
    Furthermore, errors when replying must be delivered directly to the
    remote thread, so update deliver_reply() to take an extended error
    argument.
    
    Cc: stable <stable@kernel.org>
    Fixes: eafedbc7c050 ("rust_binder: add Rust Binder driver")
    Signed-off-by: Alice Ryhl <aliceryhl@google.com>
    Acked-by: Carlos Llamas <cmllamas@google.com>
    Link: https://patch.msgid.link/20260605-set-extended-error-v3-1-d60b69a75f97@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

rust_binder: reject context manager self-transaction [+ + +]
Author: Keshav Verma <iganschel@gmail.com>
Date:   Thu Jun 25 16:09:57 2026 +0530

    rust_binder: reject context manager self-transaction
    
    commit 6849cabfd30fb5727cfd31e8241e15801e17ebf9 upstream.
    
    Rust binder resolved handle 0 to the context manager node, but it does not
    reject the case where the caller owns the same node.
    
    The C binder driver rejects transactions from the context-manager process
    to handle 0 after resolving the target node. Match that behavior in Rust
    Binder by rejecting handle 0 transactions when the resolved context-manager
    node is owned by the calling process.
    
    This applies to both synchronous and oneway transactions because both paths
    resolve the target through Process::get_transaction_node().
    
    Cc: stable <stable@kernel.org>
    Fixes: eafedbc7c050 ("rust_binder: add Rust Binder driver")
    Signed-off-by: Keshav Verma <iganschel@gmail.com>
    Reviewed-by: Alice Ryhl <aliceryhl@google.com>
    Link: https://patch.msgid.link/20260625103957.730-1-iganschel@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

rust_binder: synchronize Rust Binder stats with freeze commands [+ + +]
Author: Keshav Verma <iganschel@gmail.com>
Date:   Tue Jun 16 02:47:43 2026 +0530

    rust_binder: synchronize Rust Binder stats with freeze commands
    
    commit eb1645bf10190e71f6f0316e37ff70755d719b53 upstream.
    
    Rust Binder stats use BC_COUNT and BR_COUNT to size the command and
    return counters, and use event string tables when printing debug
    statistics.
    
    The Binder protocol includes freeze-related commands and return codes,
    but the Rust Binder statistics code was not updated to cover them. As a
    result, those commands and return codes are not accounted for or printed
    by the stats debug output.
    
    Update the counts and event string tables so these commands and return
    codes are included in the debug statistics output.
    
    Fixes: eafedbc7c050 ("rust_binder: add Rust Binder driver")
    Cc: stable <stable@kernel.org>
    Acked-by: Carlos Llamas <cmllamas@google.com>
    Reviewed-by: Alice Ryhl <aliceryhl@google.com>
    Signed-off-by: Keshav Verma <iganschel@gmail.com>
    Link: https://patch.msgid.link/20260615211743.734-1-iganschel@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

rust_binder: use a u64 stride when cleaning up the offsets array [+ + +]
Author: Hyunwoo Kim <imv4bel@gmail.com>
Date:   Sun May 31 22:29:24 2026 +0900

    rust_binder: use a u64 stride when cleaning up the offsets array
    
    commit 803c8a9502e9b97cd6ae937618ef4a8fd6274343 upstream.
    
    Allocation's Drop walks the offsets array (binder_size_t = u64 entries),
    cleaning up the objects, but it used usize instead of u64 for both the
    stride and the per-entry read.
    
    On 64-bit kernels (usize == u64) this is harmless, but on 32-bit kernels
    it walks the 8-byte entries in 4-byte steps, iterating an N-entry array
    2N times, and reads the always-zero high word as offset 0, cleaning up
    the object at offset 0 N extra times. As a result the referenced node or
    handle ends up with a lower reference count than it actually has (a
    refcount over-decrement), and binder's reference accounting is corrupted;
    for example, the owner can be notified of a strong reference release
    (BR_RELEASE) even though references still remain.
    
    Change the stride to u64, and read each entry as a u64, narrowing it to
    usize with try_into().
    
    On 32-bit ARM, when this over-decrement would drive a count below zero,
    the driver's existing refcount guard refuses it and fires:
    
      rust_binder: Failure: refcount underflow!
    
    Cc: stable <stable@kernel.org>
    Fixes: eafedbc7c050 ("rust_binder: add Rust Binder driver")
    Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
    Acked-by: Carlos Llamas <cmllamas@google.com>
    Reviewed-by: Alice Ryhl <aliceryhl@google.com>
    Link: https://patch.msgid.link/ahw3tFhLz9bMMJAO@v4bel
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
s390: Revert support for DCACHE_WORD_ACCESS [+ + +]
Author: Heiko Carstens <hca@linux.ibm.com>
Date:   Thu Jun 11 17:37:46 2026 +0200

    s390: Revert support for DCACHE_WORD_ACCESS
    
    commit 37540b8c287fc817bdbd0c62bb75ad6eab0e5d03 upstream.
    
    load_unaligned_zeropad() reads eight bytes from unaligned addresses and may
    cross page boundaries. It handles exceptions which may happen if reading
    from the second page results in an exception.
    
    For pages which are donated to the Ultravisor for secure execution purposes
    the do_secure_storage_access() exception handler however does not handle
    such exceptions correctly. Such an exception may result in an endless
    exception loop which will never be resolved.
    
    An attempt to fix this [1] turned out to be not sufficient. For now revert
    load_unaligned_zeropad() until this problem has been resolved in a proper
    way.
    
    Note that the implementation of load_unaligned_zeropad() itself is
    correct. The revert is just a temporary workaround until there is complete
    fix for secure storage access exceptions.
    
    [1] commit b00be77302d7 ("s390/mm: Add missing secure storage access fixups for donated memory")
    
    Fixes: 802ba53eefc5 ("s390: add support for DCACHE_WORD_ACCESS")
    Cc: stable@vger.kernel.org
    Acked-by: Christian Borntraeger <borntraeger@linux.ibm.com>
    Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
    Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
sched/rt: Have RT_PUSH_IPI be default off for non PREEMPT_RT [+ + +]
Author: Steven Rostedt <rostedt@goodmis.org>
Date:   Fri May 15 10:37:40 2026 -0400

    sched/rt: Have RT_PUSH_IPI be default off for non PREEMPT_RT
    
    commit dd29c017aed628076e915fe4cdfb5392fd4c5cab upstream.
    
    RT migration is done aggressively. When a CPU schedules out a high
    priority RT task for a lower priority task, it will look to see if there's
    any RT tasks that are waiting to run on another CPU that is of higher
    priority than the task this CPU is about to run. If it finds one, it will
    pull that task over to the CPU and allow it to run there instead.
    
    Normally, this pulling is done by looking at the RT overloaded mask (rto)
    which contains all the CPUs in the scheduler domain with RT tasks that are
    waiting to run due to a higher priority RT task currently running on their
    CPU. The CPU that is about to schedule a lower priority task will grab the
    rq lock of the overloaded CPU and move the RT task from that CPU's runqueue
    to the local one and schedule the higher priority RT task.
    
    This caused issues when a lot of CPUs would schedule a lower priority task
    at the same time. They would all try to grab the same runqueue lock of
    the CPU with the overloaded RT tasks. Only the first CPU that got in will
    get that task. All the others would wait until they got the runqueue lock
    and see there's nothing to pull and do nothing. On systems with lots of
    CPUs, this caused a large latency (up to 500us) which is beyond what
    PREEMPT_RT is to allow.
    
    The solution to that was to create an RT_PUSH_IPI logic. When any CPU
    wanted to pull a task, instead of grabbing the runqueue lock of the
    overloaded CPU, it would start by sending an IPI to the overloaded CPU,
    and that IPI handler would have the CPU with the waiting RT task do a push
    instead. Then that handler would send an IPI to the next CPU with
    overloaded RT tasks, and so on. Note, after the first CPU starts this
    process, if another CPU wanted to do a pull, it would see that the process
    has already begun and would only increment a counter to have the IPIs
    continue again.
    
    The RT_PUSH_IPI solved the latency problem with PREEMPT_RT but could cause
    a new issue with non PREEMPT_RT. Namely, softirqs run in a threaded
    context on PREEMPT_RT but they can run in an interrupt context in non-RT.
    
    If an IPI lands on a CPU that has just woken up multiple RT tasks and the
    current CPU is running a non RT or a low priority RT task, instead of
    doing a push, it would simply do a schedule on that CPU. But if a softirq
    was also executing on this CPU, the schedule would need to wait until the
    softirq finished. Until then, the CPU would still be considered overloaded
    as there are RT tasks still waiting to run on it.
    
    A live lock occurred on a workload that was doing heavy networking traffic
    on a large machine where the softirqs would run 500us out of 750us. And it
    would also be waking up RT tasks, causing the RT pull logic to be
    constantly executed.
    
    When a softirq triggered on a CPU with RT tasks queued but not running
    yet, and the other CPUs would see this CPU as being overloaded, they would
    send an IPI over to it. The CPU would notice that the waiting RT tasks are
    of higher priority than the currently running task and simply schedule
    that CPU instead. But because the softirq was executing, before it could
    schedule, it would receive another IPI to do the same. The amount of IPIs
    would slow down the currently running softirq so much that before it could
    return back to task context, it would execute another softirq never
    allowing the CPU to schedule. This live locked that CPU.
    
    As RT_PUSH_IPI was created to help PREEMPT_RT, make it default off if
    PREEMPT_RT is not enabled.
    
    Fixes: b6366f048e0c ("sched/rt: Use IPI to trigger RT task push migration instead of pulling")
    Closes: https://lore.kernel.org/all/20260506235716.2530720-1-tj@kernel.org/
    Reported-by: Tejun Heo <tj@kernel.org>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20260515103740.25ccbed8@gandalf.local.home
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
selftests/landlock: Explicitly disable audit in teardowns [+ + +]
Author: Maximilian Heyne <mheyne@amazon.de>
Date:   Fri May 29 20:03:41 2026 +0000

    selftests/landlock: Explicitly disable audit in teardowns
    
    commit 0302cd72fe196aee933e3fb76f6d175d1ab0e843 upstream.
    
    I'm seeing sporadic selftest failures, such as
    
      #  RUN           scoped_audit.connect_to_child ...
      # scoped_abstract_unix_test.c:314:connect_to_child:Expected 0 (0) == records.access (8)
      # connect_to_child: Test failed
      #          FAIL  scoped_audit.connect_to_child
      not ok 19 scoped_audit.connect_to_child
    
    This seems similar to what commit 3647a4977fb73d ("selftests/landlock:
    Drain stale audit records on init") tried to fix. However, the added
    drain loop is not effective. When setting the AUDIT_STATUS_PID, the
    kauditd_thread is woken up starting to send messages from the hold queue
    to the netlink. Depending on scheduling of this kthread not all messages
    might be send via the netlink in the 1 us interval.
    
    Therefore, instead of trying to drain the queue, let's just disable
    audit when running non-audit tests or more precisely disable it after
    audit-tests. This way we won't generate any new audit message that could
    interfere with the other tests.
    
    The comment saying that on process exit audit will be disabled is wrong.
    The closed file descriptor just causes an auditd_reset(), not a
    disablement. So future messages will be queued in the hold queue.
    
    Cc: stable@vger.kernel.org
    Fixes: 6a500b22971c ("selftests/landlock: Add tests for audit flags and domain IDs")
    Signed-off-by: Maximilian Heyne <mheyne@amazon.de>
    Link: https://patch.msgid.link/20260529-welsh-nagoya-b4d9ca60@mheyne-amazon
    [mic: Fix FD leak, update subject, call audit_cleanup() in audit_exec teardown]
    Signed-off-by: Mickaël Salaün <mic@digikod.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

selftests/landlock: Filter dealloc records in audit_count_records() [+ + +]
Author: Mickaël Salaün <mic@digikod.net>
Date:   Wed May 13 12:51:08 2026 +0200

    selftests/landlock: Filter dealloc records in audit_count_records()
    
    commit 26679fad81a471428707d2dd7b0418204c52b7e4 upstream.
    
    audit_count_records() counts both AUDIT_LANDLOCK_DOMAIN allocation and
    deallocation records in records.domain .  Domain deallocation is tied to
    asynchronous credential freeing via kworker threads
    (landlock_put_ruleset_deferred), so the dealloc record can arrive after
    the drain in audit_init() and after the preceding audit_match_record()
    call.  This causes flaky failures in tests that assert an exact
    records.domain count: a stale dealloc record from a previous test's
    domain inflates the count by one.
    
    Observed on x86_64 under build configurations that delay the kworker
    firing the dealloc callback (e.g. coverage instrumentation): the
    audit_layout1 tests in fs_test.c intermittently saw records.domain == 2
    where 1 was expected.  The fix is in the shared helper, so those
    existing checks become robust without needing a fs_test.c edit.
    
    Filter audit_count_records() with a regex to skip records containing
    deallocation status.  The remaining domain records (allocation, emitted
    synchronously during landlock_log_denial()) are deterministic.
    Deallocation records are already tested explicitly via
    matches_log_domain_deallocated() in audit_test.c, which uses its own
    domain-ID-based filtering and longer timeout.
    
    With this filter in place, re-add the records.domain == 0 checks that
    were removed in commit 3647a4977fb7 ("selftests/landlock: Drain stale
    audit records on init") as a workaround for this race.
    
    Cc: Günther Noack <gnoack@google.com>
    Cc: stable@vger.kernel.org
    Depends-on: 07c2572a8757 ("selftests/landlock: Skip stale records in audit_match_record()")
    Fixes: 6a500b22971c ("selftests/landlock: Add tests for audit flags and domain IDs")
    Tested-by: Günther Noack <gnoack3000@gmail.com>
    Link: https://patch.msgid.link/20260513105112.140137-1-mic@digikod.net
    Signed-off-by: Mickaël Salaün <mic@digikod.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

selftests/landlock: Increase default audit socket timeout [+ + +]
Author: Mickaël Salaün <mic@digikod.net>
Date:   Wed May 13 12:51:09 2026 +0200

    selftests/landlock: Increase default audit socket timeout
    
    commit d8dfb4c7faa87c3e41a8678f38f136c2c7c036fa upstream.
    
    matches_log_fs() and other audit_match_record() callers intermittently
    return -EAGAIN under heavy debug configs (KASAN, lockdep).  The audit
    record delivery pipeline is asynchronous: landlock_log_denial() queues
    the record to audit_queue, and kauditd_thread dequeues and delivers via
    netlink.  Under debug configs, kauditd scheduling between
    audit_log_end() and netlink_unicast() can exceed a syscall round trip
    (more than 1 usec), which was the value of the socket timeout used for
    the recvfrom() calls.
    
    The observed failure [1] is an EAGAIN error code (-11) which means that
    the access record had not arrived within the 1 usec timeout of
    recvfrom().  The expected record does arrive, but only after
    matches_log_fs() has already returned.  It is then consumed by a later
    audit_count_records() call, making records.access == 1 instead of 0.
    
    Switch the default socket timeout to the slow value (1 second) so all
    audit_match_record() callers wait long enough for kauditd delivery, and
    lower it to the fast value (1 usec) only on the two paths that expect no
    record: audit_count_records() and the expected_domain_id == 0 probe in
    matches_log_domain_deallocated().  audit_init() drains stale records
    with the fast timeout (terminating on -EAGAIN once the backlog is empty)
    and switches to the patient default before returning.  1 second gives
    ~10x margin over the observed maximum (~100 ms, while the happy path is
    ~23 us).
    
    Rename the timeval constants to reflect their new roles:
    - audit_tv_dom_drop (1 second) -> audit_tv_default: default socket
      timeout, patient enough for asynchronous kauditd delivery.
    - audit_tv_default (1 usec) -> audit_tv_fast: fast timeout for paths
      that expect no record (drain, audit_count_records(), probes).
    
    Invert the conditional in matches_log_domain_deallocated().  Check
    setsockopt returns on both the lower and restore paths; preserve the
    first error via !err when the restore fails after a prior error so the
    actionable return code is not masked by a bookkeeping failure.
    
    Cc: Günther Noack <gnoack@google.com>
    Cc: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
    Cc: stable@vger.kernel.org
    Depends-on: 07c2572a8757 ("selftests/landlock: Skip stale records in audit_match_record()")
    Fixes: 6a500b22971c ("selftests/landlock: Add tests for audit flags and domain IDs")
    Reported-by: Günther Noack <gnoack3000@gmail.com>
    Closes: https://lore.kernel.org/r/20260402.eb5c4e85f472@gnoack.org [1]
    Reported-by: kernel test robot <oliver.sang@intel.com>
    Closes: https://lore.kernel.org/oe-lkp/202605111649.a8b30a62-lkp@intel.com
    Closes: https://lore.kernel.org/oe-lkp/202604300436.a07fae12-lkp@intel.com
    Tested-by: Günther Noack <gnoack3000@gmail.com>
    Link: https://patch.msgid.link/20260513105112.140137-2-mic@digikod.net
    Signed-off-by: Mickaël Salaün <mic@digikod.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
selftests/liveupdate: add test cases for LIVEUPDATE_IOCTL_CREATE_SESSION calls with invalid length [+ + +]
Author: Luca Boccassi <luca.boccassi@gmail.com>
Date:   Wed Apr 29 22:21:15 2026 +0100

    selftests/liveupdate: add test cases for LIVEUPDATE_IOCTL_CREATE_SESSION calls with invalid length
    
    commit dab2b4c66aa0f44ccb6a0096906e5680c604fe39 upstream.
    
    Verify that LIVEUPDATE_IOCTL_CREATE_SESSION ioctl which provide a name
    that is an empty string or too long are not allowed.
    
    Cc: stable@vger.kernel.org
    
    Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
    Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com>
    Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
    Link: https://lore.kernel.org/r/20260429212221.814107-3-luca.boccassi@gmail.com
    Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
    Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
selftests/mm: fix ksft_process_madv.sh test category [+ + +]
Author: Sarthak Sharma <sarthak.sharma@arm.com>
Date:   Mon Jun 8 16:02:24 2026 +0530

    selftests/mm: fix ksft_process_madv.sh test category
    
    commit 4b0363cb1f3ec42b0b1346e5ab0b8a3dceeee9be upstream.
    
    ksft_process_madv.sh currently runs run_vmtests.sh with the mmap category.
    Update it to run the process_madv category, since ksft_mmap.sh already
    runs the mmap category tests.
    
    This avoids running mmap tests twice and ensures that process_madv tests
    are run through the kselftest harness.
    
    Link: https://lore.kernel.org/20260608103224.344101-1-sarthak.sharma@arm.com
    Fixes: 6ce964c02f1c ("selftests/mm: have the harness run each test category separately")
    Signed-off-by: Sarthak Sharma <sarthak.sharma@arm.com>
    Reviewed-by: Mark Brown <broonie@kernel.org>
    Reviewed-by: Dev Jain <dev.jain@arm.com>
    Acked-by: David Hildenbrand (Arm) <david@kernel.org>
    Cc: Liam R. Howlett <liam@infradead.org>
    Cc: Lorenzo Stoakes <ljs@kernel.org>
    Cc: Mark Brown <broonie@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/mm: pagemap_ioctl: use the correct page size for transact_test() [+ + +]
Author: Zenghui Yu <zenghui.yu@linux.dev>
Date:   Sun Jun 28 18:11:18 2026 +0800

    selftests/mm: pagemap_ioctl: use the correct page size for transact_test()
    
    commit dccf636bf1e68c3fda92f0c9e1018ab7e0ac8b2c upstream.
    
    There are several places in transact_test() where we use the hardcoded
    0x1000 (4k) as page size, which is not always correct for architectures
    supporting multiple page sizes.
    
    Switch to use the correct page size.  Otherwise ./ksft_pagemap.sh on a
    16k-page-size arm64 box fails with
    
     $ ./ksft_pagemap.sh
     [...]
     # ok 96 mprotect_tests Both pages written after remap and mprotect
     # ok 97 mprotect_tests Clear and make the pages written
     # Bail out! ioctl failed
     # # Planned tests != run tests (117 != 97)
     # # Totals: pass:97 fail:0 xfail:0 xpass:0 skip:0 error:0
     # [FAIL]
     not ok 1 pagemap_ioctl # exit=1
     # SUMMARY: PASS=0 SKIP=0 FAIL=1
     1..1
    
    Link: https://lore.kernel.org/20260628101118.35861-1-zenghui.yu@linux.dev
    Fixes: 46fd75d4a3c9 ("selftests: mm: add pagemap ioctl tests")
    Signed-off-by: Zenghui Yu <zenghui.yu@linux.dev>
    Cc: Muhammad Usama Anjum <usama.anjum@arm.com>
    Cc: David Hildenbrand <david@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: Zenghui Yu <zenghui.yu@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>

 
selftests: mm: fix and speedup "droppable" test [+ + +]
Author: David Hildenbrand (Arm) <david@kernel.org>
Date:   Thu Jun 11 12:01:55 2026 +0200

    selftests: mm: fix and speedup "droppable" test
    
    commit cc13a7a618fe8354f16d74c06aaf9565a68e9ebd upstream.
    
    The droppable test currently relies on creating memory pressure in a child
    process to trigger dropping the droppable pages.
    
    That not only takes a long time on some machines (allocating and filling
    all that memory), on large machines this will not work as we hardcode the
    area size to 134217728 bytes.
    
    ...  further, we rely on timeouts to detect that memory was not dropped,
    which is really suboptimal.
    
    Instead, let's just use MADV_PAGEOUT on a 2 MiB region.  MADV_PAGEOUT
    works with droppable memory even without swap.
    
    There is the low chance of MADV_PAGEOUT failing to drop a page because of
    speculative references.  We'll wait 1s and retry 10 times to rule that
    unlikely case out as best as we can.
    
    On a machine without swap:
    
            $ ./droppable
            TAP version 13
            1..1
            ok 1 madvise(MADV_PAGEOUT) behavior
            # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
    
    Link: https://lore.kernel.org/20260611-droppable_test-v1-1-b6a73d99f658@kernel.org
    Fixes: 9651fcedf7b9 ("mm: add MAP_DROPPABLE for designating always lazily freeable mappings")
    Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
    Reported-by: Aishwarya TCV <Aishwarya.TCV@arm.com>
    Tested-by: Sarthak Sharma <sarthak.sharma@arm.com>
    Tested-by: Lance Yang <lance.yang@linux.dev>
    Reviewed-by: Dev Jain <dev.jain@arm.com>
    Reviewed-by: SeongJae Park <sj@kernel.org>
    Tested-by: Lorenzo Stoakes <ljs@kernel.org>
    Reviewed-by: Lorenzo Stoakes <ljs@kernel.org>
    Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
    Cc: Anthony Yznaga <anthony.yznaga@oracle.com>
    Cc: Liam R. Howlett <liam@infradead.org>
    Cc: Mark Brown <broonie@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>

 
serial: 8250_mid: Disable DMA for selected platforms [+ + +]
Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date:   Fri Jun 26 11:49:37 2026 +0200

    serial: 8250_mid: Disable DMA for selected platforms
    
    commit b1b4efea05a56c0995e4702a86d6624b4fdff32f upstream.
    
    In accordance with Errata (specification updates)
    HSUART May Stop Functioning when DMA is Active.
    
    - Denverton document #572409, rev 3.4, DNV60
    - Ice Lake Xeon D document #714070, ICXD65
    - Snowridge document #731931, SNR44
    
    For a quick fix just disable the respective callbacks during the device probe.
    Depending on the future development we might remove them completely.
    
    Reported-by: micas-opensource <zjianan156@gmail.com>
    Closes: https://lore.kernel.org/linux-serial/20250625031409.2404219-1-opensource@ruijie.com.cn/
    Fixes: 6ede6dcd87aa ("serial: 8250_mid: add support for DMA engine handling from UART MMIO")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Link: https://patch.msgid.link/20260626094937.561776-1-andriy.shevchenko@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
slab: recognize @GFP parameter as optional in kernel-doc [+ + +]
Author: Randy Dunlap <rdunlap@infradead.org>
Date:   Wed Jun 17 09:31:25 2026 -0700

    slab: recognize @GFP parameter as optional in kernel-doc
    
    commit 7b5f5865fb11e60edd03c5e063e2d228b7062317 upstream.
    
    Since the @GFP parameter in kmalloc_obj() etc. is now optional, change
    the kernel-doc to indicate that it is optional. This avoids kernel-doc
    warnings:
    
    WARNING: include/linux/slab.h:1101 Excess function parameter 'GFP' description in 'kmalloc_obj'
    WARNING: include/linux/slab.h:1113 Excess function parameter 'GFP' description in 'kmalloc_objs'
    WARNING: include/linux/slab.h:1128 Excess function parameter 'GFP' description in 'kmalloc_flex'
    
    Fixes: e19e1b480ac7 ("add default_gfp() helper macro and use it in the new *alloc_obj() helpers")
    Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
    Acked-by: Harry Yoo (Oracle) <harry@kernel.org>
    Link: https://patch.msgid.link/20260617163125.2716279-1-rdunlap@infradead.org
    Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
    Signed-off-by: Eric Biggers <ebiggers@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
smb/client: fix chown/chgrp with SMB3 POSIX Extensions [+ + +]
Author: Ralph Boehme <slow@samba.org>
Date:   Sun Jun 7 15:23:18 2026 +0200

    smb/client: fix chown/chgrp with SMB3 POSIX Extensions
    
    commit 760ef2c579c2609cf17fb1cd5392f64d42d43d33 upstream.
    
    Ownership (chown) and group (chgrp) modifications were being ignored when
    mounting with SMB3 POSIX Extensions unless CIFS_MOUNT_CIFS_ACL or
    CIFS_MOUNT_MODE_FROM_SID were also explicitly set.
    
    Fix this by checking for posix_extensions in cifs_setattr_nounix() when
    updating UID and GID, ensuring that id_mode_to_cifs_acl() is called to map
    and set the ownership/group information on the server.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Ralph Boehme <slow@samba.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

smb/client: Fix error code in smb2_aead_req_alloc() [+ + +]
Author: Dan Carpenter <error27@gmail.com>
Date:   Thu Jun 11 10:35:28 2026 +0300

    smb/client: Fix error code in smb2_aead_req_alloc()
    
    commit 61f28012e5650c619223decdb7970e0d3162e949 upstream.
    
    The "*num_sgs" variable is a u32 so "ERR_PTR(*num_sgs)" doesn't work.
    We would have to do something similar to the previous line where it's
    cast to int and then long.  However, it's simpler to store the return in
    an int ret variable.
    
    This bug would eventually result in a crash when dereference the invalid
    error pointer.
    
    Fixes: d08089f649a0 ("cifs: Change the I/O paths to use an iterator rather than a page list")
    Cc: stable@kernel.org
    Signed-off-by: Dan Carpenter <error27@gmail.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
smb/server: do not require delete access for non-replacing links [+ + +]
Author: ChenXiaoSong <chenxiaosong@kylinos.cn>
Date:   Sun Jun 28 07:42:43 2026 +0000

    smb/server: do not require delete access for non-replacing links
    
    commit 851ed9e09639e0daf79a506ce26097b296ed5518 upstream.
    
    Reproducer:
    
      1. server: systemctl start ksmbd
      2. client: mount -t cifs //${server_ip}/export /mnt
      3. client: touch /mnt/file; ln /mnt/file /mnt/hardlink
      4. client err log: ln: failed to create hard link 'hardlink' =>
         'file': Permission denied
      5. server err log: ksmbd: no right to delete : 0x80
    
    Fixes: 13f3942f2bf4 ("ksmbd: add per-handle permission check to FILE_LINK_INFORMATION")
    Cc: stable@vger.kernel.org
    Reported-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
    Acked-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
smb: client: fix atime clamp check in read completion [+ + +]
Author: Xu Rao <raoxu@uniontech.com>
Date:   Tue Jul 7 21:30:17 2026 +0800

    smb: client: fix atime clamp check in read completion
    
    commit 0b043279e73880bee21d3b1f221bafda5af1b27e upstream.
    
    cifs_rreq_done() updates the inode atime to current_time(inode) after a
    netfs read.  It then preserves the CIFS rule that atime should not be
    older than mtime, because some applications break if atime is less than
    mtime.  That rule only requires clamping when atime < mtime.
    
    The current check uses the raw non-zero result of timespec64_compare().
    It therefore takes the clamp path for both atime < mtime and
    atime > mtime.  The latter is the normal case when reading an older file:
    the newly recorded atime is newer than the file mtime.  The completion
    handler then immediately moves atime back to mtime, losing the access
    time that was just recorded.  Userspace tools that rely on atime, such as
    stat, find -atime, backup tools or cold-data classifiers, can therefore
    see a recently read CIFS file as not recently accessed.
    
    This is easy to miss because the bug is silent: read I/O still succeeds,
    no error is reported, and many systems either do not check atime after
    reads or mount with policies such as relatime/noatime.  It becomes
    visible when a CIFS file has an mtime older than the current time, the
    file is read, and the local inode atime is inspected before a later
    revalidation replaces the cached timestamps.
    
    Clamp only when atime is actually older than mtime.  This matches the
    same atime/mtime rule used when applying CIFS inode attributes.
    
    Fixes: 69c3c023af25 ("cifs: Implement netfslib hooks")
    Cc: stable@vger.kernel.org
    Signed-off-by: Xu Rao <raoxu@uniontech.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

smb: client: fix change notify replay double-free [+ + +]
Author: Henrique Carvalho <henrique.carvalho@suse.com>
Date:   Thu Jun 18 17:34:37 2026 -0300

    smb: client: fix change notify replay double-free
    
    commit 145f820dcbb2cced374f2532f8a61a44dce4a615 upstream.
    
    A response-bearing attempt can return a replayable error and free its
    response buffer. If SMB2_notify_init() fails before the next send, cleanup
    retains the previous buffer type and frees that response again.
    
    Reset response bookkeeping before each attempt to prevent the stale free.
    
    Fixes: 4f1fffa23769 ("cifs: commands that are retried should have replay flag set")
    Cc: stable@vger.kernel.org
    Signed-off-by: Henrique Carvalho <henrique.carvalho@suse.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

smb: client: fix double-free in SMB2_close() replay [+ + +]
Author: Henrique Carvalho <henrique.carvalho@suse.com>
Date:   Thu Jun 18 17:34:35 2026 -0300

    smb: client: fix double-free in SMB2_close() replay
    
    commit f96e1cdcb63ed3321142ff2fcdf784e32cda8fee upstream.
    
    A response-bearing attempt can return a replayable error and free its
    response buffer. If SMB2_close_init() fails before the next send, cleanup
    retains the previous buffer type and frees that response again.
    
    Reset response bookkeeping before each attempt to prevent the stale free.
    
    Fixes: 4f1fffa23769 ("cifs: commands that are retried should have replay flag set")
    Cc: stable@vger.kernel.org
    Signed-off-by: Henrique Carvalho <henrique.carvalho@suse.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

smb: client: fix double-free in SMB2_flush() replay [+ + +]
Author: Zhao Zhang <zzhan461@ucr.edu>
Date:   Thu Jun 18 23:28:05 2026 +0800

    smb: client: fix double-free in SMB2_flush() replay
    
    commit 4be31c943a3a27a5a0251dbb8f5cb89059ec3d5a upstream.
    
    SMB2_flush() keeps its response buffer bookkeeping across replay
    attempts. If a replayable flush response is received and the retry then
    fails before cifs_send_recv() stores a replacement response, flush_exit
    will free the stale response pointer a second time.
    
    Reinitialize resp_buftype and rsp_iov at the top of the replay loop so
    cleanup only acts on response state produced by the current attempt.
    This fixes a double-free without changing replay handling for successful
    requests.
    
    Fixes: 4f1fffa23769 ("cifs: commands that are retried should have replay flag set")
    Cc: stable@vger.kernel.org
    Reported-by: Yuan Tan <yuantan098@gmail.com>
    Reported-by: Zhengchuan Liang <zcliangcn@gmail.com>
    Reported-by: Xin Liu <bird@lzu.edu.cn>
    Assisted-by: Codex:GPT-5.4
    Acked-by: Henrique Carvalho <henrique.carvalho@suse.com>
    Signed-off-by: Zhao Zhang <zzhan461@ucr.edu>
    Signed-off-by: Ren Wei <n05ec@lzu.edu.cn>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

smb: client: fix double-free in SMB2_ioctl() replay [+ + +]
Author: Henrique Carvalho <henrique.carvalho@suse.com>
Date:   Thu Jun 18 17:34:34 2026 -0300

    smb: client: fix double-free in SMB2_ioctl() replay
    
    commit f9bbadb6c94583e3b4af1afc449bfceb1d1ddec9 upstream.
    
    A response-bearing attempt can return a replayable error and free its
    response buffer. If SMB2_ioctl_init() fails before the next send, cleanup
    retains the previous buffer type and frees that response again.
    
    Reset response bookkeeping before each attempt to prevent the stale free.
    
    Fixes: 4f1fffa23769 ("cifs: commands that are retried should have replay flag set")
    Cc: stable@vger.kernel.org
    Signed-off-by: Henrique Carvalho <henrique.carvalho@suse.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

smb: client: fix double-free in SMB2_open() replay [+ + +]
Author: Henrique Carvalho <henrique.carvalho@suse.com>
Date:   Thu Jun 18 17:34:33 2026 -0300

    smb: client: fix double-free in SMB2_open() replay
    
    commit b55e182f2324bc6a604c21a47aa6c448f719a532 upstream.
    
    A response-bearing attempt can return a replayable error and free its
    response buffer. If SMB2_open_init() fails before the next send, cleanup
    retains the previous buffer type and frees that response again.
    
    Reset response bookkeeping before each attempt to prevent the stale free.
    
    Fixes: 4f1fffa23769 ("cifs: commands that are retried should have replay flag set")
    Cc: stable@vger.kernel.org
    Signed-off-by: Henrique Carvalho <henrique.carvalho@suse.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

smb: client: Fix next buffer leak in receive_encrypted_standard() [+ + +]
Author: Haoxiang Li <haoxiang_li2024@163.com>
Date:   Tue Jun 23 09:45:38 2026 +0800

    smb: client: Fix next buffer leak in receive_encrypted_standard()
    
    commit 1c6267a1d5cf4c73b656f8181b310cbbb3e4767b upstream.
    
    receive_encrypted_standard() allocates next_buffer before checking
    whether the number of compound PDUs already reached MAX_COMPOUND. If
    the limit check fails, the function returns immediately and the newly
    allocated next_buffer is not assigned to server->smallbuf/server->bigbuf,
    making it leaked.
    
    Move the MAX_COMPOUND check before allocating next_buffer.
    
    Fixes: b24df3e30cbf ("cifs: update receive_encrypted_standard to handle compounded responses")
    Cc: stable@vger.kernel.org
    Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

smb: client: fix query directory replay double-free [+ + +]
Author: Henrique Carvalho <henrique.carvalho@suse.com>
Date:   Thu Jun 18 17:34:38 2026 -0300

    smb: client: fix query directory replay double-free
    
    commit 9647492b5e41954be59d5157eddbcd4cdc1656f7 upstream.
    
    A response-bearing attempt can return a replayable error and free its
    response buffer. If SMB2_query_directory_init() fails before the next send,
    cleanup retains the previous buffer type and frees that response again.
    
    Reset response bookkeeping before each attempt to prevent the stale free.
    
    Fixes: 4f1fffa23769 ("cifs: commands that are retried should have replay flag set")
    Cc: stable@vger.kernel.org
    Signed-off-by: Henrique Carvalho <henrique.carvalho@suse.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

smb: client: fix query_info() replay double-free [+ + +]
Author: Henrique Carvalho <henrique.carvalho@suse.com>
Date:   Thu Jun 18 17:34:36 2026 -0300

    smb: client: fix query_info() replay double-free
    
    commit 2a88561d66eb855813cf004a0abe648bbb17de5e upstream.
    
    A response-bearing attempt can return a replayable error and free its
    response buffer. If SMB2_query_info_init() fails before the next send,
    cleanup retains the previous buffer type and frees that response again.
    
    Reset response bookkeeping before each attempt to prevent the stale free.
    
    Fixes: 4f1fffa23769 ("cifs: commands that are retried should have replay flag set")
    Cc: stable@vger.kernel.org
    Signed-off-by: Henrique Carvalho <henrique.carvalho@suse.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

smb: client: harden POSIX SID length parsing [+ + +]
Author: Zihan Xi <xizh2024@lzu.edu.cn>
Date:   Sun Jun 28 17:19:24 2026 +0800

    smb: client: harden POSIX SID length parsing
    
    commit 7ad2bcf2441430bb2e918fb3ef9a90d775a6e422 upstream.
    
    posix_info_sid_size() reads sid[1] to obtain the subauthority count,
    but its existing boundary check still accepts buffers with only one
    remaining byte. Require two bytes before reading sid[1] so all client
    paths that reuse the helper reject truncated POSIX SIDs safely.
    
    Fixes: 349e13ad30b4 ("cifs: add smb2 POSIX info level")
    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>
    Assisted-by: Codex:gpt-5.4
    Signed-off-by: Zihan Xi <xizh2024@lzu.edu.cn>
    Signed-off-by: Ren Wei <n05ec@lzu.edu.cn>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

smb: client: mask server-provided mode to 07777 in modefromsid [+ + +]
Author: Norbert Manthey <nmanthey@amazon.de>
Date:   Thu Jul 9 15:54:39 2026 +0000

    smb: client: mask server-provided mode to 07777 in modefromsid
    
    commit e3d9c7160d483fc8f9e225aafad8ecbbc43f3151 upstream.
    
    When modefromsid is active, parse_dacl() applies the server-provided
    sub_auth[2] value from the NFS mode SID to cf_mode without masking to
    07777. Apply the correct masking, same as in the read path.
    
    Fixes: e2f8fbfb8d09c ("cifs: get mode bits from special sid on stat")
    Signed-off-by: Norbert Manthey <nmanthey@amazon.de>
    Assisted-by: Kiro:claude-opus-4.6
    Cc: stable@vger.kernel.org
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

smb: client: reject overlapping data areas in SMB2 responses [+ + +]
Author: Shoichiro Miyamoto <shoichiro.miyamoto@gmail.com>
Date:   Sat Jul 11 22:33:26 2026 +0900

    smb: client: reject overlapping data areas in SMB2 responses
    
    commit 8986c932905ea508d66da421eb2eb6e676ace1fe upstream.
    
    Commit 53b7c271f06b ("smb: client: restrict implied bcc[0] exemption to
    responses without data area") restricted the implied bcc[0] length
    exception to responses without a data area. However, the overlap
    handling in __smb2_calc_size() clears data_length, which can make an
    invalid response appear to have no data area and so qualify for the
    exception.
    
    Track data area overlap separately and reject such responses before
    applying the length compatibility exceptions.
    
    Fixes: 53b7c271f06b ("smb: client: restrict implied bcc[0] exemption to responses without data area")
    Cc: stable@vger.kernel.org
    Signed-off-by: Shoichiro Miyamoto <shoichiro.miyamoto@gmail.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

smb: client: resolve SWN tcon from live registrations [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
Date:   Sun May 17 20:11:49 2026 -0400

    smb: client: resolve SWN tcon from live registrations
    
    commit ec457f9afe5ae9538bdcd58fd4cb442b9787e183 upstream.
    
    cifs_swn_notify() looks up a witness registration by id under
    cifs_swnreg_idr_mutex, drops the mutex, and then uses the registration's
    cached tcon pointer.  That pointer is not a lifetime reference, and it is
    not a stable representative once cifs_get_swn_reg() lets multiple tcons
    for the same net/share name share one registration id.
    
    A same-share second mount can keep the cifs_swn_reg alive after the first
    tcon unregisters and is freed.  The registration then still points at the
    freed first tcon, so taking tc_lock or incrementing tc_count through
    swnreg->tcon only moves the use-after-free earlier.  Taking tc_lock while
    holding cifs_swnreg_idr_mutex also violates the documented CIFS lock
    order.
    
    Fix this by making the registration store only the stable witness
    identity: id, net name, share name, and notify flags.  When a notify
    arrives, copy that identity under cifs_swnreg_idr_mutex, drop the mutex,
    then find and pin a live witness tcon that currently matches the net/share
    pair under the normal cifs_tcp_ses_lock -> tc_lock order.  The notification
    path uses that pinned tcon directly and drops the reference when done.
    
    Registration and unregister messages now use the live tcon passed by the
    caller instead of a cached tcon in the registration.  The final unregister
    send is folded into cifs_swn_unregister() while the registration is still
    protected by cifs_swnreg_idr_mutex.  This removes the previous
    find/drop/reacquire raw-pointer window.  The release path only removes the
    idr entry and frees the stable identity strings.
    
    This preserves the intended one-registration/many-tcon behavior: a
    registration id represents a net/share pair, and notify handling acts on a
    live representative selected at use time.  It also preserves CLIENT_MOVE
    ordering for the representative tcon because the old-IP unregister is sent
    before cifs_swn_register() sends the new-IP register.
    
    Fixes: fed979a7e082 ("cifs: Set witness notification handler for messages from userspace daemon")
    Cc: stable@vger.kernel.org
    Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
    Assisted-by: Claude:claude-opus-4-7
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

smb: client: restrict implied bcc[0] exemption to responses without data area [+ + +]
Author: Shoichiro Miyamoto <shoichiro.miyamoto@gmail.com>
Date:   Tue Jul 7 20:23:58 2026 +0900

    smb: client: restrict implied bcc[0] exemption to responses without data area
    
    commit 53b7c271f06be4dd5cfc8c6ef552a8355c891a7f upstream.
    
    smb2_check_message() has a long-standing quirk that accepts a response
    whose calculated length is one byte larger than the bytes actually
    received ("server can return one byte more due to implied bcc[0]").
    This was introduced to accommodate servers that omit the trailing bcc[0]
    overlap byte when no data area is present.
    
    However, the exemption is applied unconditionally, regardless of whether
    the command actually carries a data area (has_smb2_data_area[]).  When a
    response with a data area is subject to the +1 exemption, the reported
    data can extend one byte beyond the bytes actually received, yet
    smb2_check_message() still accepts it.  The subsequent decoder then reads
    past the end of the receive buffer.  This is reachable during NEGOTIATE
    and SESSION_SETUP, before the session is established.
    
    The resulting out-of-bounds reads are visible under KASAN when mounting
    against a non-conforming server; both the SPNEGO/negTokenInit and the
    NTLMSSP challenge decoders are affected:
    
      BUG: KASAN: slab-out-of-bounds in asn1_ber_decoder+0x16a7/0x1b00
      Read of size 1 at addr ffff8880084d67c0 by task mount.cifs/81
      CPU: 1 UID: 0 PID: 81 Comm: mount.cifs Not tainted 7.1.0-rc6 #1
      Call Trace:
       <TASK>
       dump_stack_lvl+0x4e/0x70
       print_report+0x157/0x4c9
       kasan_report+0xce/0x100
       asn1_ber_decoder+0x16a7/0x1b00
       decode_negTokenInit+0x19/0x30
       SMB2_negotiate+0x31d9/0x4c90
       cifs_negotiate_protocol+0x1f2/0x3f0
       cifs_get_smb_ses+0x93f/0x17e0
       cifs_mount_get_session+0x7f/0x3a0
       cifs_mount+0xb4/0xcf0
       cifs_smb3_do_mount+0x23a/0x1500
       smb3_get_tree+0x3b0/0x630
       vfs_get_tree+0x82/0x2d0
       fc_mount+0x10/0x1b0
       path_mount+0x50d/0x1de0
       __x64_sys_mount+0x20b/0x270
       do_syscall_64+0xee/0x590
       entry_SYSCALL_64_after_hwframe+0x77/0x7f
       </TASK>
      Allocated by task 85:
       kmem_cache_alloc_noprof+0x106/0x380
       mempool_alloc_noprof+0x116/0x1e0
       cifs_small_buf_get+0x31/0x80
       allocate_buffers+0x10d/0x2b0
       cifs_demultiplex_thread+0x1d5/0x1d50
       kthread+0x2c6/0x390
       ret_from_fork+0x36e/0x5a0
       ret_from_fork_asm+0x1a/0x30
      The buggy address is located 0 bytes to the right of
       allocated 448-byte region [ffff8880084d6600, ffff8880084d67c0)
       which belongs to the cache cifs_small_rq of size 448
    
      BUG: KASAN: slab-out-of-bounds in kmemdup_noprof+0x36/0x50
      Read of size 329 at addr ffff88800726c678 by task mount.cifs/89
      CPU: 0 UID: 0 PID: 89 Comm: mount.cifs Tainted: G    B      7.1.0-rc6 #1
      Call Trace:
       <TASK>
       dump_stack_lvl+0x4e/0x70
       print_report+0x157/0x4c9
       kasan_report+0xce/0x100
       kasan_check_range+0x10f/0x1e0
       __asan_memcpy+0x23/0x60
       kmemdup_noprof+0x36/0x50
       decode_ntlmssp_challenge+0x457/0x680
       SMB2_sess_auth_rawntlmssp_negotiate+0x6f0/0xcb0
       SMB2_sess_setup+0x219/0x4f0
       cifs_setup_session+0x248/0xaf0
       cifs_get_smb_ses+0xf79/0x17e0
       cifs_mount_get_session+0x7f/0x3a0
       cifs_mount+0xb4/0xcf0
       cifs_smb3_do_mount+0x23a/0x1500
       smb3_get_tree+0x3b0/0x630
       vfs_get_tree+0x82/0x2d0
       fc_mount+0x10/0x1b0
       path_mount+0x50d/0x1de0
       __x64_sys_mount+0x20b/0x270
       do_syscall_64+0xee/0x590
       entry_SYSCALL_64_after_hwframe+0x77/0x7f
       </TASK>
      Allocated by task 93:
       kmem_cache_alloc_noprof+0x106/0x380
       mempool_alloc_noprof+0x116/0x1e0
       cifs_small_buf_get+0x31/0x80
       allocate_buffers+0x10d/0x2b0
       cifs_demultiplex_thread+0x1d5/0x1d50
       kthread+0x2c6/0x390
       ret_from_fork+0x36e/0x5a0
       ret_from_fork_asm+0x1a/0x30
      The buggy address is located 120 bytes inside of
       allocated 448-byte region [ffff88800726c600, ffff88800726c7c0)
       which belongs to the cache cifs_small_rq of size 448
    
    Restrict the +1 exemption to responses that have no data area, so that
    it still covers the bcc[0] omission it was meant for.  When a data area
    is present, the +1 discrepancy instead means the reported data length
    overruns the received buffer, so the response must be rejected.
    
    Fixes: 093b2bdad322 ("CIFS: Make demultiplex_thread work with SMB2 code")
    Cc: stable@vger.kernel.org
    Signed-off-by: Shoichiro Miyamoto <shoichiro.miyamoto@gmail.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

smb: client: use unaligned reads in parse_posix_ctxt() [+ + +]
Author: Zihan Xi <xizh2024@lzu.edu.cn>
Date:   Wed Jul 1 18:23:21 2026 +0800

    smb: client: use unaligned reads in parse_posix_ctxt()
    
    commit b86467cd2691192ad4809a5a6e922fc24b8e9839 upstream.
    
    The server controls create-context DataOffset, so the POSIX context data
    pointer may be misaligned on strict-alignment architectures. Use
    get_unaligned_le32() when reading nlink, reparse_tag, and mode.
    
    Fixes: 69dda3059e7a ("cifs: add SMB2_open() arg to return POSIX data")
    Cc: stable@vger.kernel.org
    Signed-off-by: Zihan Xi <xizh2024@lzu.edu.cn>
    Signed-off-by: Ren Wei <n05ec@lzu.edu.cn>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
spi: fsl-lpspi: replace dmaengine_terminate_all() with dmaengine_terminate_sync() [+ + +]
Author: Carlos Song <carlos.song@nxp.com>
Date:   Mon May 25 14:23:56 2026 +0800

    spi: fsl-lpspi: replace dmaengine_terminate_all() with dmaengine_terminate_sync()
    
    commit e703ce47691b967fe9b4057fb1d062273211afa9 upstream.
    
    dmaengine_terminate_all() has been deprecated, so replace it with
    dmaengine_terminate_sync().
    
    Fixes: 09c04466ce7e ("spi: lpspi: add dma mode support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Carlos Song <carlos.song@nxp.com>
    Link: https://patch.msgid.link/20260525062357.3191349-2-carlos.song@oss.nxp.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

spi: fsl-lpspi: terminate the RX channel on TX prepare failure path [+ + +]
Author: Carlos Song <carlos.song@nxp.com>
Date:   Mon May 25 14:23:57 2026 +0800

    spi: fsl-lpspi: terminate the RX channel on TX prepare failure path
    
    commit 01980b5da56e573d62798d0ff6c86bcaa2b22cbe upstream.
    
    When dmaengine_prep_slave_sg() fails for the TX channel, the error path
    terminates the TX DMA channel but leaves the RX channel running. Since
    the RX channel was already submitted and issued prior to preparing
    the TX descriptor, returning -EINVAL causes the SPI core to unmap the
    DMA buffers while the RX DMA engine continues writing to them, leading
    to potential memory corruption or use-after-free.
    
    Terminate the RX channel before returning on the TX prepare failure path.
    
    Fixes: 09c04466ce7e ("spi: lpspi: add dma mode support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Carlos Song <carlos.song@nxp.com>
    Link: https://patch.msgid.link/20260525062357.3191349-3-carlos.song@oss.nxp.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
staging: media: atomisp: reduce load_primary_binaries() stack usage [+ + +]
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Wed Mar 25 13:59:43 2026 +0100

    staging: media: atomisp: reduce load_primary_binaries() stack usage
    
    commit f4d51e55dd47ef467fbe37d8575e20eee41b092d upstream.
    
    The load_primary_binaries() function is overly complex and has som large
    variables on the stack, which can cause warnings depending on CONFIG_FRAME_WARN
    setting:
    
    drivers/staging/media/atomisp/pci/sh_css.c: In function 'load_primary_binaries':
    drivers/staging/media/atomisp/pci/sh_css.c:5260:1: error: the frame size of 1560 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]
    
    Half of the stack usage is for the prim_descr[] array, but only one
    member of the array is used at any given time.
    
    Reduce the stack usage by turning the array into a single structure.
    
    Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
    Cc: stable@vger.kernel.org
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: media: ipu7: fix double-free and use-after-free in error paths [+ + +]
Author: Alexandru Hossu <hossu.alexandru@gmail.com>
Date:   Mon Apr 13 17:12:44 2026 +0200

    staging: media: ipu7: fix double-free and use-after-free in error paths
    
    commit d3a9a8cf2d7fd61a2f63df61f6cbc0a9bb007cc0 upstream.
    
    In both ipu7_isys_init() and ipu7_psys_init(), pdata is allocated and
    then passed to ipu7_bus_initialize_device(), which stores it in
    adev->pdata. The ipu7_bus_release() function frees adev->pdata when the
    device's reference count drops to zero.
    
    Two error paths incorrectly call kfree(pdata) after the device teardown
    has already freed it:
    
    1. When ipu7_mmu_init() fails: put_device() is called, which drops the
       reference count to zero and triggers ipu7_bus_release() ->
       kfree(pdata). The subsequent kfree(pdata) is a double-free.
    
    2. When ipu7_bus_add_device() fails: it calls auxiliary_device_uninit()
       internally, which calls put_device() -> ipu7_bus_release() ->
       kfree(pdata). The subsequent kfree(pdata) is again a double-free.
    
    Note that the kfree(pdata) when ipu7_bus_initialize_device() itself
    fails is correct, because in that case auxiliary_device_init() failed
    and the release function was never set up, so pdata must be freed
    manually.
    
    Additionally, the error code was not saved before calling put_device(),
    causing ERR_CAST() to dereference the already-freed adev pointer when
    constructing the return value. Fix this by saving the error from
    dev_err_probe() before put_device() and returning ERR_PTR() instead.
    
    Remove the redundant kfree(pdata) calls and fix the use-after-free in
    the return values of the two affected error paths.
    
    Fixes: b7fe4c0019b1 ("media: staging/ipu7: add Intel IPU7 PCI device driver")
    Cc: stable@vger.kernel.org
    Reviewed-by: Dan Carpenter <error27@gmail.com>
    Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>
    Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: rtl8723bs: don't drop short TX frames in _rtw_pktfile_read() [+ + +]
Author: Christopher Mackle <christophermackle01@gmail.com>
Date:   Sat Jun 20 01:39:16 2026 +0000

    staging: rtl8723bs: don't drop short TX frames in _rtw_pktfile_read()
    
    commit 252f8c681adc8614b70f844ba3de3a138c33a783 upstream.
    
    Commit bc4df274dca6 ("staging: rtl8723bs: update _rtw_pktfile_read() to
    return error codes") changed _rtw_pktfile_read() to fail when the caller
    asks for more bytes than remain in the packet:
    
            if (rtw_remainder_len(pfile) < rlen)
                    return -EINVAL;
    
    That breaks the assumption made by the data TX path.  In
    rtw_xmitframe_coalesce() (core/rtw_xmit.c) the per-fragment copy is
    issued with the full fragment length, mpdu_len, which is derived from
    pxmitpriv->frag_len (~2300 bytes), and the code relies on the historical
    behaviour of copying only what is left and returning the number of bytes
    actually copied:
    
            mem_sz = _rtw_pktfile_read(&pktfile, pframe, mpdu_len);
            if (mem_sz < 0)
                    return mem_sz;
    
    So for every outbound packet smaller than the fragmentation threshold -
    i.e. essentially all normal traffic, including the EAPOL frames of the
    WPA 4-way handshake and DHCP - rlen is larger than the bytes remaining,
    _rtw_pktfile_read() returns -EINVAL, rtw_xmitframe_coalesce() aborts, and
    the frame is dropped before it is queued to the hardware.  The driver
    floods the log with:
    
            rtl8723bs ...: xmit_xmitframes: coalesce failed with error -22
    
    Management frames (authentication/association) use a different path and
    still go out, so the interface scans and associates, but no data frame is
    ever transmitted.  The 4-way handshake therefore never completes and
    wpa_supplicant misreports it as:
    
            WPA: 4-Way Handshake failed - pre-shared key may be incorrect
    
    AP mode is unaffected.  The net effect is that the chip is unusable in
    station mode on any kernel carrying the offending commit.
    
    This was confirmed with a wpa_supplicant -dd trace on an RTL8723BS SDIO
    adapter (Bay Trail): message 1/4 is received and the PTK is derived, but
    each "Sending EAPOL-Key 2/4" coincides 1:1 with a "coalesce failed with
    error -22", so message 2/4 never reaches the AP, which keeps retrying
    message 1/4 until the handshake times out.
    
    Restore the original semantics: clamp the requested length to the bytes
    remaining in the packet and return that length.  The skb_copy_bits()
    error path is kept, so genuine copy failures are still propagated.
    
    Fixes: bc4df274dca6 ("staging: rtl8723bs: update _rtw_pktfile_read() to return error codes")
    Cc: stable <stable@kernel.org>
    Tested-by: Christopher Mackle <christophermackle01@gmail.com>
    Signed-off-by: Christopher Mackle <christophermackle01@gmail.com>
    Link: https://patch.msgid.link/20260620013916.7148-1-christophermackle01@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: rtl8723bs: fix heap buffer overflow in rtw_cfg80211_set_wpa_ie() [+ + +]
Author: Alexandru Hossu <hossu.alexandru@gmail.com>
Date:   Fri May 22 02:45:27 2026 +0200

    staging: rtl8723bs: fix heap buffer overflow in rtw_cfg80211_set_wpa_ie()
    
    commit 5a752a616e756844388a1a45404db9fc29fec655 upstream.
    
    supplicant_ie is a 256-byte array in struct security_priv. The WPA and
    WPA2 IE copy paths use:
    
        memcpy(padapter->securitypriv.supplicant_ie, &pwpa[0], wpa_ielen + 2);
    
    where wpa_ielen is the raw IE length field (u8, 0-255). When a local user
    supplies a connect request via nl80211 with a crafted WPA IE of length 255,
    wpa_ielen + 2 equals 257, overflowing the 256-byte buffer by one byte into
    the adjacent last_mic_err_time field.
    
    rtw_parse_wpa_ie() does not prevent this: its length consistency check
    compares *(wpa_ie+1) against (u8)(wpa_ie_len-2), which is (u8)(255) == 255
    when wpa_ie_len = 257, so the check passes silently.
    
    Add explicit bounds checks for both the WPA and WPA2 paths before the
    memcpy, rejecting any IE whose total size (wpa_ielen + 2) exceeds the
    supplicant_ie buffer.
    
    Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
    Cc: stable <stable@kernel.org>
    Reviewed-by: Luka Gejak <luka.gejak@linux.dev>
    Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>
    Link: https://patch.msgid.link/20260522004531.1038924-4-hossu.alexandru@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: rtl8723bs: fix OOB read in OnAssocRsp() IE loop [+ + +]
Author: Alexandru Hossu <hossu.alexandru@gmail.com>
Date:   Fri May 22 02:45:29 2026 +0200

    staging: rtl8723bs: fix OOB read in OnAssocRsp() IE loop
    
    commit f9654207e92283e0acac5d64fe5f8835383b5a23 upstream.
    
    The IE parsing loop in OnAssocRsp() advances by (pIE->length + 2) each
    iteration but only guards on i < pkt_len. When a malicious AP sends an
    AssocResponse whose last IE has only one byte remaining in the frame
    (the element_id byte lands at pkt_len-1), the loop reads pIE->length
    from pframe[pkt_len], which is one byte past the allocated receive buffer.
    
    Additionally, even when the header bytes are in bounds, pIE->length
    itself can extend the data window beyond pkt_len, silently passing a
    truncated IE to the handler functions.
    
    Add two guards at the top of the loop body:
      1. Break if fewer than sizeof(*pIE) bytes remain (can't read header).
      2. Break if the IE's declared data extends past pkt_len.
    
    Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>
    Reviewed-by: Luka Gejak <luka.gejak@linux.dev>
    Link: https://patch.msgid.link/20260522004531.1038924-6-hossu.alexandru@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: rtl8723bs: fix OOB read in update_beacon_info() IE loop [+ + +]
Author: Alexandru Hossu <hossu.alexandru@gmail.com>
Date:   Fri May 22 02:45:25 2026 +0200

    staging: rtl8723bs: fix OOB read in update_beacon_info() IE loop
    
    commit ed51de4a86e173c3b0ef78e039c2e49e08b11f16 upstream.
    
    The IE parsing loop in update_beacon_info() advances by
    (pIE->length + 2) each iteration but only guards on i < len.
    When a malicious AP sends a Beacon whose last IE has only one byte
    remaining in the frame (the element_id byte lands at len-1), the loop
    reads pIE->length from one byte past the allocated receive buffer.
    
    Additionally, even when the header bytes are in bounds, pIE->length
    itself can extend the data window beyond len, passing a truncated IE
    to the handler functions.
    
    Add two guards at the top of the loop body:
      1. Break if fewer than sizeof(*pIE) bytes remain (can't read header).
      2. Break if the IE's declared data extends past len.
    
    Also replace i += (pIE->length + 2) with i += sizeof(*pIE) + pIE->length
    for consistency with the sizeof(*pIE) guards added above.
    
    Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
    Cc: stable <stable@kernel.org>
    Reviewed-by: Luka Gejak <luka.gejak@linux.dev>
    Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>
    Link: https://patch.msgid.link/20260522004531.1038924-2-hossu.alexandru@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: rtl8723bs: fix OOB reads in IE loops in issue_assocreq() and join_cmd_hdl() [+ + +]
Author: Alexandru Hossu <hossu.alexandru@gmail.com>
Date:   Fri May 22 02:45:26 2026 +0200

    staging: rtl8723bs: fix OOB reads in IE loops in issue_assocreq() and join_cmd_hdl()
    
    commit ef61d628dfad38fead1fd2e08979ae9126d011d5 upstream.
    
    Two IE parsing loops are missing the header bounds checks before they
    dereference pIE->length:
    
     - issue_assocreq() walks pmlmeinfo->network.ies to build the
       association request. If the stored IE data ends with only an
       element_id byte and no length byte, pIE->length is read one byte
       past the end of the buffer.
    
     - join_cmd_hdl() walks pnetwork->ies during station join and has
       the same problem under the same conditions.
    
    Both buffers are filled from AP beacon and probe-response frames, so a
    malicious AP that sends a truncated final IE can trigger the issue.
    
    Apply the two-guard pattern established in update_beacon_info():
      1. Break if fewer than sizeof(*pIE) bytes remain.
      2. Break if the IE's declared data extends past the buffer end.
    
    Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
    Cc: stable <stable@kernel.org>
    Reviewed-by: Luka Gejak <luka.gejak@linux.dev>
    Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>
    Link: https://patch.msgid.link/20260522004531.1038924-3-hossu.alexandru@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: rtl8723bs: fix OOB reads in is_ap_in_tkip() IE loop [+ + +]
Author: Alexandru Hossu <hossu.alexandru@gmail.com>
Date:   Fri May 22 02:45:30 2026 +0200

    staging: rtl8723bs: fix OOB reads in is_ap_in_tkip() IE loop
    
    commit 3bf39f711ff27c64be8680a8938bcc5001982e81 upstream.
    
    The loop in is_ap_in_tkip() iterates over IEs without verifying that
    enough bytes remain before dereferencing the IE header or its payload:
    
    - pIE->element_id and pIE->length are read without checking that
      i + sizeof(*pIE) <= ie_length, so a truncated IE at the end of the
      buffer causes an OOB read.
    
    - For WLAN_EID_VENDOR_SPECIFIC the code compares pIE->data + 12,
      which requires pIE->length >= 16.  For WLAN_EID_RSN it compares
      pIE->data + 8, requiring pIE->length >= 12.  Neither requirement
      is checked.
    
    Add the missing IE header and payload bounds checks and guard each
    data access with an explicit pIE->length minimum, matching the
    pattern established in update_beacon_info().
    
    Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>
    Link: https://patch.msgid.link/20260522004531.1038924-7-hossu.alexandru@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: rtl8723bs: fix OOB reads in rtw_get_sec_ie(), rtw_get_wapi_ie(), and rtw_get_wps_attr() [+ + +]
Author: Alexandru Hossu <hossu.alexandru@gmail.com>
Date:   Fri May 22 02:45:31 2026 +0200

    staging: rtl8723bs: fix OOB reads in rtw_get_sec_ie(), rtw_get_wapi_ie(), and rtw_get_wps_attr()
    
    commit 1463ca3ec6601cbb097d8d87dbf5dcf1cb86a344 upstream.
    
    Three IE/attribute parsing functions have missing bounds checks.
    
    rtw_get_sec_ie() and rtw_get_wapi_ie() iterate over a raw IE buffer
    without verifying that the header bytes (tag + length) are within the
    remaining buffer before reading them.  Additionally, rtw_get_sec_ie()
    compares the 4-byte WPA OUI at cnt+2 without checking that at least
    6 bytes remain, and rtw_get_wapi_ie() compares a 4-byte WAPI OUI at
    cnt+6 without checking that at least 10 bytes remain.
    
    rtw_get_wps_attr() reads wps_ie[0] and wps_ie+2 unconditionally at
    entry, before verifying that wps_ielen is large enough to contain
    the 6-byte WPS IE header (element_id + length + 4-byte OUI).  Inside
    the attribute loop, get_unaligned_be16() is called on attr_ptr and
    attr_ptr+2 without checking that 4 bytes remain in the buffer.
    
    Add a cnt+2 bounds check before each loop body in rtw_get_sec_ie()
    and rtw_get_wapi_ie(), guard each multi-byte comparison with a minimum
    IE length requirement, add a wps_ielen < 6 early return in
    rtw_get_wps_attr(), and add a 4-byte bounds check in its inner loop.
    
    Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>
    Link: https://patch.msgid.link/20260522004531.1038924-8-hossu.alexandru@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: rtl8723bs: fix OOB write in HT_caps_handler() [+ + +]
Author: Alexandru Hossu <hossu.alexandru@gmail.com>
Date:   Fri May 22 02:45:28 2026 +0200

    staging: rtl8723bs: fix OOB write in HT_caps_handler()
    
    commit f8001e1a516ba3b495728c65b61f799cbfad6bd0 upstream.
    
    HT_caps_handler() iterates pIE->length bytes and writes into
    HT_caps.u.HT_cap[], which is a fixed 26-byte array (sizeof struct
    HT_caps_element). Because pIE->length is a raw u8 from an over-the-air
    802.11 AssocResponse frame and is never validated, a malicious AP can
    set it up to 255, causing up to 229 bytes of out-of-bounds writes into
    adjacent fields of struct mlme_ext_info.
    
    Truncate the iteration count to the size of HT_caps.u.HT_cap using
    umin() so that data from a longer-than-expected IE is silently ignored
    rather than written out of bounds, preserving interoperability with APs
    that pad the element. An early return on oversized IEs was considered
    but rejected: it would bypass the pmlmeinfo->HT_caps_enable = 1
    assignment that precedes the loop, silently disabling HT mode for APs
    that append extra bytes to the HT Capabilities IE.
    
    Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>
    Reviewed-by: Luka Gejak <luka.gejak@linux.dev>
    Link: https://patch.msgid.link/20260522004531.1038924-5-hossu.alexandru@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: rtl8723bs: fix WEP length underflow and OOB read in OnAuth() [+ + +]
Author: Alexandru Hossu <hossu.alexandru@gmail.com>
Date:   Fri May 22 02:46:05 2026 +0200

    staging: rtl8723bs: fix WEP length underflow and OOB read in OnAuth()
    
    commit a1fc19d61f661d47204f095b593de507884849f7 upstream.
    
    OnAuth() has two bugs in the shared-key authentication path.
    
    When the Privacy bit is set, rtw_wep_decrypt() is called without
    verifying that the frame is long enough to contain a valid WEP IV and
    ICV.  Inside rtw_wep_decrypt(), length is computed as:
    
        length = len - WLAN_HDR_A3_LEN - iv_len
    
    and then passed as (length - 4) to crc32_le().  If len is less than
    WLAN_HDR_A3_LEN + iv_len + icv_len (32 bytes), length - 4 is negative
    and, after the implicit cast to size_t, causes crc32_le() to read far
    beyond the frame buffer.  Add a minimum length check before accessing
    the IV field and calling the decryption path.
    
    When processing a seq=3 response, rtw_get_ie() stores the Challenge
    Text IE length in ie_len, but the subsequent memcmp() always reads 128
    bytes regardless of ie_len.  IEEE 802.11 mandates a challenge text of
    exactly 128 bytes; reject any IE whose length field differs, matching
    the check already applied to OnAuthClient().
    
    Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>
    Link: https://patch.msgid.link/20260522004605.1039209-1-hossu.alexandru@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: vme_user: bound slave read/write to the kern_buf size [+ + +]
Author: Michael Tautschnig <tautschn@amazon.com>
Date:   Thu Jun 18 13:47:09 2026 +0200

    staging: vme_user: bound slave read/write to the kern_buf size
    
    commit 9f32f38265014fac7f5dc9490fb01a638ce6e121 upstream.
    
    The SLAVE-path helpers buffer_to_user() and buffer_from_user() copy
    'count' bytes into/out of the fixed-size kern_buf (size_buf ==
    PCI_BUF_SIZE == 0x20000, 128 KiB) using *ppos as the offset, without
    bounding *ppos + count against size_buf.
    
    vme_user_write()/vme_user_read() only clamp count to the VME window size
    (image_size = vme_get_size(resource)), which VME_SET_SLAVE sets from the
    user-supplied slave.size -- validated against the VME address space (up
    to VME_A32_MAX = 4 GiB), not against PCI_BUF_SIZE.  When the window
    exceeds 128 KiB, a write()/read() copies past the kern_buf allocation.
    
    Clamp count against size_buf in both helpers, with an early return when
    *ppos is already at/after the buffer end.  *ppos is >= 0 here (the caller
    rejects negative offsets), so size_buf - *ppos cannot wrap.  This mirrors
    the existing clamp in the MASTER-path helpers resource_to_user() /
    resource_from_user(), and matches the read()/write() convention of a
    short transfer at end-of-buffer.
    
    Found by static analysis (CodeQL taint tracking + CBMC bounded model
    checking) and confirmed dynamically under KASAN with the vme_fake bridge:
    
      BUG: KASAN: slab-out-of-bounds in _copy_from_user+0x2d/0x80
      Write of size 262144 at addr ffff888004100000 by task trigger/68
        _copy_from_user+0x2d/0x80
        vme_user_write+0x13e/0x240 [vme_user]
        vfs_write+0x1b8/0x7a0
        ksys_write+0xb8/0x150
    
    Fixes: f00a86d98a1e ("Staging: vme: add VME userspace driver")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Michael Tautschnig <tautschn@amazon.com>
    Link: https://patch.msgid.link/20260618114709.72499-1-tautschn@amazon.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: vme_user: fix location monitor leak in fake bridge [+ + +]
Author: Hao-Qun Huang <alvinhuang0603@gmail.com>
Date:   Sat Jul 4 14:58:15 2026 +0800

    staging: vme_user: fix location monitor leak in fake bridge
    
    commit e8422d89e8af41d87f0e9db564be8e2634f4c602 upstream.
    
    fake_init() allocates a location monitor resource and links it into
    fake_bridge->lm_resources. The init error path frees this list, but
    fake_exit() only frees the slave and master resource lists. Loading
    and unloading the module therefore triggers a kmemleak warning:
    
      unreferenced object 0xffff8b8b82aebe40 (size 64):
        comm "init", pid 1, jiffies 4294894572
        backtrace (crc c1e013ef):
          kmemleak_alloc+0x4e/0x90
          __kmalloc_cache_noprof+0x338/0x430
          0xffffffffc0602246
          do_one_initcall+0x4f/0x320
          do_init_module+0x68/0x270
          load_module+0x2a3b/0x2d90
    
    Free the lm_resources list in fake_exit() as well, before fake_bridge
    is freed.
    
    Fixes: 658bcdae9c67 ("vme: Adding Fake VME driver")
    Cc: stable <stable@kernel.org>
    Cc: Martyn Welch <martyn@welchs.me.uk>
    Assisted-by: Claude:claude-fable-5
    Signed-off-by: Hao-Qun Huang <alvinhuang0603@gmail.com>
    Link: https://patch.msgid.link/20260704065817.403111-1-alvinhuang0603@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: vme_user: fix location monitor leak in tsi148 bridge [+ + +]
Author: Hao-Qun Huang <alvinhuang0603@gmail.com>
Date:   Sat Jul 4 14:58:16 2026 +0800

    staging: vme_user: fix location monitor leak in tsi148 bridge
    
    commit 151edde741f8bc7f2931c5f44ab376d32b0c8beb upstream.
    
    tsi148_probe() allocates a location monitor resource and links it into
    tsi148_bridge->lm_resources. The probe error path frees this list, but
    tsi148_remove() only frees the dma, slave and master resource lists, so
    the location monitor resource is leaked on device unbind or module
    unload.
    
    Free the lm_resources list in tsi148_remove() as well, before
    tsi148_bridge is freed.
    
    Fixes: d22b8ed9a3b0 ("Staging: vme: add Tundra TSI148 VME-PCI Bridge driver")
    Cc: stable <stable@kernel.org>
    Cc: Martyn Welch <martyn@welchs.me.uk>
    Assisted-by: Claude:claude-fable-5
    Signed-off-by: Hao-Qun Huang <alvinhuang0603@gmail.com>
    Link: https://patch.msgid.link/20260704065817.403111-2-alvinhuang0603@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
svcrdma: wake sq waiters when the transport closes [+ + +]
Author: Chuck Lever <cel@kernel.org>
Date:   Fri May 22 14:13:57 2026 -0400

    svcrdma: wake sq waiters when the transport closes
    
    commit e5248a7426030db1e126363f72afdb3b71339a5c upstream.
    
    Threads parked in svc_rdma_sq_wait() on sc_sq_ticket_wait or
    sc_send_wait can hang indefinitely in TASK_UNINTERRUPTIBLE state
    across transport teardown, pinning svc_xprt references and
    blocking svc_rdma_free().
    
    The close path sets XPT_CLOSE before invoking xpo_detach and both
    wait_event predicates include an XPT_CLOSE term, but the
    predicates are re-evaluated only on wakeup. sc_sq_ticket_wait has
    no completion-driven wake path; it is advanced solely by the
    chained ticket handoff inside svc_rdma_sq_wait() itself. Without
    an explicit wake at close, parked threads never observe
    XPT_CLOSE, hold their svc_xprt_get reference forever, and
    svc_rdma_free() blocks on xpt_ref dropping to zero.
    
    Two close entry points reach this transport. Local teardown runs
    svc_rdma_detach() from svc_handle_xprt() -> svc_delete_xprt() ->
    xpo_detach() on a worker thread. A remote disconnect arrives at
    svc_rdma_cma_handler(), which calls svc_xprt_deferred_close():
    that sets XPT_CLOSE and enqueues the transport but does not
    access either RDMA waitqueue, so a worker already parked in
    svc_rdma_sq_wait() never re-evaluates its predicate. With every
    worker parked on this transport, no thread is available to run
    the local teardown either, and the wake site there is
    unreachable.
    
    Introduce svc_rdma_xprt_deferred_close(), a thin svcrdma wrapper
    that calls svc_xprt_deferred_close() and then wakes both
    sc_sq_ticket_wait and sc_send_wait. Convert the svcrdma producers
    that called svc_xprt_deferred_close() directly:
    svc_rdma_cma_handler(), qp_event_handler(),
    svc_rdma_post_send_err(), svc_rdma_wc_send(), the sendto drop
    path, the rw completion error paths, and the recvfrom flush and
    read-list error paths.
    
    Wake both waitqueues from svc_rdma_detach() as well. The
    synchronous svc_xprt_close() path (backchannel ENOTCONN, device
    removal via svc_rdma_xprt_done) reaches detach without flowing
    through svc_xprt_deferred_close() and therefore does not invoke
    the new helper.
    
    Fixes: ccc89b9d1ed2 ("svcrdma: Add fair queuing for Send Queue access")
    Cc: stable@vger.kernel.org
    Assisted-by: kres (claude-opus-4-7)
    Signed-off-by: Chris Mason <clm@meta.com>
    [ cel: add svc_rdma_xprt_deferred_close() to complete the fix ]
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tcp: restore RCU grace period in tcp_ao_destroy_sock [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
Date:   Thu Jun 25 19:21:39 2026 +0100

    tcp: restore RCU grace period in tcp_ao_destroy_sock
    
    commit 8bc4d43bccbd60efe85d0a44d5bf41762f2f0c30 upstream.
    
    Commit 51e547e8c89c ("tcp: Free TCP-AO/TCP-MD5 info/keys without RCU")
    removed the call_rcu() callback from tcp_ao_destroy_sock(), arguing that
    "the destruction of info/keys is delayed until the socket destructor"
    and therefore "no one can discover it anymore".
    
    That argument does not hold for the call site in tcp_connect()
    (net/ipv4/tcp_output.c:4327-4332). At that point the socket is in
    TCP_SYN_SENT, has already been inserted into the inet ehash by
    inet_hash_connect() in tcp_v4_connect(), and is therefore very much
    discoverable: any softirq running tcp_v4_rcv() on another CPU can take
    the socket out of the ehash, walk into tcp_inbound_hash(), and load
    tp->ao_info via implicit RCU before bh_lock_sock_nested() is taken on
    the destroying CPU.
    
    The reader path then enters __tcp_ao_do_lookup() (net/ipv4/tcp_ao.c:208)
    which re-loads tp->ao_info via rcu_dereference_check(); the re-load can
    still observe the (about-to-be-freed) pointer because there is no
    synchronize_rcu() between rcu_assign_pointer(tp->ao_info, NULL) and
    tcp_ao_info_free() in tcp_ao_destroy_sock(). The captured pointer is
    then walked at line 223:
    
            hlist_for_each_entry_rcu(key, &ao->head, node, ...)
    
    The writer's synchronous kfree() is free to complete between the line
    218 re-fetch and the line 223 hlist iteration. The slab is reused
    (or simply LIST_POISON1-stamped if not yet reused) and the iteration
    walks attacker-controlled or poison memory in softirq context.
    
    Reproducer (no debug shim, stock x86_64 v7.1-rc2 SMP+KASAN, QEMU+KVM):
    an unprivileged uid=1000 process inside CLONE_NEWUSER|CLONE_NEWNET
    installs TCP_MD5SIG + TCP_AO_ADD_KEY on a TCP socket, sprays forged
    TCP-AO segments toward its eventual 4-tuple via raw sockets, then
    calls connect(). The md5-wins reconciliation in tcp_connect() fires
    tcp_ao_destroy_sock(); the softirq backlog reader on the loopback
    NAPI path crashes on the freed ao->head.first walk:
    
      Oops: general protection fault, probably for non-canonical
        address 0xfbd59c000000002f
      KASAN: maybe wild-memory-access in range
        [0xdead000000000178-0xdead00000000017f]
      CPU: 0 UID: 1000 PID: 100 Comm: repro_userns
      RIP: 0010:__tcp_ao_do_lookup+0x107/0x1c0
      Call Trace: <IRQ>
        __tcp_ao_do_lookup+0x107/0x1c0
        tcp_ao_inbound_lookup.constprop.0+0x12a/0x200
        tcp_inbound_ao_hash+0x5ea/0x1520
        tcp_inbound_hash+0x7ce/0x1240
        tcp_v4_rcv+0x1e7a/0x3e10
        ...
    
    Restore the RCU grace period: re-add struct rcu_head to tcp_ao_info
    and replace the synchronous tcp_ao_info_free() with a call_rcu()
    callback. Readers that captured tp->ao_info before rcu_assign_pointer
    NULLed it now see the object remain valid until rcu_read_unlock().
    With the patch applied the reproducer runs cleanly for 2000 iterations
    on the same kernel build.
    
    Fixes: 51e547e8c89c ("tcp: Free TCP-AO/TCP-MD5 info/keys without RCU")
    Cc: stable@vger.kernel.org # v6.18+
    Reviewed-by: Dmitry Safonov <dima@arista.com>
    Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: Dmitry Safonov <0x7f454c46@gmail.com>
    Link: https://patch.msgid.link/20260625-tcp-md5-connect-v3-1-1fd313d6c1e0@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
time/jiffies: Register jiffies clocksource before usage [+ + +]
Author: Thomas Gleixner <tglx@kernel.org>
Date:   Tue Jun 9 17:14:45 2026 +0200

    time/jiffies: Register jiffies clocksource before usage
    
    commit f24df84cbe05e4471c04ac4b921fc0340bbc7752 upstream.
    
    Teddy reported that a XEN HVM has a long boot delay, which was bisected to
    the recent enhancements to the negative motion detection. It turned out
    that the jiffies clocksource is used in early boot before it is registered,
    which leaves the max_delta_raw field at zero. That causes the read out to
    be clamped to the max delta of 0, which means time is not making progress.
    
    Cure it by ensuring that it is initialized before its first usage in
    timekeeping_init().
    
    Fixes: 76031d9536a0 ("clocksource: Make negative motion detection more robust")
    Reported-by: Teddy Astie <teddy.astie@vates.tech>
    Signed-off-by: Thomas Gleixner <tglx@kernel.org>
    Tested-by: Teddy Astie <teddy.astie@vates.tech>
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/87y0gn3fve.ffs@fw13
    Closes: https://lore.kernel.org/all/1780914594.8631fc262581453bbf619ec5b2062170.19ea6c8227b000701b@vates.tech
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
timekeeping: Register default clocksource before taking tk_core.lock [+ + +]
Author: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Date:   Tue Jun 16 12:09:14 2026 +0500

    timekeeping: Register default clocksource before taking tk_core.lock
    
    commit 8fa30821180a9a19e78e9f4df1c0ba710252801e upstream.
    
    Commit f24df84cbe05 ("time/jiffies: Register jiffies clocksource before
    usage") moved the jiffies clocksource registration into
    clocksource_default_clock(), so that it is registered lazily on the first
    call. __clocksource_register() acquires clocksource_mutex, but the first
    caller is timekeeping_init(), which invokes clocksource_default_clock()
    while holding tk_core.lock, a raw spinlock.
    
    Acquiring a sleeping mutex while holding a raw spinlock is invalid.
    
    The default clocksource only has to be registered before
    tk_setup_internals() consumes its mult/shift/maxadj. Neither
    clocksource_default_clock(), the ->enable() callback, nor the registration
    itself need tk_core.lock, so fetch and enable the clock before acquiring
    the lock. This preserves the "register before usage" ordering while
    keeping clocksource_mutex out of the raw spinlock section.
    
    clocksource_default_clock() has a second caller,
    clocksource_done_booting(), which invokes it with clocksource_mutex already
    held. That path avoids a recursive lock because timekeeping_init() has
    already run and set cs_jiffies_registered, so the registration is skipped
    there. This change does not alter that; it only fixes the invalid wait
    context in timekeeping_init().
    
    Fixes: f24df84cbe05 ("time/jiffies: Register jiffies clocksource before usage")
    Signed-off-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
    Signed-off-by: Thomas Gleixner <tglx@kernel.org>
    Reported-by: Breno Leitao <leitao@debian.org>
    Reported-by: Oleg Nesterov <oleg@redhat.com>
    Reviewed-by: Breno Leitao <leitao@debian.org>
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20260616070914.65818-1-mikhail.v.gavrilov@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tipc: fix out-of-bounds read in broadcast Gap ACK blocks [+ + +]
Author: Samuel Page <sam@bynar.io>
Date:   Thu Jun 25 15:38:15 2026 +0100

    tipc: fix out-of-bounds read in broadcast Gap ACK blocks
    
    commit 2b66974a1b6134a4bbc3bfed181f7418f688eb54 upstream.
    
    A broadcast PROTOCOL/STATE_MSG can carry a Gap ACK blocks record in its
    data area. tipc_get_gap_ack_blks() only verifies that the record's len
    field is self-consistent with its ugack_cnt/bgack_cnt counts
    (sz == struct_size(p, gacks, ugack_cnt + bgack_cnt)); it does not check
    that the record actually fits in the message data area, msg_data_sz().
    
    The unicast caller tipc_link_proto_rcv() bounds it ("if (glen > dlen)
    break;"), but the broadcast caller tipc_bcast_sync_rcv() discards the
    returned size, so tipc_link_advance_transmq() copies the record off the
    receive skb with an attacker-controlled count:
    
            this_ga = kmemdup(ga, struct_size(ga, gacks, ga->bgack_cnt),
                              GFP_ATOMIC);
    
    A TIPC neighbour that negotiated TIPC_GAP_ACK_BLOCK triggers it with one
    ordinary broadcast STATE_MSG (msg_bc_ack_invalid() clear), sized so its
    data area is short, carrying a Gap ACK record with len = 0x400,
    bgack_cnt = 0xff and ugack_cnt = 0. len then equals
    struct_size(p, gacks, 255), so the consistency check passes and ga is
    non-NULL; kmemdup() reads struct_size(ga, gacks, 255) = 1024 bytes out
    of the much smaller skb:
    
      BUG: KASAN: slab-out-of-bounds in kmemdup_noprof+0x48/0x60
      Read of size 1024 at addr ffff0000c7030d38 by task poc864/69
      Call trace:
       kmemdup_noprof+0x48/0x60
       tipc_link_advance_transmq+0x86c/0xb80
       tipc_link_bc_ack_rcv+0x19c/0x1e0
       tipc_bcast_sync_rcv+0x1c4/0x2c4
       tipc_rcv+0x85c/0x1340
       tipc_l2_rcv_msg+0xac/0x104
      The buggy address belongs to the object at ffff0000c7030d00
       which belongs to the cache skbuff_small_head of size 704
      The buggy address is located 56 bytes inside of
       allocated 704-byte region [ffff0000c7030d00, ffff0000c7030fc0)
    
    The copied-out bytes are subsequently consumed as gap/ack values, but
    the read is already out of bounds at the kmemdup() regardless of how
    they are used.
    
    The unicast STATE path drops such a message: "if (glen > dlen) break;"
    skips the rest of STATE_MSG handling and the skb is freed. Make the
    broadcast path drop it too. tipc_bcast_sync_rcv() now bounds the record
    against msg_data_sz() and, when it does not fit, reports it back through
    tipc_node_bc_sync_rcv() to tipc_rcv() so the skb is discarded rather than
    processed. ga is not cleared on this path: ga == NULL already means
    "legacy peer without Selective ACK", a distinct legitimate state.
    
    Fixes: d7626b5acff9 ("tipc: introduce Gap ACK blocks for broadcast link")
    Cc: stable@vger.kernel.org
    Signed-off-by: Samuel Page <sam@bynar.io>
    Reviewed-by: Tung Nguyen <tung.quang.nguyen@est.tech>
    Link: https://patch.msgid.link/20260625143815.1525412-1-sam@bynar.io
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tools/mm/slabinfo: fix total_objects attribute name [+ + +]
Author: Yichong Chen <chenyichong@uniontech.com>
Date:   Fri Jun 12 15:13:59 2026 +0800

    tools/mm/slabinfo: fix total_objects attribute name
    
    commit 892a7864730775c3dbee2a39e9ead4fa8d4256e7 upstream.
    
    SLUB exports the total_objects sysfs attribute, but slabinfo tries to read
    objects_total. As a result, the lookup fails and the field remains zero.
    
    Use the correct attribute name and rename the corresponding structure
    member to match.
    
    Fixes: 205ab99dd103 ("slub: Update statistics handling for variable order slabs")
    Signed-off-by: Yichong Chen <chenyichong@uniontech.com>
    Cc: <stable@vger.kernel.org>
    Reviewed-by: SeongJae Park <sj@kernel.org>
    Link: https://patch.msgid.link/96556748872BB47E+20260612071359.649946-1-chenyichong@uniontech.com
    Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

tools/mm/slabinfo: Fix trace disable logic inversion [+ + +]
Author: Xuewen Wang <wangxuewen@kylinos.cn>
Date:   Mon May 18 14:21:57 2026 +0800

    tools/mm/slabinfo: Fix trace disable logic inversion
    
    commit 235ab68d67eadbef1fdbfb771f21f5bacc77a2ae upstream.
    
    The disable trace path in slab_debug() had a logic error where it would
    set trace=1 instead of trace=0. This made trace functionality permanently
    enabled once turned on for any slab cache.
    
    Fixes: a87615b8f9e2 ("SLUB: slabinfo upgrade")
    Cc: stable@vger.kernel.org
    Reviewed-by: SeongJae Park <sj@kernel.org>
    Signed-off-by: Xuewen Wang <wangxuewen@kylinos.cn>
    WARNING: From:/Signed-off-by: email address mismatch: 'From: wangxuewen <18810879172@163.com>' != 'Signed-off-by: wangxuewen <wangxuewen@kylinos.cn>'
    Link: https://patch.msgid.link/20260518062159.80664-2-wangxuewen@kylinos.cn
    Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tracing: Fix NULL pointer dereference in func_set_flag() [+ + +]
Author: Yuanhe Shu <xiangzao@linux.alibaba.com>
Date:   Wed Jun 24 14:17:15 2026 +0800

    tracing: Fix NULL pointer dereference in func_set_flag()
    
    commit c3e94604675e3db186111b8942650d86577df9b0 upstream.
    
    func_set_flag() dereferences tr->current_trace_flags before verifying
    that the current tracer is actually the function tracer. When the active
    tracer has been switched away from "function" (e.g., to "wakeup_rt"),
    tr->current_trace_flags can be NULL, leading to a NULL pointer
    dereference and kernel crash.
    
    The call chain that triggers this is:
    
      trace_options_write()
        -> __set_tracer_option()
          -> trace->set_flag()          /* func_set_flag */
    
    In func_set_flag(), the first operation is:
    
      if (!!set == !!(tr->current_trace_flags->val & bit))
    
    This dereferences tr->current_trace_flags unconditionally. The safety
    check that guards against a non-function tracer:
    
      if (tr->current_trace != &function_trace)
          return 0;
    
    is placed *after* the dereference, which is too late.
    
    This was observed with the following crash dump:
    
      BUG: unable to handle page fault at 0000000000000000
      RIP: func_set_flag+0xd
    
      Call Trace:
       __set_tracer_option+0x27
       trace_options_write+0x75
       vfs_write+0x12a
       ksys_write+0x66
       do_syscall_64+0x5b
    
      RIP: ffffffff914c973d  RSP: ff67ec88b01dfdf0  RFLAGS: 00010202
      RAX: 0000000000000000  RBX: ff3a826e80354580  RCX: 0000000000000001
      RDX: 0000000000000001  RSI: 0000000000000000  RDI: ffffffff93918080
    
    The disassembly confirms the fault:
    
      func_set_flag+0:   mov 0x1f08(%rdi), %rax  ; RAX = tr->current_trace_flags = NULL
      func_set_flag+13:  mov (%rax), %eax        ; page fault: dereference NULL
    
    At the time of the crash:
      tr->current_trace_flags = 0x0 (NULL)
      tr->current_trace = wakeup_rt_tracer (not function_trace)
    
    The scenario is that a process opens a function tracer option file (such
    as "func_stack_trace"), then the current tracer is switched to another
    tracer (e.g., "wakeup_rt"), which sets current_trace_flags to NULL. When
    the process subsequently writes to the option file, func_set_flag() is
    invoked and crashes on the NULL dereference.
    
    Fix this by moving the current_trace check before the
    current_trace_flags dereference, so that func_set_flag() returns early
    when the function tracer is not active.
    
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20260624061715.1445655-1-xiangzao@linux.alibaba.com
    Fixes: 76680d0d2825 ("tracing: Have function tracer define options per instance")
    Signed-off-by: Yuanhe Shu <xiangzao@linux.alibaba.com>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

tracing: Prevent out-of-bounds read in glob matching [+ + +]
Author: Huihui Huang <hhhuang@smu.edu.sg>
Date:   Wed Jul 1 18:28:46 2026 +0800

    tracing: Prevent out-of-bounds read in glob matching
    
    commit 0a6070839b1ef276d5b05bedfb787743e140fb17 upstream.
    
    String event fields are not necessarily NUL-terminated, so the filter
    predicate functions (filter_pred_string(), filter_pred_strloc() and
    filter_pred_strrelloc()) pass the field length to the regex match
    callbacks, and the length-aware matchers honour it.
    
    regex_match_glob() was the exception: it ignored the length and called
    glob_match(), which scans the string until it hits a NUL byte. Some
    string fields are not NUL-terminated. One example is the dynamic char
    array of the xfs_* namespace tracepoints, which is copied without a
    trailing NUL. For such a field, glob matching reads past the end of
    the event field, causing a KASAN slab-out-of-bounds read in
    glob_match(), reached via regex_match_glob() and filter_match_preds()
    from the xfs_lookup tracepoint.
    
    Add a length-bounded glob_match_len() and use it from regex_match_glob()
    so glob matching always stops at the field boundary. The matching loop
    is factored into a shared helper so glob_match() keeps its behaviour.
    
    Fixes: 60f1d5e3bac4 ("ftrace: Support full glob matching")
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/da1aaf125fc3b63320b0c540fd6afa7c3d5b4f1a.1782836943.git.hhhuang@smu.edu.sg
    Reported-by: Yuan Tan <yuantan098@gmail.com>
    Reported-by: Yifan Wu <yifanwucs@gmail.com>
    Reported-by: Juefei Pu <tomapufckgml@gmail.com>
    Reported-by: Zhengchuan Liang <zcliangcn@gmail.com>
    Reported-by: Xin Liu <bird@lzu.edu.cn>
    Assisted-by: Codex:GPT-5.4
    Signed-off-by: Huihui Huang <hhhuang@smu.edu.sg>
    Signed-off-by: Ren Wei <n05ec@lzu.edu.cn>
    Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
udf: validate free block extents against the partition length [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
Date:   Fri May 15 10:23:27 2026 -0400

    udf: validate free block extents against the partition length
    
    commit 5f0419457f89dce1a3f1c8e62a3adf2f39ab8168 upstream.
    
    udf_free_blocks() checks the logical block number and count against the
    partition length, but drops the extent offset from that final bound.  A
    crafted extent can pass the guard while logicalBlockNum + offset + count
    points past the partition, which later indexes past the space bitmap
    array.
    
    A single ftruncate(2) on a file backed by such an extent reliably
    panics the kernel.  This is a local availability issue.  On desktop
    systems where UDisks/polkit allows the active user to mount removable
    UDF media without CAP_SYS_ADMIN, an unprivileged local user can supply
    the crafted filesystem and trigger the panic by truncating a writable
    file on it.  Systems that require root or CAP_SYS_ADMIN to mount the
    image have a higher prerequisite.
    
    No confidentiality or integrity impact is claimed: the reproduced
    primitive is an out-of-bounds read of a bitmap pointer slot followed by
    a kernel panic.
    
    Use the already computed logicalBlockNum + offset + count value for the
    partition length check.  Also make load_block_bitmap() reject an
    out-of-range block group before indexing s_block_bitmap[], so corrupted
    callers cannot walk past the flexible array.
    
    Fixes: 56e69e59751d ("udf: prevent integer overflow in udf_bitmap_free_blocks()")
    Cc: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4-7
    Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
    Link: https://patch.msgid.link/20260515142327.1120767-1-michael.bommarito@gmail.com
    Signed-off-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

udf: validate sparing table length as an entry count, not a byte count [+ + +]
Author: Bryam Vargas <hexlabsecurity@proton.me>
Date:   Fri Jun 12 01:40:01 2026 -0500

    udf: validate sparing table length as an entry count, not a byte count
    
    commit 3ec997bd5508e9b25210b5bbec89031629cdb093 upstream.
    
    udf_load_sparable_map() accepts a sparing table when
    
            sizeof(*st) + le16_to_cpu(st->reallocationTableLen) > sb->s_blocksize
    
    is false, i.e. it treats reallocationTableLen as a number of BYTES that
    must fit in the block.  But the table is walked as an array of 8-byte
    sparingEntry elements:
    
            for (i = 0; i < le16_to_cpu(st->reallocationTableLen); i++) {
                    struct sparingEntry *entry = &st->mapEntry[i];
                    ... entry->origLocation ...
            }
    
    in udf_get_pblock_spar15() and udf_relocate_blocks().  A
    reallocationTableLen of N therefore passes the check whenever
    sizeof(*st) + N <= blocksize, yet the consumers index
    sizeof(*st) + N * sizeof(struct sparingEntry) bytes -- up to ~8x the
    block.  On a crafted UDF image this is an out-of-bounds read in
    udf_get_pblock_spar15(); udf_relocate_blocks() additionally feeds the
    same length to udf_update_tag(), whose crc_itu_t() reads far past the
    block, and its memmove() through st->mapEntry[] is an out-of-bounds
    write.
    
    Validate reallocationTableLen as the entry count it is, with
    struct_size().
    
    Fixes: 1df2ae31c724 ("udf: Fortify loading of sparing table")
    Cc: stable@vger.kernel.org
    Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>
    Link: https://patch.msgid.link/20260612-b4-disp-91780c4e-v1-1-f15112ff6882@proton.me
    Signed-off-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

udf: validate VAT header length against the VAT inode size [+ + +]
Author: Bryam Vargas <hexlabsecurity@proton.me>
Date:   Fri Jun 12 02:53:31 2026 -0500

    udf: validate VAT header length against the VAT inode size
    
    commit d8202786b3d75125c84ebc4de6d946f92fde0ee8 upstream.
    
    udf_load_vat() takes the virtual partition's start offset straight from
    the on-disk VAT 2.0 header without checking it against the VAT inode
    size:
    
            map->s_type_specific.s_virtual.s_start_offset =
                    le16_to_cpu(vat20->lengthHeader);
            map->s_type_specific.s_virtual.s_num_entries =
                    (sbi->s_vat_inode->i_size -
                            map->s_type_specific.s_virtual.s_start_offset) >> 2;
    
    lengthHeader is a fully attacker-controlled 16-bit value.  If it exceeds
    the VAT inode size, the s_num_entries subtraction underflows to a huge
    count, which defeats the "block > s_num_entries" bound in
    udf_get_pblock_virt15(); and on the ICB-inline path that function reads
    
            ((__le32 *)(iinfo->i_data + s_start_offset))[block]
    
    so a large s_start_offset indexes past the inode's in-ICB data.  Mounting
    a crafted UDF image with a virtual (VAT) partition then triggers an
    out-of-bounds read.
    
    Reject a VAT whose header length does not leave room for at least one
    entry within the VAT inode.
    
    Fixes: fa5e08156335 ("udf: Handle VAT packed inside inode properly")
    Cc: stable@vger.kernel.org
    Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>
    Link: https://patch.msgid.link/20260612-b4-disp-9a2317ee-v1-1-fefef5736154@proton.me
    Signed-off-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
udmabuf: fix DMA direction mismatch in release_udmabuf() [+ + +]
Author: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Date:   Sun Mar 15 04:27:22 2026 +0500

    udmabuf: fix DMA direction mismatch in release_udmabuf()
    
    commit fb7b1a0ab25a6077d26cb3829e31743972d4f31d upstream.
    
    begin_cpu_udmabuf() maps the sg_table with the caller-provided direction
    (e.g., DMA_TO_DEVICE for a write-only sync), and caches it in ubuf->sg
    for reuse.  However, release_udmabuf() always unmaps this sg_table with
    a hardcoded DMA_BIDIRECTIONAL, regardless of the direction that was
    originally used for the mapping.
    
    With CONFIG_DMA_API_DEBUG=y this produces:
    
      DMA-API: misc udmabuf: device driver frees DMA memory with different
      direction [device address=0x000000044a123000] [size=4096 bytes]
      [mapped with DMA_TO_DEVICE] [unmapped with DMA_BIDIRECTIONAL]
    
    The issue was found during video playback when GStreamer performed a
    write-only DMA_BUF_IOCTL_SYNC on a udmabuf.  It can be reproduced
    with CONFIG_DMA_API_DEBUG=y by creating a udmabuf from a memfd,
    performing a write-only sync (DMA_BUF_SYNC_WRITE without
    DMA_BUF_SYNC_READ), and closing the file descriptor.
    
    Fix this by storing the DMA direction used when the sg_table is first
    created in begin_cpu_udmabuf(), and passing that same direction to
    put_sg_table() in release_udmabuf().
    
    Fixes: 284562e1f348 ("udmabuf: implement begin_cpu_access/end_cpu_access hooks")
    Cc: stable@vger.kernel.org
    Signed-off-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
    Reviewed-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
    Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
    Link: https://patch.msgid.link/20260314232722.15555-1-mikhail.v.gavrilov@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
usb: cdc_acm: Add quirk for Uniden BC125AT scanner [+ + +]
Author: Jared Baldridge <jrb@expunge.us>
Date:   Sat May 30 18:19:48 2026 -0400

    usb: cdc_acm: Add quirk for Uniden BC125AT scanner
    
    commit 6eba58568f6cc3ff8515a00b05e258d8cfb72b72 upstream.
    
    Uniden BC125AT radio scanner has a USB interface which fails to work
    with the cdc_acm driver:
     usb 1-1: new full-speed USB device number 2 using uhci_hcd
     cdc_acm 1-1:1.0: Zero length descriptor references
     cdc_acm 1-1:1.0: probe with driver cdc_acm failed with error -22
     usbcore: registered new interface driver cdc_acm
    
    Adding the NO_UNION_NORMAL quirk for the device fixes the issue:
    
     usb 1-1: new full-speed USB device number 2 using uhci_hcd
     cdc_acm 1-1:1.0: ttyACM0: USB ACM device
     usbcore: registered new interface driver cdc_acm
    
    `lsusb -v` of the device:
    
     Bus 001 Device 002: ID 1965:0017 Uniden Corporation BC125AT
     Negotiated speed: Full Speed (12Mbps)
     Device Descriptor:
       bLength                18
       bDescriptorType         1
       bcdUSB               2.00
       bDeviceClass            2 Communications
       bDeviceSubClass         0 [unknown]
       bDeviceProtocol         0
       bMaxPacketSize0        64
       idVendor           0x1965 Uniden Corporation
       idProduct          0x0017 BC125AT
       bcdDevice            0.01
       iManufacturer           1 Uniden America Corp.
       iProduct                2 BC125AT
       iSerial                 3 0001
       bNumConfigurations      1
       Configuration Descriptor:
         bLength                 9
         bDescriptorType         2
         wTotalLength       0x0030
         bNumInterfaces          2
         bConfigurationValue     1
         iConfiguration          0
         bmAttributes         0x80
           (Bus Powered)
         MaxPower              500mA
         Interface Descriptor:
           bLength                 9
           bDescriptorType         4
           bInterfaceNumber        0
           bAlternateSetting       0
           bNumEndpoints           1
           bInterfaceClass         2 Communications
           bInterfaceSubClass      2 Abstract (modem)
           bInterfaceProtocol      0
           iInterface              0
           Endpoint Descriptor:
             bLength                 7
             bDescriptorType         5
             bEndpointAddress     0x87  EP 7 IN
             bmAttributes            3
               Transfer Type            Interrupt
               Synch Type               None
               Usage Type               Data
             wMaxPacketSize     0x0008  1x 8 bytes
             bInterval              10
         Interface Descriptor:
           bLength                 9
           bDescriptorType         4
           bInterfaceNumber        1
           bAlternateSetting       0
           bNumEndpoints           2
           bInterfaceClass        10 CDC Data
           bInterfaceSubClass      0 [unknown]
           bInterfaceProtocol      0
           iInterface              0
           Endpoint Descriptor:
             bLength                 7
             bDescriptorType         5
             bEndpointAddress     0x81  EP 1 IN
             bmAttributes            2
               Transfer Type            Bulk
               Synch Type               None
               Usage Type               Data
             wMaxPacketSize     0x0040  1x 64 bytes
             bInterval               0
           Endpoint Descriptor:
             bLength                 7
             bDescriptorType         5
             bEndpointAddress     0x02  EP 2 OUT
             bmAttributes            2
               Transfer Type            Bulk
               Synch Type               None
               Usage Type               Data
             wMaxPacketSize     0x0040  1x 64 bytes
             bInterval               0
     Device Status:     0x0000
       (Bus Powered)
    
    Signed-off-by: Jared Baldridge <jrb@expunge.us>
    Cc: stable <stable@kernel.org>
    Link: https://patch.msgid.link/20260530221959.612526-1-jrb@expunge.us
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: cdnsp: fix stream context array leak in cdnsp_alloc_stream_info() [+ + +]
Author: Haoxiang Li <haoxiang_li2024@163.com>
Date:   Mon Jun 22 13:26:27 2026 +0800

    usb: cdnsp: fix stream context array leak in cdnsp_alloc_stream_info()
    
    commit 3348f444a4ce43dd5c2d1aa41634cb6eff33aa64 upstream.
    
    cdnsp_alloc_stream_info() allocates stream_info->stream_ctx_array with
    cdnsp_alloc_stream_ctx(). If a later stream ring allocation or stream
    mapping update fails, the error path frees the allocated stream rings
    and stream_rings array, but leaves stream_ctx_array allocated.
    
    Free the stream context array before falling through to the stream_rings
    cleanup path.
    
    Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
    Acked-by: Peter Chen <peter.chen@kernel.org>
    Link: https://patch.msgid.link/20260622052627.696373-1-haoxiang_li2024@163.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
USB: chaoskey: Fix slab-use-after-free in chaoskey_release() [+ + +]
Author: Alan Stern <stern@rowland.harvard.edu>
Date:   Tue Jun 9 13:37:36 2026 -0400

    USB: chaoskey: Fix slab-use-after-free in chaoskey_release()
    
    commit abf76d3239dee97b66e7241ad04811f1ce562e28 upstream.
    
    The chaoskey driver has a use-after-free bug in its release routine.
    If the user closes the device file after the USB device has been
    unplugged, a debugging log statement will try to access the
    usb_interface structure after it has been deallocated:
    
            BUG: KASAN: slab-use-after-free in dev_driver_string (drivers/base/core.c:2406)
            Read of size 8 at addr ffff888168e8a0b8 by task chaoskey_raw_re/10106
    
            Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
            Call Trace:
             <TASK>
             dump_stack_lvl (lib/dump_stack.c:94 lib/dump_stack.c:120)
             print_report (mm/kasan/report.c:378 mm/kasan/report.c:482)
             kasan_report (mm/kasan/report.c:595)
             dev_driver_string (drivers/base/core.c:2406)
             __dynamic_dev_dbg (lib/dynamic_debug.c:906)
             chaoskey_release (drivers/usb/misc/chaoskey.c:323)
             __fput (fs/file_table.c:510)
             fput_close_sync (fs/file_table.c:615)
             __x64_sys_close (fs/open.c:1507 fs/open.c:1492 fs/open.c:1492)
             do_syscall_64 (arch/x86/entry/syscall_64.c:63 arch/x86/entry/syscall_64.c:94)
             entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121)
    
    The driver's last reference to the interface structure is dropped in
    the chaoskey_free() routine, so the code must not use the interface --
    even in a debugging statement -- after that routine returns.
    (Exception: If we know that another reference is held by someone else,
    such as the device core while the disconnect routine runs, there's no
    problem.  Thanks to Johan Hovold for pointing this out.)
    
    Since the bad access is part of an unimportant debugging statement,
    we can fix the problem simply by removing the whole statement.
    
    Reported-by: Shuangpeng Bai <shuangpeng.kernel@gmail.com>
    Closes: https://lore.kernel.org/linux-usb/20EC9664-054E-438B-B411-2145D347F97B@gmail.com/
    Tested-by: Shuangpeng Bai <shuangpeng.kernel@gmail.com>
    Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
    Fixes: 66e3e591891d ("usb: Add driver for Altus Metrum ChaosKey device (v2)")
    Cc: stable <stable@kernel.org>
    Reviewed-by: Johan Hovold <johan@kernel.org>
    Link: https://patch.msgid.link/bb5b1dc6-eb59-43e1-8d26-51e658e88bbe@rowland.harvard.edu
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: core: add USB_QUIRK_NO_LPM for VIA Labs USB 2.0 hub [+ + +]
Author: Rodrigo Lugathe da Conceição Alves <lugathe2@gmail.com>
Date:   Wed Jun 3 08:36:26 2026 -0300

    USB: core: add USB_QUIRK_NO_LPM for VIA Labs USB 2.0 hub
    
    commit bd728c3d9b1cc0bb0fda6a7055c5c8b55d7477b2 upstream.
    
    The VIA Labs, Inc. USB 2.0 hub controller (2109:2817),
    found in a KVM switch, fails to enumerate high-power devices during
    cold boot and system restart.
    
    Applying the kernel parameter
      usbcore.quirks=2109:2817:k
    resolves the issue.
    
    Enumeration failure log:
      usb 1-1.2.3: device descriptor read/64, error -32
      usb 1-1.2.3: Device not responding to setup address.
      usb 1-1.2.3: device not accepting address 11, error -71
      usb 1-1.2-port3: unable to enumerate USB device
    
    Add USB_QUIRK_NO_LPM for this device.
    
    Signed-off-by: Rodrigo Lugathe da Conceição Alves <lugathe2@gmail.com>
    Cc: stable <stable@kernel.org>
    Link: https://patch.msgid.link/20260603113626.395612-1-lugathe2@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
usb: dwc3: fix dwc3_readl() and dwc3_writel() calls in dwc3_ulpi_setup() [+ + +]
Author: Ben Dooks <ben.dooks@codethink.co.uk>
Date:   Fri Jul 3 17:20:33 2026 +0100

    usb: dwc3: fix dwc3_readl() and dwc3_writel() calls in dwc3_ulpi_setup()
    
    commit e0f844d9d74200d311c6438a0f04270834ba5365 upstream.
    
    The dwc3_ulpi_setup() calls the register read and write calls with
    dwc3->regs when both these calls take the dwc3 structure directly.
    
    Chnage these two calls to fix the following sparse warning, and
    possibly a nasty bug in the dwc3_ulpi_setup() code:
    
    drivers/usb/dwc3/core.c:796:45: warning: incorrect type in argument 1 (different address spaces)
    drivers/usb/dwc3/core.c:796:45:    expected struct dwc3 *dwc
    drivers/usb/dwc3/core.c:796:45:    got void [noderef] __iomem *regs
    drivers/usb/dwc3/core.c:798:40: warning: incorrect type in argument 1 (different address spaces)
    drivers/usb/dwc3/core.c:798:40:    expected struct dwc3 *dwc
    drivers/usb/dwc3/core.c:798:40:    got void [noderef] __iomem *regs
    
    Cc: stable <stable@kernel.org>
    Fixes: 9accc68b1cf0 ("usb: dwc3: Add dwc pointer to dwc3_readl/writel")
    Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
    Link: https://patch.msgid.link/20260703162033.2847599-1-ben.dooks@codethink.co.uk
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: dwc3: meson-g12a: fix refcount leak in dwc3_meson_g12a_resume() [+ + +]
Author: WenTao Liang <vulab@iscas.ac.cn>
Date:   Thu Jun 11 21:11:21 2026 +0800

    usb: dwc3: meson-g12a: fix refcount leak in dwc3_meson_g12a_resume()
    
    commit 692c354bef03b77b30e57e61934da502c8a12d45 upstream.
    
    If dwc3_meson_g12a_resume() succeeds in calling
    reset_control_reset(), an internal triggered_count reference is
    acquired. If any later step fails (usb_init, phy_init,
    phy_power_on, regulator_enable, or usb_post_init), the function
    returns the error without rearming the reset control. This leaks
    the reference and leaves the reset control in a triggered state,
    causing future reset_control_reset() calls to incorrectly return
    early as if already reset.
    
    Add an error path that calls reset_control_rearm() to balance
    the reference before returning the error.
    
    Cc: stable <stable@kernel.org>
    Fixes: 5b0ba0caaf3a ("usb: dwc3: meson-g12a: refactor usb init")
    Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>
    Link: https://patch.msgid.link/20260611131121.81784-1-vulab@iscas.ac.cn
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: dwc3: run gadget disconnect from sleepable suspend context [+ + +]
Author: Runyu Xiao <runyu.xiao@seu.edu.cn>
Date:   Fri Jun 12 13:20:05 2026 +0800

    usb: dwc3: run gadget disconnect from sleepable suspend context
    
    commit 010382937fb69892b3469ac4d30af072262f59e8 upstream.
    
    dwc3_gadget_suspend() takes dwc->lock with IRQs disabled and then calls
    dwc3_disconnect_gadget().  For async callbacks that helper only uses
    plain spin_unlock()/spin_lock(), so the gadget ->disconnect() callback
    still runs with IRQs disabled and any sleepable callback trips Lockdep.
    
    This issue was found by our static analysis tool and then manually
    reviewed against the current tree.
    
    The grounded PoC kept the dwc3_gadget_suspend() ->
    dwc3_disconnect_gadget() -> gadget_driver->disconnect() chain, and
    Lockdep reported:
    
      BUG: sleeping function called from invalid context
      gadget_disconnect+0x21/0x39 [vuln_msv]
      dwc3_gadget_suspend.constprop.0+0x2b/0x42 [vuln_msv]
    
    Keep the disconnect callback selection in one common helper, but add a
    sleepable suspend-side wrapper which snapshots the callback under
    dwc->lock and then runs it after spin_unlock_irqrestore().  The regular
    event path still uses the existing spin_unlock()/spin_lock() window.
    
    Fixes: c8540870af4c ("usb: dwc3: gadget: Improve dwc3_gadget_suspend() and dwc3_gadget_resume()")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
    Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Link: https://patch.msgid.link/20260612052005.3849659-1-runyu.xiao@seu.edu.cn
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: free iso schedules on failed submit [+ + +]
Author: Dawei Feng <dawei.feng@seu.edu.cn>
Date:   Tue Jun 30 15:14:19 2026 +0800

    usb: free iso schedules on failed submit
    
    commit b9399d25fbb34a05bbe76eeedd730f62ff2670e9 upstream.
    
    EHCI and FOTG210 isochronous submits build an ehci_iso_sched before
    linking the URB to the endpoint queue, and keep the staged schedule in
    urb->hcpriv until iso_stream_schedule() and the link helpers consume it.
    If the controller is no longer accessible, or usb_hcd_link_urb_to_ep()
    fails, submit jumps to done_not_linked before that handoff happens and
    leaks the staged schedule still attached to urb->hcpriv.
    
    Free the staged schedule from done_not_linked when submit fails before
    the URB is linked and clear urb->hcpriv after the free.
    
    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. As we do not have an
    EHCI host controller with a USB isochronous device to test with, no
    runtime testing was able to be performed.
    
    Fixes: 8de98402652c ("[PATCH] USB: Fix USB suspend/resume crasher (#2)")
    Fixes: e9df41c5c589 ("USB: make HCDs responsible for managing endpoint queues")
    Fixes: 7d50195f6c50 ("usb: host: Faraday fotg210-hcd driver")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Dawei Feng <dawei.feng@seu.edu.cn>
    Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
    Link: https://patch.msgid.link/20260630071419.349161-1-dawei.feng@seu.edu.cn
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: gadget: composite: fix dead empty check in the USB_DT_OTG handler [+ + +]
Author: Maoyi Xie <maoyixie.tju@gmail.com>
Date:   Wed May 27 23:08:32 2026 +0800

    usb: gadget: composite: fix dead empty check in the USB_DT_OTG handler
    
    commit f8f680609c2b3ab795ffcd6f21585b6dfc46d395 upstream.
    
    The OTG branch of composite_setup() falls back to the first
    configuration when none is selected:
    
            if (cdev->config)
                    config = cdev->config;
            else
                    config = list_first_entry(&cdev->configs,
                                              struct usb_configuration, list);
            if (!config)
                    goto done;
            ...
            memcpy(req->buf, config->descriptors[0], value);
    
    list_first_entry() never returns NULL. On an empty list it returns
    container_of() of the list head. So the "if (!config)" check is dead.
    
    When cdev->configs is empty, config points at the head inside struct
    usb_composite_dev. config->descriptors[0] reads whatever sits at that
    offset. The memcpy copies up to w_length bytes of it into the response
    buffer.
    
    cdev->configs can be empty in two cases. One is a teardown race on
    gadget unbind with a control transfer in flight. The other is a driver
    that sets is_otg before it adds a config. A reproducer that holds
    cdev->configs empty triggers a KASAN fault in this branch.
    
    Use list_first_entry_or_null() so the existing check does its job.
    
    Fixes: 53e6242db8d6 ("usb: gadget: composite: add USB_DT_OTG request handling")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Maoyi Xie <maoyixie.tju@gmail.com>
    Link: https://patch.msgid.link/20260527150832.2943293-1-maoyixie.tju@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: gadget: f_fs: Fix DMA fence leak [+ + +]
Author: Paul Cercueil <paul@crapouillou.net>
Date:   Tue Jun 9 17:29:05 2026 +0200

    usb: gadget: f_fs: Fix DMA fence leak
    
    commit baa6b6068a3f2bf2ed525a1cb37975905dadc658 upstream.
    
    In ffs_dmabuf_transfer(), a ffs_dma_fence object is kmalloc'd, with the
    underlying dma_fence later initialized by dma_fence_init(), which sets
    its kref counter to 1. Then, dma_resv_add_fence() gets a second
    reference, and a pointer to the ffs_dma_fence is passed as the
    usb_request's "context" field.
    
    The dma-resv mechanism will manage the second reference, but the first
    reference is never properly released; the ffs_dmabuf_cleanup() function
    decreases the reference count, but only to balance with the reference
    grab in ffs_dmabuf_signal_done().
    
    The code will then slowly leak memory as more ffs_dma_fence objects are
    created without being ever freed.
    
    Address this issue by transferring ownership of the fence to the DMA
    reservation object, by calling dma_fence_put() right after
    dma_resv_add_fence(). The ffs_dma_fence then gets properly discarded
    after being signalled.
    
    Fixes: 7b07a2a7ca02 ("usb: gadget: functionfs: Add DMABUF import interface")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Paul Cercueil <paul@crapouillou.net>
    Tested-by: Nuno Sá <nuno.sa@analog.com>
    Reviewed-by: Nuno Sá <nuno.sa@analog.com>
    Link: https://patch.msgid.link/20260609152905.729328-1-paul@crapouillou.net
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: gadget: f_fs: Initialize epfile->in early to fix endpoint direction checks [+ + +]
Author: Neill Kapron <nkapron@google.com>
Date:   Fri Jun 19 04:06:03 2026 +0000

    usb: gadget: f_fs: Initialize epfile->in early to fix endpoint direction checks
    
    commit 82cfd4739011bdc7e87b5d585703427e89ddfaa5 upstream.
    
    When parsing endpoint descriptors, ffs_data_got_descs() generates the
    eps_addrmap which contains the endpoint direction. However, epfile->in
    was previously only populated in ffs_func_eps_enable() which executes
    upon USB host connection. As a result, early userspace ioctls like
    FUNCTIONFS_DMABUF_ATTACH that run before the host connects would see
    epfile->in as 0, leading to incorrect DMA directions.
    
    By moving the initialization to ffs_epfiles_create(), epfile->in is
    accurate before userspace opens the endpoint files.
    
    Fixes: 7b07a2a7ca02 ("usb: gadget: functionfs: Add DMABUF import interface")
    Cc: stable <stable@kernel.org>
    Assisted-by: Antigravity:gemini-3.1-pro
    Signed-off-by: Neill Kapron <nkapron@google.com>
    Link: https://patch.msgid.link/20260619040609.4010746-2-nkapron@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: gadget: f_fs: initialize reset_work at allocation time [+ + +]
Author: Tyler Baker <tyler.baker@oss.qualcomm.com>
Date:   Tue Jun 9 15:36:34 2026 -0400

    usb: gadget: f_fs: initialize reset_work at allocation time
    
    commit 3137b243c93982fe3460335e12f9247739766e10 upstream.
    
    ffs_fs_kill_sb() unconditionally calls cancel_work_sync() on
    ffs->reset_work when a functionfs instance is unmounted:
    
            ffs_data_reset(ffs);
            cancel_work_sync(&ffs->reset_work);
    
    However ffs->reset_work is only ever initialized via INIT_WORK() in
    ffs_func_set_alt() and ffs_func_disable(), and only on the
    FFS_DEACTIVATED path. That state is reached solely by ffs_data_closed()
    when the instance is mounted with the "no_disconnect" option, so for the
    common case (no "no_disconnect", or mounted and unmounted without ever
    being deactivated) reset_work is never initialized.
    
    ffs_data_new() allocates the ffs_data with kzalloc_obj() and does not
    initialize reset_work, and ffs_data_reset()/ffs_data_clear() do not touch
    it either, so reset_work.func is left NULL. cancel_work_sync() on such a
    work then trips the WARN_ON(!work->func) guard in __flush_work():
    
      WARNING: kernel/workqueue.c:4301 at __flush_work+0x330/0x360, CPU#3: umount
      Call trace:
       __flush_work
       cancel_work_sync
       ffs_fs_kill_sb [usb_f_fs]
       deactivate_locked_super
       deactivate_super
       cleanup_mnt
       __cleanup_mnt
       task_work_run
       exit_to_user_mode_loop
       el0_svc
    
    On older kernels cancel_work_sync() on a zero-initialized work struct was
    a silent no-op, which hid the missing initialization.
    
    Initialize reset_work once in ffs_data_new() so it is always valid for
    the lifetime of the ffs_data, and drop the now-redundant INIT_WORK()
    calls from the two deactivation paths.
    
    Fixes: 18d6b32fca38 ("usb: gadget: f_fs: add "no_disconnect" mode")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Tyler Baker <tyler.baker@oss.qualcomm.com>
    Cc: Loic Poulain <loic.poulain@oss.qualcomm.com>
    Cc: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
    Cc: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
    Tested-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
    Reviewed-by: Peter Chen <peter.chen@kernel.org>
    Acked-by: Michał Nazarewicz <mina86@mina86.com>
    Link: https://patch.msgid.link/20260609193635.2284430-1-tyler.baker@oss.qualcomm.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: gadget: f_fs: Tie read_buffer lifetime to ffs_epfile [+ + +]
Author: Neill Kapron <nkapron@google.com>
Date:   Fri Jun 19 04:06:04 2026 +0000

    usb: gadget: f_fs: Tie read_buffer lifetime to ffs_epfile
    
    commit 8bdcf96eb135aebacac319667f87db034fb38406 upstream.
    
    Currently, ffs_epfile_release unconditionally frees the endpoint's
    read_buffer when a file descriptor is closed. If userspace explicitly
    opens the endpoint multiple times and closes one, the read_buffer is
    destroyed. This can lead to silent data loss if other file descriptors
    are still actively reading from the endpoint.
    
    By tying the lifetime of the read_buffer to the ffs_epfile structure itself
    (which is destroyed when the functionfs instance is torn down in
    ffs_epfiles_destroy), we eliminate the brittle dependency on open/release
    calls while correctly matching the conceptual lifetime of unread data on
    the hardware endpoint.
    
    Fixes: 9353afbbfa7b ("usb: gadget: f_fs: buffer data from ‘oversized’ OUT requests")
    Cc: stable <stable@kernel.org>
    Assisted-by: Antigravity:gemini-3.1-pro
    Signed-off-by: Neill Kapron <nkapron@google.com>
    Link: https://patch.msgid.link/20260619040609.4010746-3-nkapron@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: gadget: f_printer: take kref only for successful open [+ + +]
Author: Xu Rao <raoxu@uniontech.com>
Date:   Fri Jun 26 14:46:17 2026 +0800

    usb: gadget: f_printer: take kref only for successful open
    
    commit 30adce93d5c4a5a1ec29d9249e3fdfcc391d406b upstream.
    
    printer_open() returns -EBUSY when the character device is already
    open, but it increments dev->kref regardless of the return value. VFS
    does not call ->release() for a failed open, so every rejected second
    open permanently leaks one reference.
    
    Move kref_get() into the successful-open branch.
    
    Fixes: e8d5f92b8d30 ("usb: gadget: function: printer: fix use-after-free in __lock_acquire")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Xu Rao <raoxu@uniontech.com>
    Link: https://patch.msgid.link/80295742B820DA9B+20260626064617.4090626-1-raoxu@uniontech.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: gadget: function: rndis: add length check for header [+ + +]
Author: Griffin Kroah-Hartman <griffin@kroah.com>
Date:   Wed Jul 8 13:08:59 2026 +0200

    usb: gadget: function: rndis: add length check for header
    
    commit 21b5bf155435008e0fb0736795289788e63d426f upstream.
    
    Add a length check for the rndis header in rndis_rm_hdr, to ensure that
    MessageType, MessageLength, DataOffset, and DataLength fields are
    present before they are accessed.
    
    Assisted-by: gkh_clanker_2000
    Cc: stable <stable@kernel.org>
    Signed-off-by: Griffin Kroah-Hartman <griffin@kroah.com>
    Link: https://patch.msgid.link/20260708-usb-gadget-rndis-v1-2-e77e026dcc6a@kroah.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: gadget: function: rndis: add length check to response query [+ + +]
Author: Griffin Kroah-Hartman <griffin@kroah.com>
Date:   Wed Jul 8 13:08:58 2026 +0200

    usb: gadget: function: rndis: add length check to response query
    
    commit 95f90eea070837f7c72207d5520f805bdefc3bc5 upstream.
    
    Add variable representations for BufLength and BufOffset in
    rndis_query_response(), and perform a length check on them.
    
    This is identical to how rndis_set_response() handles these parameters.
    
    Assisted-by: gkh_clanker_2000
    Cc: stable <stable@kernel.org>
    Signed-off-by: Griffin Kroah-Hartman <griffin@kroah.com>
    Link: https://patch.msgid.link/20260708-usb-gadget-rndis-v1-1-e77e026dcc6a@kroah.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: gadget: udc: Fix use-after-free in gadget_match_driver [+ + +]
Author: Jimmy Hu <hhhuuu@google.com>
Date:   Thu Jun 25 15:37:04 2026 +0800

    usb: gadget: udc: Fix use-after-free in gadget_match_driver
    
    commit 67e511d2989eb1c8c588b599ce2fcc6bb8e6f7ea upstream.
    
    The udc structure acts as the management structure for the gadget,
    but their lifecycles are decoupled. A race condition exists where
    usb_del_gadget() frees the udc memory (e.g., via mode-switch work)
    while gadget_match_driver() concurrently accesses the freed udc memory
    (e.g., via configfs), causing a Use-After-Free (UAF) that triggers a
    NULL pointer dereference when the freed memory is zeroed:
    
    [39430.908615][ T1171] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
    [39430.911397][ T1171] pc : __pi_strcmp+0x20/0x140
    [39430.911441][ T1171] lr : gadget_match_driver+0x34/0x60
    ...
    [39430.911890][ T1171]  usb_gadget_register_driver_owner+0x50/0xf8
    [39430.911910][ T1171]  gadget_dev_desc_UDC_store+0xf4/0x140
    [39430.931308][ T1171]  configfs_write_iter+0xec/0x134
    
    [39430.957058][ T1171] Workqueue: events_freezable __dwc3_set_mode
    [39430.957287][ T1171]  dwc3_gadget_exit+0x34/0x8c
    [39430.957304][ T1171]  __dwc3_set_mode+0xc0/0x664
    
    Fix this by ensuring the udc structure remains allocated until the
    gadget is released. To achieve this, introduce a new
    usb_gadget_release() routine to the core. When the gadget is added,
    usb_add_gadget() stores the gadget's release routine in the udc
    structure and takes a reference to the udc. When the gadget is
    released, usb_gadget_release() drops the reference to the udc and
    then calls the gadget's release routine.
    
    Suggested-by: Alan Stern <stern@rowland.harvard.edu>
    Cc: stable <stable@kernel.org>
    Signed-off-by: Jimmy Hu <hhhuuu@google.com>
    Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
    Link: https://patch.msgid.link/20260625073705.803880-1-hhhuuu@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
USB: idmouse: fix use-after-free on disconnect race [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Mon Jun 22 17:26:10 2026 +0200

    USB: idmouse: fix use-after-free on disconnect race
    
    commit ff002c153f9722caece3983cc23dc4d9d4652cb4 upstream.
    
    mutex_unlock() may access the mutex structure after releasing the lock
    and therefore cannot be used to manage lifetime of objects directly
    (unlike spinlocks and refcounts). [1][2]
    
    Use a kref to release the driver data to avoid use-after-free in
    mutex_unlock() when release() races with disconnect().
    
    [1] a51749ab34d9 ("locking/mutex: Document that mutex_unlock() is
                       non-atomic")
    [2] 2b9d9e0a9ba0 ("locking/mutex: Clarify that mutex_unlock(), and most
                       other sleeping locks, can still use the lock object
                       after it's unlocked")
    
    Fixes: 54d2bc068fd2 ("USB: fix locking in idmouse")
    Cc: stable@vger.kernel.org      # 2.6.24
    Cc: Oliver Neukum <oliver@neukum.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Link: https://patch.msgid.link/20260622152612.116422-3-johan@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: iowarrior: fix use-after-free on disconnect [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Sat May 23 19:05:23 2026 +0200

    USB: iowarrior: fix use-after-free on disconnect
    
    commit bc0e4f16c44e50daa0b1ea729934baa3b4815dee upstream.
    
    Submitted write URBs are not stopped on close() and therefore need to be
    stopped unconditionally on disconnect() to avoid use-after-free in the
    completion handler.
    
    Fixes: b5f8d46867ca ("USB: iowarrior: fix use-after-free after driver unbind")
    Fixes: 946b960d13c1 ("USB: add driver for iowarrior devices.")
    Reported-by: syzbot+ad2aac2febc3bedf0962@syzkaller.appspotmail.com
    Link: https://lore.kernel.org/all/6a0ce39b.170a0220.39a13.0007.GAE@google.com/
    Cc: stable <stable@kernel.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Link: https://patch.msgid.link/20260523170523.1074563-1-johan@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: iowarrior: fix use-after-free on disconnect race [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Mon Jun 22 17:26:09 2026 +0200

    USB: iowarrior: fix use-after-free on disconnect race
    
    commit c602254ba4c10f60a73cd99d147874f86a3f485c upstream.
    
    mutex_unlock() may access the mutex structure after releasing the lock
    and therefore cannot be used to manage lifetime of objects directly
    (unlike spinlocks and refcounts). [1][2]
    
    Use a kref to release the driver data to avoid use-after-free in
    mutex_unlock() when release() races with disconnect().
    
    [1] a51749ab34d9 ("locking/mutex: Document that mutex_unlock() is non-atomic")
    [2] 2b9d9e0a9ba0 ("locking/mutex: Clarify that mutex_unlock(), and most
                       other sleeping locks, can still use the lock object
                       after it's unlocked")
    
    Fixes: 946b960d13c1 ("USB: add driver for iowarrior devices.")
    Cc: stable <stable@kernel.org>
    Reported-by: Yue Sun <samsun1006219@gmail.com>
    Link: https://lore.kernel.org/r/20260618080204.38322-1-samsun1006219@gmail.com
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Link: https://patch.msgid.link/20260622152612.116422-2-johan@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: ldusb: fix use-after-free on disconnect race [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Mon Jun 22 17:26:11 2026 +0200

    USB: ldusb: fix use-after-free on disconnect race
    
    commit 19bdfc7b3c179331eafa423d87e1336f43bbfeb8 upstream.
    
    mutex_unlock() may access the mutex structure after releasing the lock
    and therefore cannot be used to manage lifetime of objects directly
    (unlike spinlocks and refcounts). [1][2]
    
    Use a kref to release the driver data to avoid use-after-free in
    mutex_unlock() when release() races with disconnect().
    
    [1] a51749ab34d9 ("locking/mutex: Document that mutex_unlock() is
                       non-atomic")
    [2] 2b9d9e0a9ba0 ("locking/mutex: Clarify that mutex_unlock(), and most
                       other sleeping locks, can still use the lock object
                       after it's unlocked")
    
    Fixes: ce0d7d3f575f ("usb: ldusb: ld_usb semaphore to mutex")
    Cc: stable <stable@kernel.org>
    Cc: Daniel Walker <dwalker@mvista.com>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Link: https://patch.msgid.link/20260622152612.116422-4-johan@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: legousbtower: fix use-after-free on disconnect race [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Mon Jun 22 17:26:12 2026 +0200

    USB: legousbtower: fix use-after-free on disconnect race
    
    commit 62fc8eb1b1481051f7bab4aa93d79809053dd09f upstream.
    
    mutex_unlock() may access the mutex structure after releasing the lock
    and therefore cannot be used to manage lifetime of objects directly
    (unlike spinlocks and refcounts). [1][2]
    
    Use a kref to release the driver data to avoid use-after-free in
    mutex_unlock() when release() races with disconnect().
    
    [1] a51749ab34d9 ("locking/mutex: Document that mutex_unlock() is
                       non-atomic")
    [2] 2b9d9e0a9ba0 ("locking/mutex: Clarify that mutex_unlock(), and most
                       other sleeping locks, can still use the lock object
                       after it's unlocked")
    
    Fixes: 18bcbcfe9ca2 ("USB: misc: legousbtower: semaphore to mutex")
    Cc: stable <stable@kernel.org>
    Cc: Daniel Walker <dwalker@mvista.com>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Link: https://patch.msgid.link/20260622152612.116422-5-johan@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
usb: misc: usbio: bound bulk IN response length to the received transfer [+ + +]
Author: HE WEI (ギカク) <skyexpoc@gmail.com>
Date:   Wed Jun 24 18:09:52 2026 +0900

    usb: misc: usbio: bound bulk IN response length to the received transfer
    
    commit 8c6314489550fa81d41723a0ff33f655b5b6c7b6 upstream.
    
    usbio_bulk_msg() copies bpkt_len = le16_to_cpu(bpkt->len) bytes out of
    the bulk IN buffer (usbio->rxbuf, allocated with size usbio->rxbuf_len)
    into the caller's buffer.  bpkt_len is fully controlled by the device
    and is only checked against ibuf_len; ibuf_len in turn is checked
    against usbio->txbuf_len, not against rxbuf_len:
    
            if ((obuf_len > (usbio->txbuf_len - sizeof(*bpkt))) ||
                (ibuf_len > (usbio->txbuf_len - sizeof(*bpkt))))
                    return -EMSGSIZE;
    
    txbuf_len and rxbuf_len are taken independently from the bulk OUT and
    bulk IN endpoint wMaxPacketSize in usbio_probe().  A malicious or
    malfunctioning device that advertises a large bulk OUT endpoint and a
    small bulk IN endpoint (e.g. by claiming one of the quirk-free IDs such
    as the Lattice NX33U, 0x2ac1:0x20cb) therefore makes ibuf_len, and
    hence the device-supplied bpkt_len, exceed rxbuf_len.  memcpy() then
    reads up to txbuf_len - rxbuf_len bytes past the end of the rxbuf slab
    object.  The over-read bytes are handed back to the i2c layer and on to
    user space through i2c-dev, disclosing adjacent slab memory; with KASAN
    this is reported as a slab-out-of-bounds read.
    
    The number of bytes actually received is already known: act equals the
    URB actual_length and is bounded by rxbuf_len.  Reject any response
    that claims more payload than was received, mirroring the existing
    "act < sizeof(*bpkt)" check just above.
    
    The control path (usbio_ctrl_msg()) is not affected: it uses a single
    buffer (ctrlbuf) for both directions, so its analogous copy can never
    leave the allocation.
    
    Found by code review.  The out-of-bounds read was confirmed under
    AddressSanitizer with a faithful userspace model of usbio_bulk_msg()'s
    receive path (an rxbuf_len-sized buffer, the same act/ibuf_len/bpkt_len
    checks and the memcpy).  A USB raw-gadget + dummy_hcd reproducer is
    also available.
    
    Fixes: 121a0f839dbb ("usb: misc: Add Intel USBIO bridge driver")
    Cc: stable <stable@kernel.org>
    Signed-off-by: HE WEI (ギカク) <skyexpoc@gmail.com>
    Link: https://patch.msgid.link/20260624090952.86439-1-skyexpoc@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: misc: usbio: fix disconnect UAF in client teardown [+ + +]
Author: Cen Zhang <zzzccc427@gmail.com>
Date:   Thu Jun 18 20:40:29 2026 +0800

    usb: misc: usbio: fix disconnect UAF in client teardown
    
    commit 0bfeec21984fedd32987f4e4c0cde34b445af404 upstream.
    
    usbio_disconnect() walks usbio->cli_list in reverse and uninitializes each
    auxiliary device. auxiliary_device_uninit() drops the device reference, and
    for an unbound child that can run usbio_auxdev_release() and free the
    containing struct usbio_client.
    
    list_for_each_entry_reverse() advances after the loop body by reading
    client->link.prev. If the current client is freed by
    auxiliary_device_uninit(), the iterator dereferences freed memory.
    
    Use list_for_each_entry_safe_reverse() so the previous client is
    cached before the body can drop the final reference. This preserves
    reverse teardown order while keeping the next iterator cursor independent
    of the current client's lifetime.
    
    Validation reproduced this kernel report:
    BUG: KASAN: slab-use-after-free in usbio_disconnect+0x12e/0x150
    
    Call Trace:
     <TASK>
     dump_stack_lvl+0x66/0xa0
     print_report+0xce/0x630
     ? usbio_disconnect+0x12e/0x150
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? __virt_addr_valid+0x188/0x320
     ? usbio_disconnect+0x12e/0x150
     kasan_report+0xe0/0x110
     ? usbio_disconnect+0x12e/0x150
     usbio_disconnect+0x12e/0x150
     usb_unbind_interface+0xf3/0x400
     really_probe+0x316/0x660
     __driver_probe_device+0x106/0x240
     driver_probe_device+0x4a/0x110
     __device_attach_driver+0xf1/0x1a0
     ? __pfx___device_attach_driver+0x10/0x10
     bus_for_each_drv+0xf9/0x160
     ? __pfx_bus_for_each_drv+0x10/0x10
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? trace_hardirqs_on+0x18/0x130
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? _raw_spin_unlock_irqrestore+0x44/0x60
     __device_attach+0x133/0x2a0
     ? __pfx___device_attach+0x10/0x10
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? do_raw_spin_unlock+0x9a/0x100
     ? srso_alias_return_thunk+0x5/0xfbef5
     device_initial_probe+0x55/0x70
     bus_probe_device+0x4a/0xd0
     device_add+0x9b9/0xc10
     ? __pfx_device_add+0x10/0x10
     ? _raw_spin_unlock_irqrestore+0x44/0x60
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? lockdep_hardirqs_on_prepare+0xea/0x1a0
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? usb_enable_lpm+0x3c/0x260
     usb_set_configuration+0xb64/0xf20
     usb_generic_driver_probe+0x5f/0x90
     usb_probe_device+0x71/0x1b0
     really_probe+0x46b/0x660
     __driver_probe_device+0x106/0x240
     driver_probe_device+0x4a/0x110
     __device_attach_driver+0xf1/0x1a0
     ? __pfx___device_attach_driver+0x10/0x10
     bus_for_each_drv+0xf9/0x160
     ? __pfx_bus_for_each_drv+0x10/0x10
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? trace_hardirqs_on+0x18/0x130
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? _raw_spin_unlock_irqrestore+0x44/0x60
     __device_attach+0x133/0x2a0
     ? __pfx___device_attach+0x10/0x10
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? do_raw_spin_unlock+0x9a/0x100
     ? srso_alias_return_thunk+0x5/0xfbef5
     device_initial_probe+0x55/0x70
     bus_probe_device+0x4a/0xd0
     device_add+0x9b9/0xc10
     ? __pfx_device_add+0x10/0x10
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? add_device_randomness+0xb7/0xf0
     usb_new_device+0x492/0x870
     hub_event+0x1b10/0x29c0
     ? __pfx_hub_event+0x10/0x10
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? lock_acquire+0x187/0x300
     ? process_one_work+0x475/0xb90
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? lock_release+0xc8/0x290
     ? srso_alias_return_thunk+0x5/0xfbef5
     process_one_work+0x4d7/0xb90
     ? __pfx_process_one_work+0x10/0x10
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? __list_add_valid_or_report+0x37/0xf0
     ? __pfx_hub_event+0x10/0x10
     ? srso_alias_return_thunk+0x5/0xfbef5
     worker_thread+0x2d8/0x570
     ? __pfx_worker_thread+0x10/0x10
     kthread+0x1ad/0x1f0
     ? __pfx_kthread+0x10/0x10
     ret_from_fork+0x3c9/0x540
     ? __pfx_ret_from_fork+0x10/0x10
     ? srso_alias_return_thunk+0x5/0xfbef5
     ? __switch_to+0x2e9/0x730
     ? __pfx_kthread+0x10/0x10
     ret_from_fork_asm+0x1a/0x30
     </TASK>
    
    Fixes: 121a0f839dbb ("usb: misc: Add Intel USBIO bridge driver")
    Cc: stable <stable@kernel.org>
    Assisted-by: Codex:gpt-5.5
    Signed-off-by: Cen Zhang <zzzccc427@gmail.com>
    Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
    Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
    Link: https://patch.msgid.link/20260618124029.3704089-1-zzzccc427@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
USB: misc: uss720: unregister parport on probe failure [+ + +]
Author: Myeonghun Pak <mhun512@gmail.com>
Date:   Tue Jul 7 00:10:49 2026 +0900

    USB: misc: uss720: unregister parport on probe failure
    
    commit b4ecbdc4f8830f5586c4a5cfc384c00f20f8f8b3 upstream.
    
    uss720_probe() registers a parport before reading the 1284 register used
    to detect unsupported Belkin F5U002 adapters. If get_1284_register()
    fails, the error path drops the driver private data and the USB device
    reference, but leaves the parport device registered.
    
    Leaving the port registered is more than a private allocation leak:
    parport_register_port() has already reserved a parport number and
    registered the parport bus device, while pp->private_data still points at
    the private data that the common error path is about to release.
    
    Undo the pre-announce registration in the get_1284_register() failure
    branch before jumping to the common private-data cleanup path. Clear
    priv->pp first, matching the disconnect path and avoiding a stale pointer
    in the private data.
    
    This issue was identified during our ongoing static-analysis research while
    reviewing kernel code.
    
    Fixes: 3295f1b866bf ("usb: misc: uss720: check for incompatible versions of the Belkin F5U002")
    Cc: stable <stable@kernel.org>
    Co-developed-by: Ijae Kim <ae878000@gmail.com>
    Signed-off-by: Ijae Kim <ae878000@gmail.com>
    Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
    Reviewed-by: Alex Henrie <alexhenrie24@gmail.com>
    Link: https://patch.msgid.link/20260706151049.63470-1-mhun512@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
usb: mtu3: unmap request DMA on queue failure [+ + +]
Author: Haoxiang Li <haoxiang_li2024@163.com>
Date:   Tue Jun 23 17:33:25 2026 +0800

    usb: mtu3: unmap request DMA on queue failure
    
    commit 0bddda5a11665c210339de76d27ebbd1a2e0b43c upstream.
    
    mtu3_gadget_queue() maps the request before checking whether
    the QMU GPD ring can accept another transfer. the request is
    returned with -EAGAIN before it is linked on the endpoint
    request list if mtu3_prepare_transfer() fails.
    
    Normal completion and dequeue paths unmap requests from
    mtu3_req_complete(), but this error path never reaches that
    helper, so the DMA mapping is left active. Unmap the request
    before returning from the failed queue path.
    
    Fixes: df2069acb005 ("usb: Add MediaTek USB3 DRD driver")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
    Link: https://patch.msgid.link/20260623093325.2105323-1-haoxiang_li2024@163.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
USB: quirks: add NO_LPM for the Samsung T5 EVO Portable SSD [+ + +]
Author: Erich E. Hoover <erich.e.hoover@gmail.com>
Date:   Tue Jun 2 14:45:08 2026 -0600

    USB: quirks: add NO_LPM for the Samsung T5 EVO Portable SSD
    
    commit fc591787785b9709a0bb65a7df3ba2537d611c47 upstream.
    
    The Samsung T5 EVO Portable SSD (04e8:6200) exhibit two forms of
    link instability when USB Link Power Management is enabled:
    
      1. The units fail to initialize properly on first detection,
      resulting in a lockup in the drive where it must be power cycled
      or the kernel will not recognize the presence of the device.
    
      2. If used for sustained operations (small amounts of continuous
      data are transferred to the unit) then the unit will "hiccup"
      after roughly 8 hours of use and will disconnect and reconnect.
      This has a certain probability of triggering the first issue,
      but also causes mount points to become invalid since the device
      gets issued a new letter.
    
    Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
    Cc: stable <stable@kernel.org>
    Link: https://patch.msgid.link/20260602204508.48856-1-erich.e.hoover@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: digi_acceleport: fix broken rx after throttle [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Tue Jun 23 17:08:15 2026 +0200

    USB: serial: digi_acceleport: fix broken rx after throttle
    
    commit 83a3dfc018943b05b6daf3a6f891833e1aabfa1f upstream.
    
    If the port is closed while throttled, the read urb is never resubmitted
    and the port will not receive any further data until the device is
    reconnected (or the driver is rebound).
    
    Clear the throttle flags and submit the urb if needed when opening the
    port.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: digi_acceleport: fix hard lockup on disconnect [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Tue Jun 23 17:11:10 2026 +0200

    USB: serial: digi_acceleport: fix hard lockup on disconnect
    
    commit 5c1ea24b53bf3bfb859f0a05573997487975da23 upstream.
    
    If submitting the OOB write urb fails persistently (e.g if the device is
    being disconnected) the driver would loop indefinitely with interrupts
    disabled.
    
    Check for urb submission errors when sending OOB commands to avoid
    hanging if, for example, open(), set_termios() or close() races with a
    physical disconnect.
    
    This is issue was flagged by Sashiko when reviewing an unrelated change
    to the driver.
    
    Link: https://sashiko.dev/#/patchset/20260610132232.356139-1-johan%40kernel.org?part=1
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable@vger.kernel.org
    Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: digi_acceleport: fix write buffer corruption [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Tue Jun 23 17:12:29 2026 +0200

    USB: serial: digi_acceleport: fix write buffer corruption
    
    commit 24ca1fea8f2753bf33e1d458ec1ae5d9b7796a65 upstream.
    
    The digi_write_inb_command() is supposed to wait for the write urb to
    become available or return an error, but instead it updates the transfer
    buffer and tries to resubmit the urb on timeout.
    
    To make things worse, for commands like break control where no timeout
    is used, the driver would corrupt the urb immediately due to a broken
    jiffies comparison (on 32-bit machines this takes five minutes of uptime
    to trigger due to INITIAL_JIFFIES).
    
    Fix this by adding the missing return on timeout and waiting
    indefinitely when no timeout has been specified as intended.
    
    This issue was (sort of) flagged by Sashiko when reviewing an unrelated
    change to the driver.
    
    Link: https://sashiko.dev/#/patchset/20260610132232.356139-1-johan%40kernel.org?part=11
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable@vger.kernel.org
    Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: keyspan_pda: fix information leak [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Mon Jun 29 14:45:26 2026 +0200

    USB: serial: keyspan_pda: fix information leak
    
    commit 6bfc8d01ac4068eced509f8fc74d0cd205e4dcec upstream.
    
    The write() callback is supposed to return the number of characters
    accepted or a negative errno. Since the addition of write fifo support
    the keyspan_pda implementation will however return the number characters
    submitted to the device if the write urb is not already in use. If this
    number is larger than the number of characters passed to write(), the
    line discipline continues writing data from beyond the tty write buffer.
    
    Fix the information leak by making sure that keyspan_pda_write_start()
    returns zero on success as intended.
    
    Fixes: 034e38e8f687 ("USB: serial: keyspan_pda: add write-fifo support")
    Cc: stable@vger.kernel.org      # 5.11
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: option: add Telit Cinterion FE990D50 compositions [+ + +]
Author: Fabio Porcedda <fabio.porcedda@gmail.com>
Date:   Fri Jun 12 13:39:16 2026 +0200

    USB: serial: option: add Telit Cinterion FE990D50 compositions
    
    commit b33ab1dd80f5c1742f49eb6ec7b337c5ffcf3d32 upstream.
    
    Add support for Telit Cinterion FE990D50 compositions:
    
    0x990: RNDIS + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (AT) +
           tty (diag) + ADPL + adb
    T:  Bus=01 Lev=01 Prnt=01 Port=06 Cnt=03 Dev#=  3 Spd=480  MxCh= 0
    D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=1bc7 ProdID=0990 Rev=06.06
    S:  Manufacturer=Telit Cinterion
    S:  Product=FE990
    S:  SerialNumber=90b6a3ed
    C:  #Ifs=10 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=ef(misc ) Sub=04 Prot=01 Driver=rndis_host
    E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
    I:  If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=88(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=8a(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
    E:  Ad=8c(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 8 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none)
    E:  Ad=8d(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 9 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
    E:  Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    0x991: rmnet + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (AT) +
           tty (diag) + ADPL + adb
    T:  Bus=01 Lev=01 Prnt=01 Port=06 Cnt=03 Dev#=  9 Spd=480  MxCh= 0
    D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=1bc7 ProdID=0991 Rev=06.06
    S:  Manufacturer=Telit Cinterion
    S:  Product=FE990
    S:  SerialNumber=90b6a3ed
    C:  #Ifs= 9 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=(none)
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
    I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=88(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=8a(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 6 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
    E:  Ad=8c(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none)
    E:  Ad=8d(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 8 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
    E:  Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    0x992: MBIM + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (AT) +
           tty (diag) + ADPL + adb
    T:  Bus=01 Lev=01 Prnt=01 Port=06 Cnt=03 Dev#= 12 Spd=480  MxCh= 0
    D:  Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=1bc7 ProdID=0992 Rev=06.06
    S:  Manufacturer=Telit Cinterion
    S:  Product=FE990
    S:  SerialNumber=90b6a3ed
    C:  #Ifs=10 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=88(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=8a(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
    E:  Ad=8c(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 8 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none)
    E:  Ad=8d(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 9 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
    E:  Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    0x993: ECM + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (AT) +
           tty (diag) + ADPL + adb
    T:  Bus=01 Lev=01 Prnt=01 Port=06 Cnt=03 Dev#= 15 Spd=480  MxCh= 0
    D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
    P:  Vendor=1bc7 ProdID=0993 Rev=06.06
    S:  Manufacturer=Telit Cinterion
    S:  Product=FE990
    S:  SerialNumber=90b6a3ed
    C:  #Ifs=10 Cfg#= 1 Atr=e0 MxPwr=500mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=06 Prot=00 Driver=cdc_ether
    E:  Ad=82(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
    E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option
    E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=88(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
    E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=8a(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
    I:  If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
    E:  Ad=8c(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 8 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none)
    E:  Ad=8d(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    I:  If#= 9 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
    E:  Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    E:  Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
usb: sl811-hcd: disable controller wakeup on remove [+ + +]
Author: Myeonghun Pak <mhun512@gmail.com>
Date:   Wed Jul 1 21:16:25 2026 +0900

    usb: sl811-hcd: disable controller wakeup on remove
    
    commit 4e8ba83ac4d311992e6a4c21de5dd705010df06e upstream.
    
    sl811h_probe() enables the HCD controller device as a wakeup source after
    usb_add_hcd() succeeds, but sl811h_remove() removes the HCD and releases
    the driver resources without disabling that wakeup source.
    
    Disable controller wakeup after usb_remove_hcd() and before usb_put_hcd()
    so the wakeup source object is detached while the controller device pointer
    is still available.
    
    This issue was identified during our ongoing static-analysis research while
    reviewing kernel code.
    
    Fixes: 3c9740a117d4 ("usb: hcd: move controller wakeup setting initialization to individual driver")
    Cc: stable <stable@kernel.org>
    Co-developed-by: Ijae Kim <ae878000@gmail.com>
    Signed-off-by: Ijae Kim <ae878000@gmail.com>
    Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
    Link: https://patch.msgid.link/20260701121625.96815-1-mhun512@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
USB: storage: include US_FL_NO_SAME in quirks mask [+ + +]
Author: Xu Rao <raoxu@uniontech.com>
Date:   Tue Jun 2 13:38:42 2026 +0800

    USB: storage: include US_FL_NO_SAME in quirks mask
    
    commit 2c00e09e3f9f06f8434f5ea2ee6179ce46692ee6 upstream.
    
    usb_stor_adjust_quirks() parses the usb-storage.quirks module
    parameter into a new flag set and then applies it with the quirk
    mask to override built-in flags.
    
    The mask is meant to cover the flags that can be overridden by
    the module parameter. The 'k' quirk character sets US_FL_NO_SAME,
    but US_FL_NO_SAME is not included in the mask.
    
    As a result, the module parameter can set US_FL_NO_SAME, but it
    cannot clear a built-in US_FL_NO_SAME flag by providing an override
    entry that omits 'k'.
    
    Add US_FL_NO_SAME to the mask so that the module parameter can
    override it in the same way as the other supported flags.
    
    Fixes: 8010622c86ca ("USB: UAS: introduce a quirk to set no_write_same")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Xu Rao <raoxu@uniontech.com>
    Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
    Link: https://patch.msgid.link/3BCE5880F9A45C2E+20260602053842.2920137-1-raoxu@uniontech.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
usb: typec: anx7411: use devm_pm_runtime_enable() [+ + +]
Author: Myeonghun Pak <mhun512@gmail.com>
Date:   Wed Jul 1 20:40:06 2026 +0900

    usb: typec: anx7411: use devm_pm_runtime_enable()
    
    commit 0ef7cc27da8b9e315a4a5a665c68c44206f5e559 upstream.
    
    anx7411_i2c_probe() enables runtime PM before returning successfully, but
    anx7411_i2c_remove() tears down the Type-C partner state, workqueue, dummy
    I2C device, mux, switch and port without disabling runtime PM.
    
    Use devm_pm_runtime_enable() so runtime PM is disabled automatically on
    driver detach. Since devres action registration can fail, route that
    failure through the existing probe unwind path.
    
    This issue was identified during our ongoing static-analysis research while
    reviewing kernel code.
    
    Fixes: fe6d8a9c8e64 ("usb: typec: anx7411: Add Analogix PD ANX7411 support")
    Cc: stable <stable@kernel.org>
    Co-developed-by: Ijae Kim <ae878000@gmail.com>
    Signed-off-by: Ijae Kim <ae878000@gmail.com>
    Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Link: https://patch.msgid.link/20260701114006.75738-1-mhun512@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: typec: class: drop PD lookup reference [+ + +]
Author: Shuangpeng Bai <shuangpeng.kernel@gmail.com>
Date:   Thu Jul 2 15:13:29 2026 -0400

    usb: typec: class: drop PD lookup reference
    
    commit 43ae2f90b70cda374c487c1639a01d0f14e5d583 upstream.
    
    usb_power_delivery_find() wraps class_find_device_by_name(). That helper
    returns a device reference that must be released by the caller.
    
    select_usb_power_delivery_store() only needs this reference while calling
    the pd_set callback. Drop it once the callback returns. Otherwise the sysfs
    write can pin the selected USB Power Delivery object and prevent it from
    being released on unregister.
    
    Fixes: a7cff92f0635 ("usb: typec: USB Power Delivery helpers for ports and partners")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Shuangpeng Bai <shuangpeng.kernel@gmail.com>
    Link: https://patch.msgid.link/20260702191329.2648043-1-shuangpeng.kernel@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: typec: ps883x: Fix DP+USB3 configuration [+ + +]
Author: Stephan Gerhold <stephan.gerhold@linaro.org>
Date:   Mon Jun 1 15:55:02 2026 +0200

    usb: typec: ps883x: Fix DP+USB3 configuration
    
    commit b229b22b0a945d52dee887c856991ad08744d08e upstream.
    
    Commit 6bebd9b77726 ("usb: typec: ps883x: Rework ps883x_set()") introduced
    two regressions:
    
     1. The CONN_STATUS_0_USB_3_1_CONNECTED bit is mistakenly written to the
        wrong configuration register (cfg1 instead of cfg0). This breaks USB3
        when using USB3+DP adapters.
    
     2. The switch-case fallthrough block is inverted: Currently,
        TYPEC_DP_STATE_C (DP-only) inherits the USB3 configuration, while
        TYPEC_DP_STATE_D (DP+USB3) is missing the necessary DP sink flags.
    
    Fix these by writing the USB3 bit to the correct register and swapping the
    case statement order so both states get their correct bits assigned.
    
    Cc: stable <stable@kernel.org>
    Fixes: 6bebd9b77726 ("usb: typec: ps883x: Rework ps883x_set()")
    Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Tested-by: Jens Glathe <jens.glathe@oldschoolsolutions.biz>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Link: https://patch.msgid.link/20260601-ps883x-usb3dp-fixes-v1-1-d19bec3a6d26@linaro.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: typec: tcpci_rt1711h: unregister TCPCI port with devres [+ + +]
Author: Myeonghun Pak <mhun512@gmail.com>
Date:   Mon Jul 6 23:53:12 2026 +0900

    usb: typec: tcpci_rt1711h: unregister TCPCI port with devres
    
    commit e8da46d99d3710106e7c44db14566bf9b57386b5 upstream.
    
    rt1711h_probe() registers the TCPCI port before requesting the interrupt
    and enabling alert interrupts. If either of those later steps fails, the
    probe function returns without unregistering the TCPCI port. The explicit
    unregister currently only happens from the remove callback.
    
    Register a devres action immediately after tcpci_register_port() succeeds,
    so tcpci_unregister_port() runs on later probe failures and on driver
    detach. Drop the remove callback to avoid unregistering the same port
    twice.
    
    This issue was identified during our ongoing static-analysis research while
    reviewing kernel code.
    
    Fixes: 302c570bf36e ("usb: typec: tcpci_rt1711h: avoid screaming irq causing boot hangs")
    Cc: stable <stable@kernel.org>
    Co-developed-by: Ijae Kim <ae878000@gmail.com>
    Signed-off-by: Ijae Kim <ae878000@gmail.com>
    Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
    Link: https://patch.msgid.link/20260706145312.37260-1-mhun512@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: typec: tcpm: Fix VDM type for Enter Mode commands [+ + +]
Author: Andy Yan <andyshrk@163.com>
Date:   Thu Jun 4 18:50:24 2026 +0800

    usb: typec: tcpm: Fix VDM type for Enter Mode commands
    
    commit 9cff680e47632b7723cb19f9c5e63669063c3417 upstream.
    
    VDO() second parameter is VDM type (bit 15): 1 for SVDM, 0 for UVDM.
    Using 'vdo ? 2 : 1' corrupts SVID low bit when vdo is non-NULL
    (2 << 15 = BIT(16)). Enter Mode is always SVDM, hardcode to 1.
    
    Fixes: 8face9aa57c8 ("usb: typec: Add parameter for the VDO to typec_altmode_enter()")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Andy Yan <andyshrk@163.com>
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Link: https://patch.msgid.link/20260604105059.18750-1-andyshrk@163.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: typec: tcpm: Validate SVID index in svdm_consume_modes() [+ + +]
Author: Badhri Jagan Sridharan <badhri@google.com>
Date:   Mon Jun 22 22:08:03 2026 +0000

    usb: typec: tcpm: Validate SVID index in svdm_consume_modes()
    
    commit 7b681dd5fbf60b24a13c14661e5b7735759fb491 upstream.
    
    In svdm_consume_modes(), the SVID value is read from pmdata->svids using
    pmdata->svid_index as an array index without bounds validation:
    
        paltmode->svid = pmdata->svids[pmdata->svid_index];
    
    If pmdata->svid_index is driven beyond SVID_DISCOVERY_MAX (16), it results
    in an out-of-bounds read of the pmdata->svids array. Because pd_mode_data
    is embedded inside struct tcpm_port, indexing past svids reads into
    adjacent fields. In particular:
    - At index 16, it reads the altmodes count.
    - At index 18 and beyond, it reads into altmode_desc[], which contains
      partner-supplied SVDM Discovery Modes VDOs.
    
    By injecting a chosen SVID into altmode_desc[0].vdo and driving svid_index
    to 20, the partner can force paltmode->svid to be loaded with an arbitrary,
    partner- chosen SVID, which is then registered via
    typec_partner_register_altmode().
    
    Fix this by validating that pmdata->svid_index is non-negative and strictly
    less than pmdata->nsvids before accessing the pmdata->svids array inside
    svdm_consume_modes().
    
    Assisted-by: Antigravity:gemini-3.5-flash
    Fixes: 4ab8c18d4d67 ("usb: typec: Register a device for every mode")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
    Reviewed-by: RD Babiera <rdbabiera@google.com>
    Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Link: https://patch.msgid.link/20260622220803.305750-1-badhri@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: typec: ucsi: cancel pending work on system suspend [+ + +]
Author: Paul Menzel <pmenzel@molgen.mpg.de>
Date:   Fri Jul 3 13:07:37 2026 +0200

    usb: typec: ucsi: cancel pending work on system suspend
    
    commit 7c4a234bd31a64a8dbd0140dc812da592c5e0787 upstream.
    
    On a Dell XPS 13 9360 (BIOS 2.21.0), entering system suspend (deep/S3)
    races a pending UCSI connector-change worker against the ACPI EC teardown.
    The worker evaluates the UCSI _DSM (GET_CONNECTOR_STATUS), whose AML
    accesses the Embedded Controller. By that point the ACPI EC has already
    been stopped for suspend, so the EC address space handler rejects the
    access with AE_BAD_PARAMETER, aborting the AML and failing the connector
    query:
    
        [22314.689495] ACPI: EC: interrupt blocked
        [22314.711981] ACPI: PM: Preparing to enter system sleep state S3
        [22314.743260] ACPI: EC: event blocked
        [22314.743265] ACPI: EC: EC stopped
        [22314.743267] ACPI: PM: Saving platform NVS memory
        [22314.744241] ACPI Error: AE_BAD_PARAMETER, Returned by Handler for [EmbeddedControl] (20260408/evregion-303)
        [22314.744432] ACPI Error: Aborting method \_SB.PCI0.LPCB.ECDV.ECW1 due to previous error (AE_BAD_PARAMETER) (20260408/psparse-543)
        [22314.744673] ACPI Error: Aborting method \ECWB due to previous error (AE_BAD_PARAMETER) (20260408/psparse-543)
        [22314.745201] ACPI Error: Aborting method \_SB.UBTC._DSM due to previous error (AE_BAD_PARAMETER) (20260408/psparse-543)
        [22314.745394] ACPI: \_SB_.UBTC: failed to evaluate _DSM c298836f-a47c-e411-ad36-631042b5008f rev:1 func:1 (0x1001)
        [22314.745414] ucsi_acpi USBC000:00: ucsi_acpi_dsm: failed to evaluate _DSM 1
        [22314.745424] ucsi_acpi USBC000:00: ucsi_handle_connector_change: GET_CONNECTOR_STATUS failed (-5)
    
    ucsi_acpi implements a resume callback but no suspend callback, so nothing
    cancels the connector-change work before the firmware/EC is torn down.
    
    Add a `ucsi_suspend()` core helper that cancels the pending init and
    connector-change work, and wire it into ucsi_acpi's PM ops. The connector
    state is re-read on resume by `ucsi_resume()`, so cancelling the work loses
    nothing.
    
    Fixes: 4e3a50293c2b ("usb: typec: ucsi: acpi: Implement resume callback")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
    Assisted-by: Claude Opus 4.8
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Link: https://patch.msgid.link/20260703110738.8457-2-pmenzel@molgen.mpg.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: typec: ucsi: ccg: Fix use-after-free of ucsi on remove [+ + +]
Author: Fan Wu <fanwu01@zju.edu.cn>
Date:   Tue Jun 16 13:20:11 2026 +0000

    usb: typec: ucsi: ccg: Fix use-after-free of ucsi on remove
    
    commit 1f0bdc2884b67de337215079bba166df0cdf4ac5 upstream.
    
    The threaded IRQ handler ccg_irq_handler() calls ucsi_notify_common(),
    which on a connector-change event calls ucsi_connector_change() and
    schedules connector work.  In ucsi_ccg_remove(), ucsi_destroy() frees
    uc->ucsi (kfree) before free_irq() is called, so a handler invocation
    already in flight may access the freed object after ucsi_destroy().
    
      CPU 0 (remove)            | CPU 1 (threaded IRQ)
        ucsi_destroy(uc->ucsi)  |   ccg_irq_handler()
          kfree(ucsi) // FREE   |     ucsi_notify_common(uc->ucsi) // USE
    
    Move free_irq() before ucsi_destroy() in the remove path.  It is kept
    after ucsi_unregister(): ucsi_unregister() cancels connector work whose
    handler issues GET_CONNECTOR_STATUS through ucsi_send_command_common(),
    which waits for a completion that is signalled from the IRQ handler, so
    the IRQ must stay active until that work has been cancelled.
    
    The probe error path already orders free_irq() before ucsi_destroy().
    
    This bug was found by static analysis.
    
    Fixes: e32fd989ac1c ("usb: typec: ucsi: ccg: Move to the new API")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Fan Wu <fanwu01@zju.edu.cn>
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Link: https://patch.msgid.link/20260616132011.103279-1-fanwu01@zju.edu.cn
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: typec: ucsi: Invert DisplayPort role assignment [+ + +]
Author: Andrei Kuchynski <akuchynski@chromium.org>
Date:   Mon Jun 1 14:28:37 2026 +0000

    usb: typec: ucsi: Invert DisplayPort role assignment
    
    commit d092d7edf8faefa3e27b9fc7f0e7904b06c833a2 upstream.
    
    The existing implementation assigned these flags backwards, configuring
    the partner's DisplayPort role to match the port's role instead of
    complementing it.
    This prevents proper configuration during DP altmode activation, often
    causing `pin_assignment` to remain 0 in `dp_altmode_configure()` and
    resulting in VDM negotiation failures:
    
        [  583.328246] typec port1.1: VDM 0xff01a150 failed
    
    Additionally, the fix ensures that the `pin_assignment` sysfs attribute
    displays the correct values.
    
    Cc: stable <stable@kernel.org>
    Fixes: af8622f6a585 ("usb: typec: ucsi: Support for DisplayPort alt mode")
    Signed-off-by: Andrei Kuchynski <akuchynski@chromium.org>
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Link: https://patch.msgid.link/20260601142837.3240207-1-akuchynski@chromium.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: typec: ucsi: Pass full DP config payload in SET_NEW_CAM for DP alt mode [+ + +]
Author: Madhu M <madhu.m@intel.com>
Date:   Fri Jun 19 21:03:11 2026 +0530

    usb: typec: ucsi: Pass full DP config payload in SET_NEW_CAM for DP alt mode
    
    commit 735a461d060d4eeb2f9732aba1295bc32a3982e2 upstream.
    
    In the UCSI Specification Revision 3.1 RC1, bits 32-63 of the SET_NEW_CAM
    command hold the 32-bit Alternate Mode Specific (AMSpecific) field.
    
    For DisplayPort Alternate Mode, this field must contain the full
    32-bit DisplayPort configuration VDO payload that the OPM wants the
    connector to operate in, rather than just the pin assignment value.
    This AMSpecific value follows the DisplayPort Configurations defined
    in the DisplayPort Alt Mode on USB Type-C Specification v2.1a,
    Table 5-13: SOP DisplayPort Configurations.
    
    Fixes: af8622f6a585 ("usb: typec: ucsi: Support for DisplayPort alt mode")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Madhu M <madhu.m@intel.com>
    Reviewed-by: Jameson Thies <jthies@google.com>
    Reviewed-by: Andrei Kuchynski <akuchynski@chromium.org>
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Link: https://patch.msgid.link/20260619153311.3526083-1-madhu.m@intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
USB: ulpi: fix memory leak on registration failure [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Mon Jun 8 16:58:03 2026 +0200

    USB: ulpi: fix memory leak on registration failure
    
    commit 8af6812795869a66e9b26044f455b13deecdb69c upstream.
    
    The allocated device name is never freed on early ULPI device
    registration failures.
    
    Fix this by initialising the device structure earlier and releasing the
    initial reference whenever registration fails.
    
    Fixes: 289fcff4bcdb ("usb: add bus type for USB ULPI")
    Cc: stable <stable@kernel.org>
    Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Link: https://patch.msgid.link/20260608145803.69360-1-johan@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: usb-storage: ene_ub6250: restore media-ready check [+ + +]
Author: Xu Rao <raoxu@uniontech.com>
Date:   Fri Jun 26 15:06:07 2026 +0800

    USB: usb-storage: ene_ub6250: restore media-ready check
    
    commit 5fc3f333c001f1e308bbcdeecdec0d054d24338b upstream.
    
    Commit 1892bf90677a ("USB: usb-storage: Fix use of bitfields for
    hardware data in ene_ub6250.c") converted the media status fields from
    bitfields to bit masks.
    
    The original ene_transport() test called ene_init() only when neither
    media type was ready:
    
            !(sd_ready || ms_ready)
    
    The converted test became:
    
            !sd_ready || ms_ready
    
    This is not equivalent. Restore the original semantics by testing that
    both ready bits are clear before calling ene_init().
    
    Fixes: 1892bf90677a ("USB: usb-storage: Fix use of bitfields for hardware data in ene_ub6250.c")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Xu Rao <raoxu@uniontech.com>
    Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
    Link: https://patch.msgid.link/F42641386E32404F+20260626070607.4119527-1-raoxu@uniontech.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
usb: xhci: Fix sleep in atomic context in xhci_free_streams() [+ + +]
Author: 胡连勤 <hulianqin@vivo.com>
Date:   Fri Jul 3 17:40:33 2026 +0300

    usb: xhci: Fix sleep in atomic context in xhci_free_streams()
    
    commit 42c37c4b75d38b51d84f31a8e29427f5e06a7c2a upstream.
    
    When a USB device with active stream endpoints is disconnected,
    xhci_free_streams() is called from the hub_event workqueue to
    free the stream resources.  It calls xhci_free_stream_info()
    while holding xhci->lock with irqs disabled.
    
    xhci_free_stream_info() invokes xhci_free_stream_ctx(), which
    calls dma_free_coherent() for large stream context arrays.
    
    dma_free_coherent() can sleep (e.g. via vunmap), triggering
    a BUG when called from atomic context.
    
    Call trace:
     dma_free_attrs+0x174/0x220
     xhci_free_stream_info+0xd0/0x11c
     xhci_free_streams+0x278/0x37c
     usb_free_streams+0x98/0xc0
     usb_unbind_interface+0x1b8/0x2f8
     device_release_driver_internal+0x1d4/0x2cc
     device_release_driver+0x18/0x28
     bus_remove_device+0x160/0x1a4
     device_del+0x1ec/0x350
     usb_disable_device+0x98/0x214
     usb_disconnect+0xf0/0x35c
     hub_event+0xab4/0x19ec
     process_one_work+0x278/0x63c
    
    Fix this by saving the stream_info pointers and clearing the
    ep references under the lock, then calling xhci_free_stream_info()
    outside the lock where sleeping is allowed.
    
    Fixes: 8df75f42f8e6 ("USB: xhci: Add memory allocation for USB3 bulk streams.")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Lianqin Hu <hulianqin@vivo.com>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://patch.msgid.link/20260703144033.483286-3-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
usbip: tools: support SuperSpeedPlus devices [+ + +]
Author: Yichong Chen <chenyichong@uniontech.com>
Date:   Wed Jun 17 10:06:13 2026 +0800

    usbip: tools: support SuperSpeedPlus devices
    
    commit 195e667c8719480c320cd48ac0fbf1cb81d6ffe0 upstream.
    
    USB devices running at SuperSpeedPlus report "10000" or "20000" in
    their sysfs speed attribute. usbip currently maps only "5000" to
    USB_SPEED_SUPER, so a SuperSpeedPlus device is imported as
    USB_SPEED_UNKNOWN.
    
    The attach request is then rejected by vhci_hcd:
    
      vhci_hcd: Failed attach request for unsupported USB speed: UNKNOWN
    
    Map the SuperSpeedPlus sysfs speed values to USB_SPEED_SUPER_PLUS, use
    the SuperSpeed VHCI hub for SuperSpeedPlus devices, and recognize the
    gadget current_speed string used by the kernel.
    
    Fixes: b2316645ca5e ("usb: show speed "10000" in sysfs for USB 3.1 SuperSpeedPlus devices")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Yichong Chen <chenyichong@uniontech.com>
    Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
    Link: https://patch.msgid.link/00C828F338E43447+20260617020613.199086-1-chenyichong@uniontech.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usbip: vudc: fix NULL deref in vep_dequeue() [+ + +]
Author: Sam Day <me@samcday.com>
Date:   Fri Jun 26 14:29:10 2026 +1000

    usbip: vudc: fix NULL deref in vep_dequeue()
    
    commit c5371e0b91b24159a3ebaa61e70b0980bcf03c0a upstream.
    
    vep_alloc_request() wasn't initializing vrequest->udc, so cancellations
    on the FunctionFS AIO path were arriving in vep_dequeue without a valid
    UDC reference.
    
    Since vrequest->udc is never actually properly used anywhere, we opt to
    remove it, and update vep_dequeue to obtain a reference to the udc with
    ep_to_vudc(), consistent with the other vep_ ops.
    
    AFAICT this bug has existed for ~10 years. Seems that nobody has really
    stressed the FunctionFS AIO path on usbip's vudc.
    
    I tested this fix in a QEMU aarch64 guest driving FunctionFS endpoints
    via AIO. Before the fix, running `usbip attach` from the host would
    cause the guest to oops with the following backtrace:
    
    Call trace:
     vep_dequeue+0x1c/0xe4 (P)
     usb_ep_dequeue+0x14/0x20
     ffs_aio_cancel+0x24/0x34
     __arm64_sys_io_cancel+0xb0/0x124
     do_el0_svc+0x68/0x100
     el0_svc+0x18/0x5c
     el0t_64_sync_handler+0x98/0xdc
     el0t_64_sync+0x154/0x158
    
    Assisted-by: opencode:openai/gpt-5.5
    Cc: stable <stable@kernel.org>
    Fixes: b6a0ca111867 ("usbip: vudc: Add UDC specific ops")
    Reviewed-by: Igor Kotrasinski <i.kotrasinsk@samsung.com>
    Signed-off-by: Sam Day <me@samcday.com>
    Link: https://patch.msgid.link/20260626-usbip-vudc-deque-fix-v3-1-98c2dc4d6a48@samcday.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
userfaultfd: gate must_wait writability check on pte_present() [+ + +]
Author: Kiryl Shutsemau <kas@kernel.org>
Date:   Thu Jul 2 16:49:08 2026 +0100

    userfaultfd: gate must_wait writability check on pte_present()
    
    [ Upstream commit 8e80af52db652fbc41320eee45a4f73bc029faf2 ]
    
    userfaultfd_must_wait() and userfaultfd_huge_must_wait() read the PTE
    without taking the page table lock and then apply pte_write() /
    huge_pte_write() to it.  Those accessors decode bits from the present
    encoding only; on a swap or migration entry they read the offset bits that
    happen to share the same position and return an undefined result.
    
    The intent of the check is "is this fault still WP-blocked?".  A
    non-marker swap entry means the page is in transit -- the userfault
    context the original fault delivered against is no longer the same, and
    the swap-in or migration completion path will re-deliver a fresh fault if
    userspace still needs to handle it.  Worst case under the current code the
    garbage write bit says "wait", and the thread stays asleep until a
    UFFDIO_WAKE that may never arrive.
    
    Gate the writability check on pte_present() so the lockless re-check only
    inspects present-PTE bits when the entry is actually present.  The
    non-present, non-marker case returns "don't wait" and lets the fault path
    retry.
    
    Link: https://lore.kernel.org/20260529172331.356655-6-kas@kernel.org
    Fixes: 369cd2121be4 ("userfaultfd: hugetlbfs: userfaultfd_huge_must_wait for hugepmd ranges")
    Fixes: 63b2d4174c4a ("userfaultfd: wp: add the writeprotect API to userfaultfd ioctl")
    Signed-off-by: Kiryl Shutsemau <kas@kernel.org>
    Reported-by: Sashiko AI review <sashiko-bot@kernel.org>
    Reviewed-by: Lorenzo Stoakes <ljs@kernel.org>
    Cc: David Hildenbrand <david@kernel.org>
    Cc: Michal Hocko <mhocko@suse.com>
    Cc: Mike Rapoport <rppt@kernel.org>
    Cc: Peter Xu <peterx@redhat.com>
    Cc: Suren Baghdasaryan <surenb@google.com>
    Cc: Vlastimil Babka <vbabka@kernel.org>
    Cc: Balbir Singh <balbirs@nvidia.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    
    [ kas: apply to fs/userfaultfd.c; these checks moved to mm/userfaultfd.c
      only after 7.1, the change is otherwise identical to upstream ]
    Signed-off-by: Kiryl Shutsemau <kas@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
vfio/mlx5: Fix racy bitfields and tighten struct layout [+ + +]
Author: Alex Williamson <alex.williamson@nvidia.com>
Date:   Mon Jun 15 13:12:32 2026 -0600

    vfio/mlx5: Fix racy bitfields and tighten struct layout
    
    commit f2365a63b02ddea32e7db78b742c2503ec7b81f1 upstream.
    
    Bitfield operations are not atomic, they use a read-modify-write
    pattern, therefore we should be careful not to pack bitfields that
    can be concurrently updated into the same storage unit.
    
    This split takes a binary approach: flags that are only modified
    pre/post open/close remain bitfields, flags modified from user
    action, including actions that reach across to another device (ex.
    reset) use dedicated storage units.
    
    Note mlx5_vhca_page_tracker.status is relocated to fill the alignment
    hole this split exposes.
    
    Bitfield justifications:
    
      migrate_cap: written only in mlx5vf_cmd_set_migratable() at probe
      chunk_mode: written only in mlx5vf_cmd_set_migratable() at probe
      mig_state_cap: written only in mlx5vf_cmd_set_migratable() at probe
    
    Dedicated storage units:
    
      mdev_detach: written in the VF attach/detach event notifier
                   mlx5fv_vf_event() at runtime
      log_active: written in mlx5vf_start_page_tracker()/
                  mlx5vf_stop_page_tracker() during runtime dirty tracking
      deferred_reset: written in mlx5vf_state_mutex_unlock()/
                      mlx5vf_pci_aer_reset_done() during runtime reset handling
      is_err: set by tracker error handling and dirty-log polling at runtime
      object_changed: set by tracker event handling and cleared by dirty-log
                      polling at runtime
    
    Fixes: 61a2f1460fd0 ("vfio/mlx5: Manage the VF attach/detach callback from the PF")
    Fixes: 79c3cf279926 ("vfio/mlx5: Init QP based resources for dirty tracking")
    Fixes: f886473071d6 ("vfio/mlx5: Add support for tracker object change event")
    Cc: Yishai Hadas <yishaih@nvidia.com>
    Cc: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: Alex Williamson <alex.williamson@nvidia.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Link: https://lore.kernel.org/r/20260615191241.688297-5-alex.williamson@nvidia.com
    Signed-off-by: Alex Williamson <alex@shazbot.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
vfio/pci: Fix racy bitfields and tighten struct layout [+ + +]
Author: Alex Williamson <alex.williamson@nvidia.com>
Date:   Mon Jun 15 13:12:31 2026 -0600

    vfio/pci: Fix racy bitfields and tighten struct layout
    
    commit e73638e55f861758d49f14d7bb5dba3035981cd7 upstream.
    
    Bitfield operations are not atomic, they use a read-modify-write
    pattern, therefore we should be careful not to pack bitfields that
    can be concurrently updated into the same storage unit.
    
    This split takes a binary approach: flags that are only modified
    pre/post open/close remain bitfields, flags modified from user
    action, including actions that reach across to another device (ex.
    reset) use dedicated storage units.
    
    Note that the virq_disabled and bardirty flags are relocated to fill
    an existing hole in the structure.
    
    Bitfield justifications:
    
      has_dyn_msix: written only in vfio_pci_core_enable()
      pci_2_3: written only in vfio_pci_core_enable()
      reset_works: written only in vfio_pci_core_enable()
      extended_caps: written only in vfio_cap_len() under vfio_config_init()
      has_vga: written only in vfio_pci_core_enable()
      nointx: written only in vfio_pci_core_enable()
      needs_pm_restore: written only in vfio_pci_probe_power_state()
      disable_idle_d3: written only at .init in vfio_pci_core_init_dev()
    
    Dedicated storage units:
    
      virq_disabled: written by guest INTx command writes in
                     vfio_basic_config_write() while the device is open
      bardirty: written by guest BAR writes in vfio_basic_config_write()
                while the device is open
      pm_intx_masked: written in the runtime-PM suspend path.
      pm_runtime_engaged: written by low-power feature entry/exit paths
      needs_reset: set in vfio_pci_core_disable() and cleared for devices in
                   the set by vfio_pci_dev_set_try_reset()
      sriov_active: written by vfio_pci_core_sriov_configure() via sysfs
                    sriov_numvfs while bound.
    
    Fixes: 9cd0f6d5cbb6 ("vfio/pci: Use bitfield for struct vfio_pci_core_device flags")
    Cc: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: Alex Williamson <alex.williamson@nvidia.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Link: https://lore.kernel.org/r/20260615191241.688297-4-alex.williamson@nvidia.com
    Signed-off-by: Alex Williamson <alex@shazbot.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

vfio/pci: Latch disable_idle_d3 per device [+ + +]
Author: Alex Williamson <alex.williamson@nvidia.com>
Date:   Mon Jun 15 13:12:29 2026 -0600

    vfio/pci: Latch disable_idle_d3 per device
    
    commit 4575e9aac5336d1365138c0284773bf8da4b1fa3 upstream.
    
    When disable_idle_d3 was introduced in vfio-pci, it directly manipulated
    the device power state with pci_set_power_state().  There were no
    refcounts to maintain or balanced operations, we could unconditionally
    bring the device to D0 and conditionally move it to D3hot.  Therefore
    the module parameter was made writable.
    
    Later, in commit c61302aa48f7 ("vfio/pci: Move module parameters to
    vfio_pci.c"), as part of the vfio-pci-core split, the writable aspect
    of the module parameter was nullified.  The parameter value could still
    be changed through sysfs, but the vfio-pci driver latched the values
    into vfio-pci-core globals at module init.  Loading the vfio-pci module,
    or unloading and reloading, with non-default or different values could
    change the globals relative to existing devices bound to vfio-pci
    variant drivers.
    
    Runtime PM was introduced in commit 7ab5e10eda02 ("vfio/pci: Move the
    unused device into low power state with runtime PM"), which marks the
    point where power states became refcounted.  PM get and put operations
    need to be balanced, but the same module operations noted above can
    change the global variables relative to those devices already bound to
    vfio-pci variant drivers.  This introduces a window where PM operations
    can now become unbalanced.
    
    To resolve this with a narrow footprint for stable backports, the
    disable_idle_d3 flag is latched into the vfio_pci_core_device at the
    time of initialization, such that the device always operates with a
    consistent value.
    
    NB. vfio_pci_dev_set_try_reset() now unconditionally raises the
    runtime PM usage count around bus reset to account for disable_idle_d3
    becoming a per-device rather than global flag.  When this flag is set,
    the additional get/put pair is harmless and allows continued use of the
    shared vfio_pci_dev_set_pm_runtime_get() helper.
    
    Fixes: 7ab5e10eda02 ("vfio/pci: Move the unused device into low power state with runtime PM")
    Cc: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: Alex Williamson <alex.williamson@nvidia.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Link: https://lore.kernel.org/r/20260615191241.688297-2-alex.williamson@nvidia.com
    Signed-off-by: Alex Williamson <alex@shazbot.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

vfio/pci: Release the VGA arbiter client on register_device() failure [+ + +]
Author: Alex Williamson <alex.williamson@nvidia.com>
Date:   Mon Jun 15 13:12:30 2026 -0600

    vfio/pci: Release the VGA arbiter client on register_device() failure
    
    commit daedde7f024ecf88bc8e832ed40cf2c795f0796a upstream.
    
    The re-order in the Fixes commit below displaced vfio_pci_vga_init() as
    the last failure point of what is now vfio_pci_core_register_device()
    without introducing an unwind for the VGA arbiter registration.
    
    In current kernels this is mostly benign because vfio_pci_set_decode()
    only uses pci_dev state, but the original failure path could leave a
    callback with a freed vdev cookie.  The stale registration also becomes
    unsafe again once the callback follows drvdata to the vfio device.
    
    Add the required VGA unwind callout.
    
    Fixes: 4aeec3984ddc ("vfio/pci: Re-order vfio_pci_probe()")
    Cc: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: Alex Williamson <alex.williamson@nvidia.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Link: https://lore.kernel.org/r/20260615191241.688297-3-alex.williamson@nvidia.com
    Signed-off-by: Alex Williamson <alex@shazbot.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

vfio/pci: Use a private flag to prevent power state change with VFs [+ + +]
Author: Raghavendra Rao Ananta <rananta@google.com>
Date:   Thu May 14 17:34:49 2026 +0000

    vfio/pci: Use a private flag to prevent power state change with VFs
    
    commit 40ef3edf151e184d021917a5c4c771cc0870844a upstream.
    
    The current implementation uses pci_num_vf() while holding the
    memory_lock to prevent changing the power state of a PF when
    VFs are enabled. This creates a lockdep circular dependency
    warning because memory_lock is held during device probing.
    
    [  286.997167] ======================================================
    [  287.003363] WARNING: possible circular locking dependency detected
    [  287.009562] 7.0.0-dbg-DEV #3 Tainted: G S
    [  287.015074] ------------------------------------------------------
    [  287.021270] vfio_pci_sriov_/18636 is trying to acquire lock:
    [  287.026942] ff45bea2294d4968 (&vdev->memory_lock){+.+.}-{4:4}, at:
    vfio_pci_core_runtime_resume+0x1f/0xa0
    [  287.036530]
    [  287.036530] but task is already holding lock:
    [  287.042383] ff45bea3a96b8230 (&new_dev_set->lock){+.+.}-{4:4}, at:
    vfio_group_fops_unl_ioctl+0x44d/0x7b0
    [  287.051879]
    [  287.051879] which lock already depends on the new lock.
    [  287.051879]
    [  287.060070]
    [  287.060070] the existing dependency chain (in reverse order) is:
    [  287.067568]
    [  287.067568] -> #2 (&new_dev_set->lock){+.+.}-{4:4}:
    [  287.073941]        __mutex_lock+0x92/0xb80
    [  287.078058]        vfio_assign_device_set+0x66/0x1b0
    [  287.083042]        vfio_pci_core_register_device+0xd1/0x2a0
    [  287.088638]        vfio_pci_probe+0xd2/0x100
    [  287.092933]        local_pci_probe_callback+0x4d/0xa0
    [  287.098001]        process_scheduled_works+0x2ca/0x680
    [  287.103158]        worker_thread+0x1e8/0x2f0
    [  287.107452]        kthread+0x10c/0x140
    [  287.111230]        ret_from_fork+0x18e/0x360
    [  287.115519]        ret_from_fork_asm+0x1a/0x30
    [  287.119983]
    [  287.119983] -> #1 ((work_completion)(&arg.work)){+.+.}-{0:0}:
    [  287.127219]        __flush_work+0x345/0x490
    [  287.131429]        pci_device_probe+0x2e3/0x490
    [  287.135979]        really_probe+0x1f9/0x4e0
    [  287.140180]        __driver_probe_device+0x77/0x100
    [  287.145079]        driver_probe_device+0x1e/0x110
    [  287.149803]        __device_attach_driver+0xe3/0x170
    [  287.154789]        bus_for_each_drv+0x125/0x150
    [  287.159346]        __device_attach+0xca/0x1a0
    [  287.163720]        device_initial_probe+0x34/0x50
    [  287.168445]        pci_bus_add_device+0x6e/0x90
    [  287.172995]        pci_iov_add_virtfn+0x3c9/0x3e0
    [  287.177719]        sriov_add_vfs+0x2c/0x60
    [  287.181838]        sriov_enable+0x306/0x4a0
    [  287.186038]        vfio_pci_core_sriov_configure+0x184/0x220
    [  287.191715]        sriov_numvfs_store+0xd9/0x1c0
    [  287.196351]        kernfs_fop_write_iter+0x13f/0x1d0
    [  287.201338]        vfs_write+0x2be/0x3b0
    [  287.205286]        ksys_write+0x73/0x100
    [  287.209233]        do_syscall_64+0x14d/0x750
    [  287.213529]        entry_SYSCALL_64_after_hwframe+0x77/0x7f
    [  287.219120]
    [  287.219120] -> #0 (&vdev->memory_lock){+.+.}-{4:4}:
    [  287.225491]        __lock_acquire+0x14c6/0x2800
    [  287.230048]        lock_acquire+0xd3/0x2f0
    [  287.234168]        down_write+0x3a/0xc0
    [  287.238019]        vfio_pci_core_runtime_resume+0x1f/0xa0
    [  287.243436]        __rpm_callback+0x8c/0x310
    [  287.247730]        rpm_resume+0x529/0x6f0
    [  287.251765]        __pm_runtime_resume+0x68/0x90
    [  287.256402]        vfio_pci_core_enable+0x44/0x310
    [  287.261216]        vfio_pci_open_device+0x1c/0x80
    [  287.265947]        vfio_df_open+0x10f/0x150
    [  287.270148]        vfio_group_fops_unl_ioctl+0x4a4/0x7b0
    [  287.275476]        __se_sys_ioctl+0x71/0xc0
    [  287.279679]        do_syscall_64+0x14d/0x750
    [  287.283975]        entry_SYSCALL_64_after_hwframe+0x77/0x7f
    [  287.289559]
    [  287.289559] other info that might help us debug this:
    [  287.289559]
    [  287.297582] Chain exists of:
    [  287.297582]   &vdev->memory_lock --> (work_completion)(&arg.work)
    --> &new_dev_set->lock
    [  287.297582]
    [  287.310023]  Possible unsafe locking scenario:
    [  287.310023]
    [  287.315961]        CPU0                    CPU1
    [  287.320510]        ----                    ----
    [  287.325059]   lock(&new_dev_set->lock);
    [  287.328917]
    lock((work_completion)(&arg.work));
    [  287.336153]                                lock(&new_dev_set->lock);
    [  287.342523]   lock(&vdev->memory_lock);
    [  287.346382]
    [  287.346382]  *** DEADLOCK ***
    [  287.346382]
    [  287.352315] 2 locks held by vfio_pci_sriov_/18636:
    [  287.357125]  #0: ff45bea208ed3e18 (&group->group_lock){+.+.}-{4:4},
    at: vfio_group_fops_unl_ioctl+0x3e3/0x7b0
    [  287.367048]  #1: ff45bea3a96b8230 (&new_dev_set->lock){+.+.}-{4:4},
    at: vfio_group_fops_unl_ioctl+0x44d/0x7b0
    [  287.376976]
    [  287.376976] stack backtrace:
    [  287.381353] CPU: 191 UID: 0 PID: 18636 Comm: vfio_pci_sriov_
    Tainted: G S                  7.0.0-dbg-DEV #3 PREEMPTLAZY
    [  287.381355] Tainted: [S]=CPU_OUT_OF_SPEC
    [  287.381356] Call Trace:
    [  287.381357]  <TASK>
    [  287.381358]  dump_stack_lvl+0x54/0x70
    [  287.381361]  print_circular_bug+0x2e1/0x300
    [  287.381363]  check_noncircular+0xf9/0x120
    [  287.381364]  ? __lock_acquire+0x5b4/0x2800
    [  287.381366]  __lock_acquire+0x14c6/0x2800
    [  287.381368]  ? pci_mmcfg_read+0x4f/0x220
    [  287.381370]  ? pci_mmcfg_write+0x57/0x220
    [  287.381371]  ? lock_acquire+0xd3/0x2f0
    [  287.381373]  ? pci_mmcfg_write+0x57/0x220
    [  287.381374]  ? lock_release+0xef/0x360
    [  287.381376]  ? vfio_pci_core_runtime_resume+0x1f/0xa0
    [  287.381377]  lock_acquire+0xd3/0x2f0
    [  287.381378]  ? vfio_pci_core_runtime_resume+0x1f/0xa0
    [  287.381379]  ? lock_is_held_type+0x76/0x100
    [  287.381382]  down_write+0x3a/0xc0
    [  287.381382]  ? vfio_pci_core_runtime_resume+0x1f/0xa0
    [  287.381383]  vfio_pci_core_runtime_resume+0x1f/0xa0
    [  287.381384]  ? __pfx_pci_pm_runtime_resume+0x10/0x10
    [  287.381385]  __rpm_callback+0x8c/0x310
    [  287.381386]  ? ktime_get_mono_fast_ns+0x3d/0xb0
    [  287.381389]  ? __pfx_pci_pm_runtime_resume+0x10/0x10
    [  287.381390]  rpm_resume+0x529/0x6f0
    [  287.381392]  ? lock_is_held_type+0x76/0x100
    [  287.381394]  __pm_runtime_resume+0x68/0x90
    [  287.381396]  vfio_pci_core_enable+0x44/0x310
    [  287.381398]  vfio_pci_open_device+0x1c/0x80
    [  287.381399]  vfio_df_open+0x10f/0x150
    [  287.381401]  vfio_group_fops_unl_ioctl+0x4a4/0x7b0
    [  287.381402]  __se_sys_ioctl+0x71/0xc0
    [  287.381404]  do_syscall_64+0x14d/0x750
    [  287.381405]  ? entry_SYSCALL_64_after_hwframe+0x77/0x7f
    [  287.381406]  ? trace_irq_disable+0x25/0xd0
    [  287.381409]  entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
    Introduce a private flag 'sriov_active' in the vfio_pci_core_device
    struct. This  allows the driver to track the SR-IOV power state requirement
    without  relying on pci_num_vf() while holding the memory_lock. The lock is
    now  only held to set the flag and ensure the device is in D0, after which
    pci_enable_sriov() can be called without the lock.
    
    Fixes: f4162eb1e2fc ("vfio/pci: Change the PF power state to D0 before enabling VFs")
    Cc: stable@vger.kernel.org
    Suggested-by: Jason Gunthorpe <jgg@ziepe.ca>
    Suggested-by: Alex Williamson <alex@shazbot.org>
    Signed-off-by: Raghavendra Rao Ananta <rananta@google.com>
    Link: https://lore.kernel.org/r/20260514173449.3282188-1-rananta@google.com
    [promote bitfield to plain bool to avoid storage-unit races]
    Signed-off-by: Alex Williamson <alex@shazbot.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
vfio: prevent infinite loop in vfio_mig_get_next_state() on blocked arc [+ + +]
Author: Junrui Luo <moonafterrain@outlook.com>
Date:   Tue Jun 2 16:58:48 2026 +0800

    vfio: prevent infinite loop in vfio_mig_get_next_state() on blocked arc
    
    commit a26b499b757cfc8bbff1088bb1b844639e250893 upstream.
    
    vfio_mig_get_next_state() walks vfio_from_fsm_table[] one step at a time,
    looping to skip optional states the device does not support until
    *next_fsm is supported. A blocked transition is encoded as
    VFIO_DEVICE_STATE_ERROR, which the trailing return reports as -EINVAL.
    
    The skip loop does not account for the ERROR sentinel.
    state_flags_table[ERROR] is ~0U and vfio_from_fsm_table[ERROR][*] is
    ERROR, so once *next_fsm becomes ERROR the loop condition stays true and
    *next_fsm never changes. The blocked arcs STOP_COPY -> PRE_COPY and
    STOP_COPY -> PRE_COPY_P2P map to ERROR yet pass the support check on a
    precopy-capable device, causing the loop to spin forever while holding
    the driver state mutex. This can result in a soft lockup, and a panic
    with softlockup_panic set.
    
    Terminate the skip loop on the ERROR sentinel so a blocked transition
    falls through to the existing return and reports -EINVAL.
    
    Fixes: 4db52602a607 ("vfio: Extend the device migration protocol with PRE_COPY")
    Reported-by: Yuhao Jiang <danisjiang@gmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Junrui Luo <moonafterrain@outlook.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
    Link: https://lore.kernel.org/r/SYBPR01MB7881290BBDE79B61AE6A017FAF122@SYBPR01MB7881.ausprd01.prod.outlook.com
    Signed-off-by: Alex Williamson <alex@shazbot.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

vfio: Remove device debugfs before releasing devres [+ + +]
Author: Alex Williamson <alex.williamson@nvidia.com>
Date:   Mon Jun 15 14:47:00 2026 -0600

    vfio: Remove device debugfs before releasing devres
    
    commit dc7fe87de492ea7f33a72b78d26650b75bf37f4f upstream.
    
    VFIO device debugfs files created with debugfs_create_devm_seqfile()
    store a devres allocated debugfs_devm_entry as inode private data.
    vfio_unregister_group_dev() currently calls vfio_device_del() before
    vfio_device_debugfs_exit(), but device_del() releases devres.  This can
    leave debugfs entries visible with stale inode private data while
    unregister waits for userspace references to drain.
    
    Remove the per-device debugfs tree before vfio_device_del().  The debugfs
    view is diagnostic only, so losing it at the start of unregister is
    preferable to preserving entries whose backing storage may already have
    been released.
    
    Complete the teardown by clearing the per-device debugfs root after
    removal.  This matches the global debugfs root cleanup and prevents
    future users from mistaking a removed dentry for a live debugfs tree
    during the remainder of unregister.
    
    Fixes: 2202844e4468 ("vfio/migration: Add debugfs to live migration driver")
    Reported-by: Sashiko AI Review <sashiko-bot@kernel.org>
    Link: https://lore.kernel.org/r/20260615192725.6A2221F000E9@smtp.kernel.org
    Cc: stable@vger.kernel.org
    Cc: Longfang Liu <liulongfang@huawei.com>
    Assisted-by: OpenAI Codex:gpt-5
    Signed-off-by: Alex Williamson <alex.williamson@nvidia.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Link: https://lore.kernel.org/r/20260615204717.735302-1-alex.williamson@nvidia.com
    Signed-off-by: Alex Williamson <alex@shazbot.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
virtio-mmio: fix device release warning on module unload [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Mon Apr 27 16:37:10 2026 +0200

    virtio-mmio: fix device release warning on module unload
    
    commit c687bc35694698ec4c7f92bf929c3d659f0cecb8 upstream.
    
    Driver core expects devices to be allocated dynamically and complains
    loudly when a device that lacks a release function is freed.
    
    Use __root_device_register() to allocate and register the root device
    instead of open coding using a static device.
    
    Note that root_device_register(), which also creates a link to the
    module, cannot be used as the device is registered when parsing the
    module parameters which happens before the module kobject has been set
    up.
    
    Fixes: 81a054ce0b46 ("virtio-mmio: Devices parameter parsing")
    Cc: stable@vger.kernel.org      # 3.5
    Cc: Pawel Moll <pawel.moll@arm.com>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Message-ID: <20260427143710.14702-1-johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
virtio_pci: fix vq info pointer lookup via wrong index [+ + +]
Author: Ammar Faizi <ammarfaizi2@openresty.com>
Date:   Sun Mar 15 21:18:08 2026 +0700

    virtio_pci: fix vq info pointer lookup via wrong index
    
    commit f7d380fb525c13bdd114369a1979c80c346e6abc upstream.
    
    Unbinding a virtio balloon device:
    
        echo virtio0 > /sys/bus/virtio/drivers/virtio_balloon/unbind
    
    triggers a NULL pointer dereference. The dmesg says:
    
        BUG: kernel NULL pointer dereference, address: 0000000000000008
        [...]
        RIP: 0010:__list_del_entry_valid_or_report+0x5/0xf0
        Call Trace:
        <TASK>
        vp_del_vqs+0x121/0x230
        remove_common+0x135/0x150
        virtballoon_remove+0xee/0x100
        virtio_dev_remove+0x3b/0x80
        device_release_driver_internal+0x187/0x2c0
        unbind_store+0xb9/0xe0
        kernfs_fop_write_iter.llvm.11660790530567441834+0xf6/0x180
        vfs_write+0x2a9/0x3b0
        ksys_write+0x5c/0xd0
        do_syscall_64+0x54/0x230
        entry_SYSCALL_64_after_hwframe+0x29/0x31
        [...]
        </TASK>
    
    The virtio_balloon device registers 5 queues (inflate, deflate, stats,
    free_page, reporting) but only the first two are unconditional. The
    stats, free_page and reporting queues are each conditional on their
    respective feature bits. When any of these features are absent, the
    corresponding vqs_info entry has name == NULL, creating holes in the
    array.
    
    The root cause is an indexing mismatch introduced when vq info storage
    was changed to be passed as an argument. vp_find_vqs_msix() and
    vp_find_vqs_intx() store the info pointer at vp_dev->vqs[i], where 'i'
    is the caller's sparse array index. However, the virtqueue itself gets
    vq->index assigned from queue_idx, a dense index that skips NULL
    entries. When holes exist, 'i' and queue_idx diverge. Later,
    vp_del_vqs() looks up info via vp_dev->vqs[vq->index] using the dense
    index into the sparsely-populated array, and hits NULL.
    
    Fix this by storing info at vp_dev->vqs[queue_idx] instead of
    vp_dev->vqs[i], so the store index matches the lookup index
    (vq->index). Apply the fix to both the MSIX and INTX paths.
    
    Cc: Yichun Zhang <yichun@openresty.com>
    Cc: Jiri Pirko <jiri@nvidia.com>
    Cc: stable@vger.kernel.org # v6.11+
    Tested-by: Yuka <yuka@umeyashiki.org>
    Fixes: 89a1c435aec2 ("virtio_pci: pass vq info as an argument to vp_setup_vq()")
    Signed-off-by: Ammar Faizi <ammarfaizi2@openresty.com>
    Message-Id: <20260315141808.547081-1-ammarfaizi2@openresty.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
vt: fix spurious modifier in CSI/cursor key sequences [+ + +]
Author: Nicolas Pitre <npitre@baylibre.com>
Date:   Thu Jun 25 22:48:33 2026 -0400

    vt: fix spurious modifier in CSI/cursor key sequences
    
    commit e9ad4d5ca309cb517d3f7a85251c3c5328f40f1f upstream.
    
    csi_modifier_param() builds the xterm modifier parameter from
    shift_state, counting KG_SHIFTL/KG_SHIFTR as Shift, KG_ALTGR as Alt
    and KG_CTRLL/KG_CTRLR as Ctrl in addition to the canonical KG_SHIFT,
    KG_ALT and KG_CTRL.
    
    That is wrong when those weights are not plain modifiers. Keymaps
    derived from XKB layouts (by kbd's xkbsupport, and by the
    console-setup used in Debian, Ubuntu and others) encode the active
    layout group using KG_SHIFTL/KG_SHIFTR:
    
            group 1: -
            group 2: shiftl
            group 3: shiftr
            group 4: shiftl | shiftr
    
    So while a non-default layout group is selected, KG_SHIFTL and/or
    KG_SHIFTR are set in shift_state with no Shift key held.
    csi_modifier_param() then adds a spurious Shift to every cursor and
    CSI key: pressing Up while group 2 is active emits ESC[1;2A (Shift+Up)
    instead of ESC[A. KG_ALTGR has the same problem since it is the
    standard third-level selector.
    
    Normal keymaps bind the physical Shift/Ctrl/Alt keys to KG_SHIFT,
    KG_CTRL and KG_ALT, leaving the left/right and AltGr weights free for
    layout and level selection. Count only those canonical weights, so
    genuine modifiers are still encoded while layout/level selectors are
    not.
    
    Fixes: 4af70f151671 ("vt: add modifier support to cursor keys")
    Reported-by: Alexey Gladkov <legion@kernel.org>
    Closes: https://lore.kernel.org/kbd/aj2gR0Y7sM6i9s2G@example.org/
    Cc: stable <stable@kernel.org>
    Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
    Link: https://patch.msgid.link/20260626024833.3419086-1-nico@fluxnic.net
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
watchdog: apple: Add "apple,t8103-wdt" compatible [+ + +]
Author: Janne Grunau <j@jannau.net>
Date:   Wed Dec 31 13:07:21 2025 +0100

    watchdog: apple: Add "apple,t8103-wdt" compatible
    
    commit 14ca4868886f2188401fe06cd7bf01a330b3fb99 upstream.
    
    After discussion with the devicetree maintainers we agreed to not extend
    lists with the generic compatible "apple,wdt" anymore [1]. Use
    "apple,t8103-wdt" as base compatible as it is the SoC the driver and
    bindings were written for.
    
    [1]: https://lore.kernel.org/asahi/12ab93b7-1fc2-4ce0-926e-c8141cfe81bf@kernel.org/
    
    Fixes: 4ed224aeaf66 ("watchdog: Add Apple SoC watchdog driver")
    Cc: stable@vger.kernel.org
    Reviewed-by: Neal Gompa <neal@gompa.dev>
    Signed-off-by: Janne Grunau <j@jannau.net>
    Link: https://lore.kernel.org/r/20251231-watchdog-apple-t8103-base-compat-v1-1-1702a02e0c45@jannau.net
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
wifi: mt76: mt7921/mt7925: fix NULL dereference in CSA beacon [+ + +]
Author: Arjan van de Ven <arjan@linux.intel.com>
Date:   Mon May 4 07:51:06 2026 -0700

    wifi: mt76: mt7921/mt7925: fix NULL dereference in CSA beacon
    
    [ Upstream commit 351dd7d2c80d23e56dcce6faa4e62bea5b0877c7 ]
    
    This patch is based on a BUG as reported by Bongani Hlope at
    https://lore.kernel.org/all/20260502125824.425d7159@bongani-mini.home.org.za/
    
    When a channel-switch announcement (CSA) beacon is received,
    cfg80211 queues a wiphy work item that eventually calls
    mt7921_channel_switch_rx_beacon(). If the station disconnects
    (or the channel context is otherwise torn down) between the
    time the work is queued and the time it runs, the driver's
    dev->new_ctx pointer can already have been cleared to NULL.
    mt7921_channel_switch_rx_beacon() then dereferences new_ctx
    unconditionally, triggering a NULL pointer dereference at
    address 0x0:
    
      BUG: kernel NULL pointer dereference, address: 0000000000000000
      RIP: 0010:mt7921_channel_switch_rx_beacon+0x1f/0x100 [mt7921_common]
    
    The same missing guard exists in mt7925_channel_switch_rx_beacon(),
    which shares the same code pattern introduced by the same commit.
    
    Add an early-return NULL check for dev->new_ctx in both
    mt7921_channel_switch_rx_beacon() and
    mt7925_channel_switch_rx_beacon(). When new_ctx is NULL there is
    no pending channel switch to process, so returning immediately is
    the correct and safe action.
    
    Fixes: 8aa2f59260eb ("wifi: mt76: mt7921: introduce CSA support")
    Reported-by: Bongani Hlope <developer@hlope.org.za>
    Oops-Analysis: http://oops.fenrus.org/reports/lkml/20260502125824.425d7159@bongani-mini.home.org.za/report.html
    Link: https://lore.kernel.org/all/20260502125824.425d7159@bongani-mini.home.org.za/
    Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
    Cc: linux-wireless@vger.kernel.org
    Cc: linux-mediatek@lists.infradead.org
    Cc: Felix Fietkau <nbd@nbd.name>
    Cc: Lorenzo Bianconi <lorenzo@kernel.org>
    Cc: Ryder Lee <ryder.lee@mediatek.com>
    Link: https://patch.msgid.link/20260504145107.1329197-1-arjan@linux.intel.com
    Signed-off-by: Felix Fietkau <nbd@nbd.name>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

wifi: rtw89: correct drop logic for malformed AMPDU frames [+ + +]
Author: Po-Hao Huang <phhuang@realtek.com>
Date:   Fri May 15 09:44:29 2026 +0800

    wifi: rtw89: correct drop logic for malformed AMPDU frames
    
    [ Upstream commit 63ccdfac8677387dfdbd9d4336089e9823280704 ]
    
    The previous commit aims to fix issue caused by malformed AMPDU frames.
    But the drop logic fails to deal with the first AMPDU packet paired with
    certain range of sequence number, and leads to unexpected packet drop.
    It is more likely to encounter this failure when there are busy traffic
    during rekey process and could lead to disconnection from the AP.
    Fix this by adding a initial state judgement and only reset status
    during pairwise rekey.
    
    Fixes: bda294ed0ed0 ("wifi: rtw89: Drop malformed AMPDU frames with abnormal PN")
    Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
    Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
    Link: https://patch.msgid.link/20260515014433.16168-10-pkshih@realtek.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
writeback: fix race between cgroup_writeback_umount() and inode_switch_wbs() [+ + +]
Author: Baokun Li <libaokun@linux.alibaba.com>
Date:   Thu May 21 17:50:14 2026 +0800

    writeback: fix race between cgroup_writeback_umount() and inode_switch_wbs()
    
    commit cba38ec4cbd3a7b8b942a8d52531a05be8a9ff0d upstream.
    
    When a container exits, the following BUG_ON() is occasionally triggered:
    
    ==================================================================
     VFS: Busy inodes after unmount of sdb (ext4)
     ------------[ cut here ]------------
     kernel BUG at fs/super.c:695!
     CPU: 3 PID: 6 Comm: containerd-shim Tainted: G OE K 6.6 #1
     pstate: 63400009 (nZCv daif +PAN -UAO +TCO +DIT -SSBS BTYPE=--)
     pc : generic_shutdown_super+0xf0/0x100
     lr : generic_shutdown_super+0xf0/0x100
     Call trace:
      generic_shutdown_super+0xf0/0x100
      kill_block_super+0x20/0x48
      ext4_kill_sb+0x28/0x60
      deactivate_locked_super+0x54/0x130
      deactivate_super+0x84/0xa0
      cleanup_mnt+0xa4/0x140
      __cleanup_mnt+0x18/0x28
      task_work_run+0x78/0xe0
      do_notify_resume+0x204/0x240
    ==================================================================
    
    The root cause is a race between cgroup_writeback_umount() and
    inode_switch_wbs()/cleanup_offline_cgwb(). There is a window between
    inode_prepare_wbs_switch() returning true and the subsequent
    wb_queue_isw() call. Following is the process that triggers the issue:
    
          CPU A (umount)           |          CPU B (writeback)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                     inode_switch_wbs/cleanup_offline_cgwb
                                      atomic_inc(&isw_nr_in_flight)
                                      inode_prepare_wbs_switch
                                       -> passes SB_ACTIVE check
                                       __iget(inode)
     generic_shutdown_super
      sb->s_flags &= ~SB_ACTIVE
      cgroup_writeback_umount(sb)
       smp_mb()
       atomic_read(&isw_nr_in_flight)
       rcu_barrier()
        -> no pending RCU callbacks
       flush_workqueue(isw_wq)
        -> nothing queued, returns
      evict_inodes(sb)
       -> Inode skipped as isw still holds a ref.
      sop->put_super(sb)
       /* destroys percpu counters */
      -> VFS: Busy inodes after unmount!
                                      wb_queue_isw()
                                       queue_work(isw_wq, ...)
                                      /* later in work function */
                                      inode_switch_wbs_work_fn
                                       process_inode_switch_wbs
                                        iput() -> evict
                                         percpu_counter_dec() // UAF!
    
    Fix this by extending the RCU read-side critical section in
    inode_switch_wbs() and cleanup_offline_cgwb() to cover from
    inode_prepare_wbs_switch() through wb_queue_isw().  Since there is
    no sleep in this window, rcu_read_lock() can be used.  Then add a
    synchronize_rcu() in cgroup_writeback_umount() before the existing
    rcu_barrier(), so that all in-flight switchers that have passed the
    SB_ACTIVE check have completed queue_work() before flush_workqueue()
    is called.
    
    The existing rcu_barrier() is intentionally retained so this fix can
    be backported unchanged to stable kernels (5.10.y, 6.6.y, ...) that
    still queue switches via queue_rcu_work(). It is a no-op on current
    mainline (since commit e1b849cfa6b6 ("writeback: Avoid contention on
    wb->list_lock when switching inodes")) and is removed in a follow-up
    patch.
    
    Fixes: a1a0e23e4903 ("writeback: flush inode cgroup wb switches instead of pinning super_block")
    Cc: stable@vger.kernel.org
    Suggested-by: Jan Kara <jack@suse.cz>
    Link: https://lore.kernel.org/all/mxnjq2l6guusfchvauxr3v7c4bwjasybxlleqbbh4efloeqspz@iqylk76ohufz
    Reviewed-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Baokun Li <libaokun@linux.alibaba.com>
    Link: https://patch.msgid.link/20260521095016.2791354-2-libaokun@linux.alibaba.com
    Acked-by: Tejun Heo <tj@kernel.org>
    Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
X.509: Fix validation of ASN.1 certificate header [+ + +]
Author: Lukas Wunner <lukas@wunner.de>
Date:   Thu May 14 08:55:58 2026 +0200

    X.509: Fix validation of ASN.1 certificate header
    
    commit 3b626ba431c4501512ad07549310685e07fe4706 upstream.
    
    x509_load_certificate_list() seeks to enforce that a certificate starts
    with 0x30 0x82 (ASN.1 SEQUENCE tag followed by a length of more than 256
    and less than 65535 bytes).
    
    But it only enforces that *either* of those two byte values are present,
    instead of checking for the *conjunction* of the two values.  Fix it.
    
    Fixes: 631cc66eb9ea ("MODSIGN: Provide module signing public keys to the kernel")
    Reported-by: Sashiko <sashiko-bot@kernel.org>
    Closes: https://lore.kernel.org/r/20260508033917.B5873C2BCB0@smtp.kernel.org/
    Signed-off-by: Lukas Wunner <lukas@wunner.de>
    Cc: stable@vger.kernel.org # v3.7+
    Reviewed-by: Ignat Korchagin <ignat@linux.win>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
x86,fs/resctrl: Prevent out-of-bounds access while offlining CPU when SNC enabled [+ + +]
Author: Reinette Chatre <reinette.chatre@intel.com>
Date:   Tue Jun 9 14:02:27 2026 -0700

    x86,fs/resctrl: Prevent out-of-bounds access while offlining CPU when SNC enabled
    
    commit fc16126cc11d9f507130bf84ab137ee0938c900e upstream.
    
    The architecture updates the cpu_mask in a domain's header to track which
    online CPUs are associated with the domain. When this mask becomes empty
    the architecture initiates offline of the domain that includes calling
    on resctrl fs to offline the domain. If it is a monitoring domain in
    which LLC occupancy is tracked resctrl fs forces the limbo handler to
    clear all busy RMID state associated with the domain.
    
    The limbo handler always reads the current event value associated with a
    busy RMID irrespective of it being checked as part of regular "is it still
    busy" check or whether it will be forced released anyway. When reading an
    RMID on a system with SNC enabled the "logical RMID" is converted to the
    "physical RMID" and this conversion requires the NUMA node ID of the
    resctrl monitoring domain that is in turn determined by querying the NUMA
    node ID of any CPU belonging to the monitoring domain.
    
    When the monitoring domain is going offline its cpu_mask is empty causing
    the NUMA node ID query via cpu_to_node() to be done with "nr_cpu_ids" as
    argument resulting in an out-of-bounds access.
    
    Refactor the limbo handler to skip reading the RMID when the RMID will
    just be forced to no longer be dirty in the domain anyway. Add a safety
    check to the architecture's RMID reader to protect against this scenario.
    
    Fixes: e13db55b5a0d ("x86/resctrl: Introduce snc_nodes_per_l3_cache")
    Closes: https://sashiko.dev/#/patchset/cover.1780456704.git.reinette.chatre%40intel.com?part=9
    Reported-by: Sashiko <sashiko-bot@kernel.org>
    Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Cc: <stable@kernel.org>
    Link: https://patch.msgid.link/16137433df42f85013b2f7a53626795cbd6637b9.1781029125.git.reinette.chatre@intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
x86/bugs: Enable IBPB flush on BPF JIT allocation [+ + +]
Author: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Date:   Thu Jul 9 15:23:25 2026 -0700

    x86/bugs: Enable IBPB flush on BPF JIT allocation
    
    commit a3af84b0fa00ead01fcd0e28b5d773ff25990a0d upstream.
    
    Enable hardening against JIT spraying when Spectre-v2 mitigations are in
    use. Specifically, issue an IBPB flush on BPF JIT memory reuse. Skip
    enabling the IBPB flush if the BPF dispatcher is already using a retpoline
    sequence.
    
    This hardening applies only when BPF-JIT is in use. Guard the enabling
    under CONFIG_BPF_JIT so that bugs.c still builds with CONFIG_BPF_JIT=n.
    
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Acked-by: Daniel Borkmann <daniel@iogearbox.net>
    Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
x86/mm: Fix freeing of PMD-sized vmemmap pages [+ + +]
Author: David Hildenbrand (Arm) <david@kernel.org>
Date:   Wed Apr 29 12:49:14 2026 +0200

    x86/mm: Fix freeing of PMD-sized vmemmap pages
    
    commit 39406c05f8f150f1685839acd38ffdd69ff92031 upstream.
    
    Commit bf9e4e30f353 ("x86/mm: use pagetable_free()"), switched from
    freeing non-boot page tables through __free_pages() to
    pagetable_free().
    
    However, the function is also called to free vmemmap pages.
    
    Given that vmemmap pages are not page tables, already the page_ptdesc(page)
    is wrong. But worse, pagetable_free() calls:
    
            __free_pages(page, compound_order(page));
    
    Since vmemmap pages are not compound pages (see vmemmap_alloc_block())
    -- except for HVO, which doesn't apply here -- only first page of a
    PMD-sized vmemmap page is freed, leaking the other ones.
    
    Fix it by properly decoupling pagetable and vmemmap freeing.
    free_pagetable() no longer has to mess with SECTION_INFO, as only the
    vmemmap is marked like that in register_page_bootmem_memmap().
    
    The indentation in remove_pmd_table() is messed up. Fix that while
    touching it.
    
    Bootmem info handling will soon be fixed up. For now, handle it
    similar to free_pagetable(), just avoiding the ifdef.
    
    [ dhansen: changelog munging. More imperative voice ]
    
    Fixes: bf9e4e30f353 ("x86/mm: use pagetable_free()")
    Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
    Tested-by: Lance Yang <lance.yang@linux.dev>
    Link: https://lore.kernel.org/20260429-vmemmap-v2-1-8dfcacffd877@kernel.org
    Link: https://patch.msgid.link/20260429-vmemmap-v2-1-8dfcacffd877@kernel.org
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
xfs: clamp timestamp nanoseconds correctly [+ + +]
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Mon Jul 13 23:07:15 2026 -0700

    xfs: clamp timestamp nanoseconds correctly
    
    commit 15e38a9366b31d3d61081ead115f1dff59379e24 upstream.
    
    LOLLM noticed an off-by-one error in the nsec clamping; fix that so that
    we never have tv_nsec == 1e9.
    
    Cc: stable@vger.kernel.org # v6.8
    Fixes: 2d295fe65776d1 ("xfs: repair inode records")
    Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
    Assisted-by: LOLLM # finding obvious bugs
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: don't wrap around quota ids in dqiterate [+ + +]
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Mon Jul 13 23:04:55 2026 -0700

    xfs: don't wrap around quota ids in dqiterate
    
    commit d766e4e5e85d829629c3ba503802fe1303d7b591 upstream.
    
    LOLLM noticed that q_id is an unsigned 32-bit variable.  If it happens
    to be set to XFS_DQ_ID_MAX due to a filesystem that actually has a dquot
    for ID_MAX, then this addition will truncate to zero and the iteration
    starts over.  Fix this by casting to u64.
    
    Cc: stable@vger.kernel.org # v6.8
    Fixes: 21d7500929c8a0 ("xfs: improve dquot iteration for scrub")
    Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
    Assisted-by: LOLLM # finding obvious bugs
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: don't zap bmbt forks if they are MAXLEVELS tall [+ + +]
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Mon Jul 13 23:07:30 2026 -0700

    xfs: don't zap bmbt forks if they are MAXLEVELS tall
    
    commit 59c462b0f5cfa107794228051724b34ae9334168 upstream.
    
    LOLLM noticed a discrepancy between the bmbt level checks in the libxfs
    bmbt code vs. the inode repair code.  We do actually allow a bmbt root
    that proclaims to have a height of XFS_BM_MAXLEVELS.
    
    Cc: stable@vger.kernel.org # v6.8
    Fixes: e744cef2060559 ("xfs: zap broken inode forks")
    Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
    Assisted-by: LOLLM # finding obvious bugs
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: fail recovery on a committed log item with no regions [+ + +]
Author: Weiming Shi <bestswngs@gmail.com>
Date:   Thu Jul 2 09:20:00 2026 -0700

    xfs: fail recovery on a committed log item with no regions
    
    commit 2094dab19d45c487285617b7b68913d0cc0c1211 upstream.
    
    If the first op of a transaction is a bare transaction header
    (len == sizeof(struct xfs_trans_header)), xlog_recover_add_to_trans()
    adds an item but no region, leaving it on r_itemq with ri_cnt == 0 and
    ri_buf == NULL.
    
    The header can be split across op records, so later ops may still add
    regions; the item is only invalid if the transaction commits with none.
    The runtime commit path never emits such a transaction, so this only
    happens on a crafted log.  It came from an AI-assisted code audit of the
    recovery parser.
    
    xlog_recover_reorder_trans() calls ITEM_TYPE() on the item, which reads
    *(unsigned short *)item->ri_buf[0].iov_base and faults on the NULL
    ri_buf.  Reject it there, before the commit handlers that also read
    ri_buf[0].
    
     KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
     RIP: 0010:xlog_recover_reorder_trans (fs/xfs/xfs_log_recover.c:1836)
      xlog_recover_commit_trans (fs/xfs/xfs_log_recover.c:2043)
      xlog_recover_process_data (fs/xfs/xfs_log_recover.c:2501)
      xlog_do_recovery_pass (fs/xfs/xfs_log_recover.c:3244)
      xlog_recover (fs/xfs/xfs_log_recover.c:3493)
      xfs_log_mount (fs/xfs/xfs_log.c:618)
      xfs_mountfs (fs/xfs/xfs_mount.c:1034)
      xfs_fs_fill_super (fs/xfs/xfs_super.c:1938)
      vfs_get_tree (fs/super.c:1695)
      path_mount (fs/namespace.c:4161)
      __x64_sys_mount (fs/namespace.c:4367)
    
    Fixes: 89cebc847729 ("xfs: validate transaction header length on log recovery")
    Cc: stable@vger.kernel.org # v4.3
    Reported-by: Xiang Mei <xmei5@asu.edu>
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: Weiming Shi <bestswngs@gmail.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: fix exchmaps reservation limit check [+ + +]
Author: Yingjie Gao <gaoyingjie@uniontech.com>
Date:   Thu Jun 4 20:03:17 2026 +0800

    xfs: fix exchmaps reservation limit check
    
    commit 0a5213bbff62b51c7d4999ac8c7e11ea57d00d45 upstream.
    
    xfs_exchmaps_estimate_overhead() adds the bmbt and rmapbt
    overhead to a local resblks variable, but the final UINT_MAX
    check still tests req->resblks.  That is the reservation value
    from before the overhead was added.
    
    The computed value is stored back in req->resblks and later passed
    to xfs_trans_alloc(), whose block reservation argument is unsigned
    int.  Check the computed reservation so the existing limit applies
    to the value that will be used.
    
    Fixes: 966ceafc7a43 ("xfs: create deferred log items for file mapping exchanges")
    Cc: stable@vger.kernel.org # v6.10
    Signed-off-by: Yingjie Gao <gaoyingjie@uniontech.com>
    Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: fix memory leak in xfs_dqinode_metadir_create() [+ + +]
Author: Dawei Feng <dawei.feng@seu.edu.cn>
Date:   Sat Jun 27 14:04:02 2026 +0800

    xfs: fix memory leak in xfs_dqinode_metadir_create()
    
    commit 45de375b25060edf46e20abb36521ba530336ceb upstream.
    
    If xfs_metadir_create() fails in xfs_dqinode_metadir_create(), the current
    code returns directly, leaking the allocated update and transaction state.
    If the subsequent commit fails, the caller-owned inode reference is left
    behind.
    
    Fix this memory leak by routing the create failure path through
    xfs_metadir_cancel().  For both create and commit failures, finish and
    release any inode returned to the caller, mirroring the unwind pattern in
    xfs_metadir_mkdir().
    
    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 kprobe fault injection during `mount -o uquota` on a metadir XFS
    image. Injecting xfs_metadir_create() reproduced the old active-update path
    that left mount stuck later in mount setup; after this change, the same
    injection reported cancel_hits=1 and irele_hits=1. Injecting
    xfs_metadir_commit() exercised the old inode-reference leak path; after
    this change, it reported irele_hits=1.
    
    Fixes: e80fbe1ad8ef ("xfs: use metadir for quota inodes")
    Cc: stable@vger.kernel.org # v6.13
    Signed-off-by: Dawei Feng <dawei.feng@seu.edu.cn>
    Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: fix null pointer dereference in tracepoint [+ + +]
Author: Andrey Albershteyn <aalbersh@kernel.org>
Date:   Thu Jul 9 17:24:07 2026 +0200

    xfs: fix null pointer dereference in tracepoint
    
    commit 9202ee546b0cd71004eed7598546efe4660097da upstream.
    
    If dfp is not NULL we exit early here, when dfp is NULL it's allocated
    in xfs_defer_alloc() but not assigned. The tracepoint tries to
    dereference members of dfp struct.
    
    Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
    Cc: stable@vger.kernel.org # v6.8
    Fixes: 3f3cec031099c3 ("xfs: force small EFIs for reaping btree extents")
    Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: fix off-by-one error when calling xchk_xref_has_rt_owner [+ + +]
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Mon Jul 13 23:06:28 2026 -0700

    xfs: fix off-by-one error when calling xchk_xref_has_rt_owner
    
    commit 5d72a68f2007ba2a968d6bf47dba3f4620bd182e upstream.
    
    LOLLM noticed an off-by-one error when computing the length of the
    rtrmap to cross-check.
    
    Cc: stable@vger.kernel.org # v6.14
    Fixes: 037a44d8277adf ("xfs: cross-reference the realtime rmapbt")
    Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
    Assisted-by: LOLLM # finding obvious bugs
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: fix pointer arithmetic error on 32-bit systems [+ + +]
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Tue Jun 9 21:57:24 2026 -0700

    xfs: fix pointer arithmetic error on 32-bit systems
    
    commit 84eec3f7fc73144d1a230c9e8ad92721e37dcaab upstream.
    
    The translation of the old XFS_BMBT_KEY_ADDR macro into a static
    function is not correct on 32-bit systems because the sizeof() argument
    went from being a xfs_bmbt_key_t (i.e. a struct) to a (struct
    xfs_bmbt_key *) (i.e. a pointer to the same struct).  On 64-bit systems
    this turns out ok because they are the same size, but on 32-bit systems
    this is catastrophic because they are not the same size.  So far there
    have been no complaints, most likely because the xfs developers urge
    against running it on 32-bit systems.  But this needs fixing asap.
    
    Cc: stable@vger.kernel.org # v6.12
    Fixes: 79124b37400635 ("xfs: replace shouty XFS_BM{BT,DR} macros")
    Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: fix unreachable BIGTIME check in dquot flush validation [+ + +]
Author: Alexey Nepomnyashih <sdl@nppct.ru>
Date:   Wed Jun 3 20:41:47 2026 +0000

    xfs: fix unreachable BIGTIME check in dquot flush validation
    
    commit 03866d130ed33ab68cc7faaf4bf2c4abef96d42e upstream.
    
    The dqp->q_id == 0 check inside the XFS_DQTYPE_BIGTIME block is
    unreachable because root dquots return successfully earlier. Reject root
    dquots with XFS_DQTYPE_BIGTIME before that early return, preserving the
    intended validation and removing the unreachable condition.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: 4ea1ff3b4968 ("xfs: widen ondisk quota expiration timestamps to handle y2038+")
    Cc: stable@vger.kernel.org # v5.10+
    Signed-off-by: Alexey Nepomnyashih <sdl@nppct.ru>
    Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
    Reviewed-by: Allison Henderson <achender@kernel.org>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: fully check the parent handle when it points to the rootdir [+ + +]
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Mon Jul 13 23:06:59 2026 -0700

    xfs: fully check the parent handle when it points to the rootdir
    
    commit ba150ce63453ccd74bae1404c1dfedbd01ecfd55 upstream.
    
    LOLLM noticed that the directory tree path checking declares the path to
    be ok if the inumber in the parent pointer reaches the root directory.
    Unfortunately, it neglects to check that the generation is correct.  Fix
    that by moving the generation check up.
    
    Cc: stable@vger.kernel.org # v6.10
    Fixes: 928b721a11789a ("xfs: teach online scrub to find directory tree structure problems")
    Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
    Assisted-by: LOLLM # finding obvious bugs
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: grab rtrmap btree when checking rgsuper [+ + +]
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Mon Jul 13 23:05:57 2026 -0700

    xfs: grab rtrmap btree when checking rgsuper
    
    commit ea6e2d9de25d2095845e0cdf2274e581fd40d636 upstream.
    
    LOLLM noticed that we aren't grabbing the rtrmap btree when we check the
    realtime group superblock.  As a result, none of the cross-referencing
    checks have ever run.  Fix this.
    
    Cc: stable@vger.kernel.org # v6.14
    Fixes: 428e4884656db9 ("xfs: allow queued realtime intents to drain before scrubbing")
    Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
    Assisted-by: LOLLM # finding obvious bugs
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: handle non-inode owners for rtrmap record checking [+ + +]
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Mon Jul 13 23:06:43 2026 -0700

    xfs: handle non-inode owners for rtrmap record checking
    
    commit 353a5900bc85234e7df05caac37698042dc26348 upstream.
    
    LOLLM noticed that two helper functions in the rtrmapbt scrub code don't
    actually handle non-inode owners correctly -- CoW staging extents and
    rgsuperblock extents are not shareable, but they are mergeable.  Fix
    these two helpers.
    
    Cc: stable@vger.kernel.org # v6.14
    Fixes: 2d9a3e98053e8c ("xfs: allow overlapping rtrmapbt records for shared data extents")
    Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
    Assisted-by: LOLLM # finding obvious bugs
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: initialize iomap->flags earlier in xfs_bmbt_to_iomap [+ + +]
Author: Christoph Hellwig <hch@lst.de>
Date:   Tue Jun 9 09:53:44 2026 +0200

    xfs: initialize iomap->flags earlier in xfs_bmbt_to_iomap
    
    commit 327e58826eb72f8bae9419cf1a4e722b57c85694 upstream.
    
    Otherwise we lose the IOMAP_IOEND_BOUNDARY assingment for writes to the
    first block in a realtime group, and could cause incorrect merges for
    such writes.
    
    Fixes: b91afef72471 ("xfs: don't merge ioends across RTGs")
    Cc: <stable@vger.kernel.org> # v6.13
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: only log freed extents for the current RTG in zoned growfs [+ + +]
Author: Christoph Hellwig <hch@lst.de>
Date:   Wed Jun 10 07:07:21 2026 +0200

    xfs: only log freed extents for the current RTG in zoned growfs
    
    commit 44cccefe65749821d9a13523c8b763bf1262ef73 upstream.
    
    Otherwise a power fail or crash during growfs could lead to an
    elevated sb_rblocks counter.
    
    Note that the step function is much simpler compared to the classic RT
    allocator as zoned RT sections must be aligned to real time group
    boundaries.
    
    Fixes: 01b71e64bb87 ("xfs: support growfs on zoned file systems")
    Cc: <stable@vger.kernel.org> # v6.15
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
    Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: pass back updated nb from xfs_growfs_compute_deltas [+ + +]
Author: Christoph Hellwig <hch@lst.de>
Date:   Tue Jun 9 09:52:44 2026 +0200

    xfs: pass back updated nb from xfs_growfs_compute_deltas
    
    commit 4cb6e89a3d901d4da515977e55f9a9a779238660 upstream.
    
    xfs_growfs_compute_deltas can update nb for corner cases like a number
    of blocks that would create a less the minimal sized AG, or running
    past the max AG limit.  Pass back the calculated value to the caller,
    as it relies on to calculate the new number of perag structures.
    
    Note that the grown file system size is not affected by this
    miscalculation as it uses the passed back delta value.
    
    Fixes: a49b7ff63f98 ("xfs: Refactoring the nagcount and delta calculation")
    Cc: stable@vger.kernel.org # v7.0
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
    Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: release dquot buffer after dqflush failure [+ + +]
Author: Yingjie Gao <gaoyingjie@uniontech.com>
Date:   Thu Jun 25 21:16:23 2026 +0800

    xfs: release dquot buffer after dqflush failure
    
    commit 0c1b3a823a22af623d55f225fe2ac7e8b9052821 upstream.
    
    xfs_qm_dqpurge() gets a locked buffer from xfs_dquot_use_attached_buf().
    If xfs_qm_dqflush() fails, the error path skips xfs_buf_relse() and then
    calls xfs_dquot_detach_buf(), which tries to lock the same buffer again.
    
    Release the buffer after xfs_qm_dqflush() returns so the error path drops
    the caller hold and unlocks the buffer before the dquot is detached,
    matching the other dqflush callers.
    
    Fixes: a40fe30868ba ("xfs: separate dquot buffer reads from xfs_dqflush")
    Cc: stable@vger.kernel.org # v6.13+
    Signed-off-by: Yingjie Gao <gaoyingjie@uniontech.com>
    Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: resample the data fork mapping after cycling ILOCK [+ + +]
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Mon Jul 13 23:03:44 2026 -0700

    xfs: resample the data fork mapping after cycling ILOCK
    
    commit 2f4acd0fcd862e22eab45690ec2c08c80b6ef2e7 upstream.
    
    xfs_reflink_fill_{cow_hole,delalloc} are both presented with an inode,
    a data fork mapping, and a cow fork mapping.  Unfortunately, these two
    helpers cycle the ILOCK to grab a transaction, which means that the
    mappings are stale as soon as we reacquire the ILOCK.  Currently we
    refresh the cow fork mapping by re-calling xfs_find_trim_cow_extent, but
    we don't refresh the data fork mapping beforehand, which means that the
    xfs_bmap_trim_cow in that function queries the refcount btree about the
    wrong physical blocks and returns an inaccurate value in *shared.
    
    If *shared is now false, the directio write proceeds with a stale data
    fork mapping.  Fix this by querying the data fork mapping if the
    sequence counter changes across the ILOCK cycle.
    
    Cc: hch@lst.de
    Cc: stable@vger.kernel.org # v4.11
    Fixes: 3c68d44a2b49a0 ("xfs: allocate direct I/O COW blocks in iomap_begin")
    Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: set xfarray killable sort correctly [+ + +]
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Mon Jul 13 23:06:12 2026 -0700

    xfs: set xfarray killable sort correctly
    
    commit 540ddc626245f12f56326ee0c1601f71ebb41d64 upstream.
    
    LOLLM noticed that we *disable* interruptible sorts when the KILLABLE
    flag is set.  This is backwards.  Fix the incorrect logic, and rename
    the variable to make the connection more obvious.
    
    Cc: stable@vger.kernel.org # v6.10
    Fixes: 271557de7cbfde ("xfs: reduce the rate of cond_resched calls inside scrub")
    Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
    Assisted-by: LOLLM # finding obvious bugs
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: use null daddr for unset first bad log block [+ + +]
Author: Yousef Alhouseen <alhouseenyousef@gmail.com>
Date:   Tue Jun 30 12:06:07 2026 +0200

    xfs: use null daddr for unset first bad log block
    
    commit cc9af5e461ea5f6e37738f3f1e41c45a9b7f45d6 upstream.
    
    xlog_do_recovery_pass() may return before setting first_bad.  The caller
    must distinguish that case from an error at a valid log block, including
    block zero after the log wraps.
    
    Initialize first_bad to XFS_BUF_DADDR_NULL and test it explicitly before
    treating the error as a torn write.
    
    Fixes: 7088c4136fa1 ("xfs: detect and trim torn writes during log recovery")
    Suggested-by: Darrick J. Wong <djwong@kernel.org>
    Reported-by: syzbot+b7dfbed0c6c2b5e9fd34@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=b7dfbed0c6c2b5e9fd34
    Cc: stable@vger.kernel.org # v4.5
    Signed-off-by: Yousef Alhouseen <alhouseenyousef@gmail.com>
    Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: use rtrefcount btree cursor in xchk_xref_is_rt_cow_staging [+ + +]
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Mon Jul 13 23:05:10 2026 -0700

    xfs: use rtrefcount btree cursor in xchk_xref_is_rt_cow_staging
    
    commit ee248157da501f0c02688fb64e5359f2832b0b01 upstream.
    
    LOLLM points out that we pass the wrong btree cursor here.  We want the
    rtrefcount btree cursor, not the non-rt one.  This is fairly benign
    since it only affects tracing data.
    
    Cc: stable@vger.kernel.org # v6.14
    Fixes: 91683bb3f264c0 ("xfs: cross-reference checks with the rt refcount btree")
    Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
    Assisted-by: LOLLM # finding obvious bugs
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: use the rt version of the cow staging checker [+ + +]
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Mon Jul 13 23:05:26 2026 -0700

    xfs: use the rt version of the cow staging checker
    
    commit 881f2eb0fcdea2f46a50fa6a892fe9e3ccf19e01 upstream.
    
    LOLLM also noticed that xchk_rtrmapbt_xref ought to be using the rtdev
    version of the "is this a cow extent?" helper function, not the datadev
    one.
    
    Cc: stable@vger.kernel.org # v6.14
    Fixes: 91683bb3f264c0 ("xfs: cross-reference checks with the rt refcount btree")
    Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
    Assisted-by: LOLLM # finding obvious bugs
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfs: write the rg superblock when fixing it [+ + +]
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Mon Jul 13 23:05:41 2026 -0700

    xfs: write the rg superblock when fixing it
    
    commit 9af789fa274bc14b907f811f79fa988a6fc6d4e7 upstream.
    
    The rtgroup superblock fixer should write the rtgroup superblock.
    LOLLM noticed this, oops. :/
    
    Cc: stable@vger.kernel.org # v6.13
    Fixes: 1433f8f9cead37 ("xfs: repair realtime group superblock")
    Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
    Assisted-by: LOLLM # finding obvious bugs
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Carlos Maiolino <cem@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
xhci: sideband: fix ring sg table pages leak [+ + +]
Author: Xu Rao <raoxu@uniontech.com>
Date:   Fri Jul 3 17:40:32 2026 +0300

    xhci: sideband: fix ring sg table pages leak
    
    commit 49f6e3c3ef19f04f6657ed8dce550e36c763abb8 upstream.
    
    xhci_ring_to_sgtable() allocates a temporary pages array and
    uses it to build the returned sg_table with
    sg_alloc_table_from_pages().
    
    The error paths free the pages array, but the success path
    returns the sg_table without freeing it. This leaks the temporary
    array every time a sideband client gets an endpoint or event ring
    buffer.
    
    Free the pages array after sg_alloc_table_from_pages() succeeds.
    The returned sg_table has its own scatterlist entries and does not
    depend on the temporary array after construction.
    
    Fixes: de66754e9f80 ("xhci: sideband: add initial api to register a secondary interrupter entity")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Xu Rao <raoxu@uniontech.com>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://patch.msgid.link/20260703144033.483286-2-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>