Changelog in Linux kernel 6.18.35

 
accel/rocket: fix UAF via dangling GEM handle in create_bo [+ + +]
Author: Dhabaleshwar Das <dhabal123@gmail.com>
Date:   Thu May 21 00:00:00 2026 +0530

    accel/rocket: fix UAF via dangling GEM handle in create_bo
    
    [ Upstream commit f706e6a4ce75585af979aec3dcbdce68bc76306b ]
    
    rocket_ioctl_create_bo() inserts a GEM handle into the file's IDR via
    drm_gem_handle_create() early on, then performs several operations that
    can fail (sgt allocation, drm_mm insert, iommu_map). If any fail after
    the handle is live, the error path calls drm_gem_shmem_object_free()
    which kfree's the object without removing the handle from the IDR.
    
    This leaves a dangling handle pointing to freed slab memory. Any
    subsequent ioctl using that handle (PREP_BO, FINI_BO, SUBMIT) calls
    drm_gem_object_lookup() and dereferences freed memory (UAF).
    
    Fix by moving drm_gem_handle_create() to after all fallible operations
    succeed, matching the pattern used by panfrost, lima, and etnaviv.
    
    Also fix drm_mm_insert_node_generic() whose return value was silently
    overwritten by iommu_map_sgtable() on the next line. Add the missing
    error check.
    
    [tomeu: Move handle creation to the very end]
    
    Fixes: 658ebeac3351 ("accel/rocket: Add IOCTL for BO creation")
    Reported-by: Dhabaleshwar Das <dhabal123@gmail.com>
    Signed-off-by: Dhabaleshwar Das <dhabal123@gmail.com>
    Reviewed-by: Tomeu Vizoso <tomeu@tomeuvizoso.net>
    Link: https://patch.msgid.link/20260521165720.2113571-1-tomeu@tomeuvizoso.net
    Signed-off-by: Tomeu Vizoso <tomeu@tomeuvizoso.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ALSA: firewire-motu: Protect register DSP event queue positions [+ + +]
Author: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Date:   Thu May 21 08:01:23 2026 -0300

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

ALSA: hda/realtek: Fix speaker output on ASUS ROG Strix G615LP [+ + +]
Author: Zhang Heng <zhangheng@kylinos.cn>
Date:   Tue May 26 09:36:11 2026 +0800

    ALSA: hda/realtek: Fix speaker output on ASUS ROG Strix G615LP
    
    commit 20587302f8d700f26ee2c8a60ffb0a69ae0edf16 upstream.
    
    Add quirk for ALC294 codec on ASUS ROG Strix G615LP
    (SSID 1043:1214) using ALC287_FIXUP_TXNW2781_I2C_ASUS to
    fix speaker output.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=221173
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Zhang Heng <zhangheng@kylinos.cn>
    Link: https://patch.msgid.link/20260526013611.1954949-1-zhangheng@kylinos.cn
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Bluetooth: hci_conn: Fix memory leak in hci_le_big_terminate() [+ + +]
Author: Pavitra Jha <jhapavitra98@gmail.com>
Date:   Thu May 21 04:04:14 2026 -0400

    Bluetooth: hci_conn: Fix memory leak in hci_le_big_terminate()
    
    commit bfa9d28960ed677d556bdf097073bc3129686229 upstream.
    
    hci_le_big_terminate() allocates iso_list_data via kzalloc_obj but
    returns 0 without freeing it when neither pa_sync_term nor big_sync_term
    flags are set after evaluating the PA and BIG sync connection state.
    
    This early-return path was introduced when hci_le_big_terminate() was
    refactored to take struct hci_conn instead of raw u8 parameters, adding
    PA/BIG flag evaluation logic. The existing kfree() on hci_cmd_sync_queue
    failure does not cover this path.
    
    Fixes: a7bcffc673de ("Bluetooth: Add PA_LINK to distinguish BIG sync and PA sync connections")
    Cc: stable@vger.kernel.org
    Signed-off-by: Pavitra Jha <jhapavitra98@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_qca: Convert timeout from jiffies to ms [+ + +]
Author: Shuai Zhang <shuai.zhang@oss.qualcomm.com>
Date:   Fri May 29 15:23:50 2026 -0400

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

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

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

Bluetooth: hci_qca: Use 100 ms SSR delay for rampatch and NVM loading [+ + +]
Author: Shuai Zhang <shuai.zhang@oss.qualcomm.com>
Date:   Mon May 25 14:51:56 2026 +0800

    Bluetooth: hci_qca: Use 100 ms SSR delay for rampatch and NVM loading
    
    commit fa21e86caba2347e89eb65af926205a36a097c53 upstream.
    
    When bt_en is pulled high by hardware, the host does not re-download
    the firmware after SSR. The controller loads the rampatch and NVM
    internally.
    
    On HMT chip, the rampatch is ~264 KB and the NVM is ~9.4 KB. The
    loading process takes approximately 70 ms. The previous 50 ms delay is
    too short, causing the controller to not respond to the reset command
    sent by the host, which leads to BT initialization failure:
    
     Bluetooth: hci0: QCA memdump Done, received 458752, total 458752
     Bluetooth: hci0: mem_dump_status: 2
     Bluetooth: hci0: Opcode 0x0c03 failed: -110
    
    Increase the delay to 100 ms, which was confirmed as a safe value by
    the controller, to ensure the controller has finished loading the
    firmware before the host sends commands.
    
    Steps to reproduce:
    1. Trigger SSR and wait for SSR to complete:
       hcitool cmd 0x3f 0c 26
    2. Run "bluetoothctl power on" and observe that BT fails to start.
    
    Fixes: fce1a9244a0f ("Bluetooth: hci_qca: Fix SSR (SubSystem Restart) fail when BT_EN is pulled up by hw")
    Cc: stable@vger.kernel.org
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
    Signed-off-by: Shuai Zhang <shuai.zhang@oss.qualcomm.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

Bluetooth: hci_sync: Reset device counters in hci_dev_close_sync() [+ + +]
Author: Heitor Alves de Siqueira <halves@igalia.com>
Date:   Tue May 26 10:50:59 2026 -0300

    Bluetooth: hci_sync: Reset device counters in hci_dev_close_sync()
    
    [ Upstream commit cdf88b35e06f1b385f7f6228060ae541d44fbb72 ]
    
    Before resetting or closing the device, protocol counters should also be
    zeroed.
    
    Fixes: d0b137062b2d ("Bluetooth: hci_sync: Rework init stages")
    Signed-off-by: Heitor Alves de Siqueira <halves@igalia.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

 
bridge: Fix sleep in atomic context in netlink path [+ + +]
Author: Ido Schimmel <idosch@nvidia.com>
Date:   Tue May 26 09:48:16 2026 +0300

    bridge: Fix sleep in atomic context in netlink path
    
    [ Upstream commit 5eec4427b89c2fb2beac54920101e55a2f1c0c21 ]
    
    Since the introduction of the netlink configuration path for bridge
    ports in commit 25c71c75ac87 ("bridge: bridge port parameters over
    netlink"), br_setport() was always called with the bridge lock held
    around it. Back then this decision made sense: The bridge lock protects
    the STP state of the bridge and its ports and at that time the function
    only processed three STP related netlink attributes (cost, priority and
    state).
    
    Nowadays, br_setport() processes a lot more attributes and most of them
    do not need the bridge lock:
    
    * Bridge flags: Only require RTNL. Read locklessly by the data path.
      Annotations can be added in net-next.
    
    * FDB port flushing: Only requires the FDB lock.
    
    * Multicast attributes: Only require the multicast lock.
    
    * Group forward mask: Only requires RTNL. Read locklessly by the data
      path. Annotations can be added in net-next.
    
    * Backup port and NHID: Only require RTNL. Read locklessly by the data
      path.
    
    This is a problem as the bridge calls dev_set_promiscuity() when certain
    bridge port flags change and this function can sleep since the commit
    cited below, resulting in a splat such as [1].
    
    Fix this by reducing the scope of the bridge lock and only take it when
    processing the three STP related attributes that require it. This is
    consistent with the multicast attributes where each attribute acquires
    the multicast lock instead of having one critical section for all
    relevant attributes.
    
    [1]
    BUG: sleeping function called from invalid context at net/core/dev_addr_lists.c:1262
    in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 356, name: bridge
    preempt_count: 201, expected: 0
    RCU nest depth: 0, expected: 0
    2 locks held by bridge/356:
    #0: ffffffff919473a0 (rtnl_mutex){+.+.}-{4:4}, at: rtnetlink_rcv_msg (net/core/rtnetlink.c:80 net/core/rtnetlink.c:7002)
    #1: ffff888115072d58 (&br->lock){+...}-{3:3}, at: br_setlink (./include/linux/spinlock.h:348 net/bridge/br_netlink.c:1117)
    Preemption disabled at:
     0x0
    Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
    Call Trace:
    <TASK>
    dump_stack_lvl (lib/dump_stack.c:94 lib/dump_stack.c:120)
    __might_resched.cold (kernel/sched/core.c:9163)
    netif_rx_mode_run (net/core/dev_addr_lists.c:1262)
    netif_rx_mode_sync (net/core/dev_addr_lists.c:1428)
    dev_set_promiscuity (net/core/dev_api.c:289)
    br_manage_promisc (net/bridge/br_if.c:135 net/bridge/br_if.c:172)
    br_port_flags_change (net/bridge/br_if.c:242 net/bridge/br_if.c:747)
    br_setport (net/bridge/br_netlink.c:1000)
    br_setlink (net/bridge/br_netlink.c:1118)
    rtnl_bridge_setlink (net/core/rtnetlink.c:5572)
    rtnetlink_rcv_msg (net/core/rtnetlink.c:7005)
    netlink_rcv_skb (net/netlink/af_netlink.c:2550)
    netlink_unicast (net/netlink/af_netlink.c:1318 net/netlink/af_netlink.c:1344)
    netlink_sendmsg (net/netlink/af_netlink.c:1894)
    __sock_sendmsg (net/socket.c:787 (discriminator 4) net/socket.c:802 (discriminator 4))
    ____sys_sendmsg (net/socket.c:2698)
    ___sys_sendmsg (net/socket.c:2752)
    __sys_sendmsg (net/socket.c:2784)
    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)
    
    Fixes: 78cd408356fe ("net: add missing instance lock to dev_set_promiscuity")
    Reviewed-by: Nikolay Aleksandrov <nikolay@nvidia.com>
    Signed-off-by: Ido Schimmel <idosch@nvidia.com>
    Link: https://patch.msgid.link/20260526064818.272516-2-idosch@nvidia.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

bridge: Fix sleep in atomic context in sysfs path [+ + +]
Author: Ido Schimmel <idosch@nvidia.com>
Date:   Tue May 26 09:48:17 2026 +0300

    bridge: Fix sleep in atomic context in sysfs path
    
    [ Upstream commit 6d34594cc619d0d4b07d5afcad8b5984f3526dcf ]
    
    Since the start of the git history, brport_store() always acquired the
    bridge lock. Back then this decision made sense: The bridge lock
    protects the STP state of the bridge and its ports and at that time the
    function was only used by two STP related attributes (cost and
    priority).
    
    Nowadays, brport_store() processes a lot more attributes and most of
    them do not need the bridge lock:
    
    * Bridge flags: Only require RTNL. Read locklessly by the data path.
      Annotations can be added in net-next.
    
    * FDB port flushing: Only requires the FDB lock.
    
    * Multicast attributes: Only require the multicast lock.
    
    * Group forward mask: Only requires RTNL. Read locklessly by the data
      path. Annotations can be added in net-next.
    
    * Backup port: Only requires RTNL. Read locklessly by the data path.
    
    This is a problem as the bridge calls dev_set_promiscuity() when certain
    bridge port flags change and this function can sleep since the commit
    cited below, resulting in a splat such as [1].
    
    Fix this by reducing the scope of the bridge lock and only take it when
    processing the two STP related attributes that require it. Remove the
    now stale comment from br_switchdev_set_port_flag(). The
    SWITCHDEV_F_DEFER flag can be removed in net-next.
    
    [1]
    BUG: sleeping function called from invalid context at net/core/dev_addr_lists.c:1262
    in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 372, name: bash
    preempt_count: 201, expected: 0
    RCU nest depth: 0, expected: 0
    5 locks held by bash/372:
    #0: ffff88810c51c3f0 (sb_writers#7){.+.+}-{0:0}, at: ksys_write (fs/read_write.c:740)
    #1: ffff888115ce9480 (&of->mutex){+.+.}-{4:4}, at: kernfs_fop_write_iter (fs/kernfs/file.c:343)
    #2: ffff88810b9fd330 (kn->active#37){.+.+}-{0:0}, at: kernfs_fop_write_iter (fs/kernfs/file.c:80 fs/kernfs/file.c:344)
    #3: ffffffffa59473a0 (rtnl_mutex){+.+.}-{4:4}, at: brport_store (net/bridge/br_sysfs_if.c:326)
    #4: ffff8881099d2d58 (&br->lock){+...}-{3:3}, at: brport_store (./include/linux/spinlock.h:348 net/bridge/br_sysfs_if.c:345)
    Preemption disabled at:
     0x0
    Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
    Call Trace:
    <TASK>
    dump_stack_lvl (lib/dump_stack.c:94 lib/dump_stack.c:120)
    __might_resched.cold (kernel/sched/core.c:9163)
    netif_rx_mode_run (net/core/dev_addr_lists.c:1262)
    netif_rx_mode_sync (net/core/dev_addr_lists.c:1428)
    dev_set_promiscuity (net/core/dev_api.c:289)
    br_manage_promisc (net/bridge/br_if.c:135 net/bridge/br_if.c:172)
    br_port_flags_change (net/bridge/br_if.c:242 net/bridge/br_if.c:747)
    store_learning (net/bridge/br_sysfs_if.c:79 net/bridge/br_sysfs_if.c:235)
    brport_store (net/bridge/br_sysfs_if.c:346)
    kernfs_fop_write_iter (fs/kernfs/file.c:352)
    new_sync_write (fs/read_write.c:595)
    vfs_write (fs/read_write.c:688)
    ksys_write (fs/read_write.c:740)
    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)
    
    Fixes: 78cd408356fe ("net: add missing instance lock to dev_set_promiscuity")
    Reviewed-by: Nikolay Aleksandrov <nikolay@nvidia.com>
    Signed-off-by: Ido Schimmel <idosch@nvidia.com>
    Link: https://patch.msgid.link/20260526064818.272516-3-idosch@nvidia.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

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

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

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

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

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

 
cpufreq: intel_pstate: Add and use hybrid_get_cpu_type() [+ + +]
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Mon Jun 1 07:02:03 2026 -0400

    cpufreq: intel_pstate: Add and use hybrid_get_cpu_type()
    
    [ Upstream commit 528dde6619677ac6dc26d9dda1e3c9014b4a08c8 ]
    
    Introduce a function for identifying the type of a given CPU in a
    hybrid system, called hybrid_get_cpu_type(), and use if for hybrid
    scaling factor determination in hwp_get_cpu_scaling().
    
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Link: https://patch.msgid.link/1954386.tdWV9SEqCh@rafael.j.wysocki
    Stable-dep-of: 0e7c710478b3 ("cpufreq: intel_pstate: Use correct scaling factor on Raptor Lake-E")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

cpufreq: intel_pstate: Use correct scaling factor on Raptor Lake-E [+ + +]
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Mon Jun 1 07:02:04 2026 -0400

    cpufreq: intel_pstate: Use correct scaling factor on Raptor Lake-E
    
    [ Upstream commit 0e7c710478b3089cdfe8669347f77b163e836c4f ]
    
    Raptor Lake-E has the same processor ID as Raptor Lake-S, so there is
    an entry in intel_hybrid_scaling_factor[] for it.  It does not contain
    E-cores though and hybrid_get_cpu_type() returns 0 for its P-cores, so
    they get the default "core" scaling factor.  However, the original
    Raptor Lake scaling factor for P-cores still needs to be used for
    mapping the HWP performance levels of the P-cores in Raptor Lake-E to
    frequency, as though they were part of a real hybrid system.
    
    To address this, update hwp_get_cpu_scaling() to return
    hybrid_scaling_factor, which is the P-core scaling factor
    retrieved from intel_hybrid_scaling_factor[], for all CPUs
    that are not enumerated as E-cores.
    
    Fixes: 9b18d536b124 ("cpufreq: intel_pstate: Use CPPC to get scaling factors")
    Link: https://lore.kernel.org/all/20260511235328.2018458-1-srinivas.pandruvada@linux.intel.com/
    Reported-by: Henry Tseng <henrytseng@qnap.com>
    Closes: https://lore.kernel.org/linux-pm/20260508063032.3248602-1-henrytseng@qnap.com/
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Cc: All applicable <stable@vger.kernel.org>
    Link: https://patch.msgid.link/4523296.ejJDZkT8p0@rafael.j.wysocki
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

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

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

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

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

 
drm/amdgpu: check num_entries in GEM_OP GET_MAPPING_INFO [+ + +]
Author: Ziyi Guo <n7l8m4@u.northwestern.edu>
Date:   Sun Feb 8 00:02:55 2026 +0000

    drm/amdgpu: check num_entries in GEM_OP GET_MAPPING_INFO
    
    commit a1ba4594232c87c3b8defd6f89a2e40f8b08395d upstream.
    
    kvcalloc(args->num_entries, sizeof(*vm_entries), GFP_KERNEL) at
    amdgpu_gem.c:1050 uses the user-supplied num_entries directly without
    any upper bounds check. Since num_entries is a __u32 and
    sizeof(drm_amdgpu_gem_vm_entry) is 32 bytes, a large num_entries
    produces an allocation exceeding INT_MAX, triggering
    WARNING in __kvmalloc_node_noprof(), causing a kernel WARNING,
    TAINT_WARN, and panic on CONFIG_PANIC_ON_WARN=y systems.
    
    Add a size bounds check before we invoke the kvzalloc() to
    reject oversized num_entries early with -EINVAL.
    
    Fixes: 4d82724f7f2b ("drm/amdgpu: Add mapping info option for GEM_OP ioctl")
    Signed-off-by: Ziyi Guo <n7l8m4@u.northwestern.edu>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit 1fe7bf5457f6efd7be60b17e23163ba54341d73d)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amdgpu: fix calling VM invalidation in amdgpu_hmm_invalidate_gfx [+ + +]
Author: Christian König <christian.koenig@amd.com>
Date:   Wed Feb 18 12:31:29 2026 +0100

    drm/amdgpu: fix calling VM invalidation in amdgpu_hmm_invalidate_gfx
    
    commit 1c824497d8acd3187d585d6187cedc1897dcc871 upstream.
    
    Otherwise we don't invalidate page tables on next CS.
    
    Signed-off-by: Christian König <christian.koenig@amd.com>
    Reviewed-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
    Tested-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit b6444d1bcbc34f6f2a31a3aab3059be082f3683e)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

drm/amdgpu: fix lock leak on ENOMEM in AMDGPU_GEM_OP_GET_MAPPING_INFO [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
Date:   Sun May 17 09:17:42 2026 -0400

    drm/amdgpu: fix lock leak on ENOMEM in AMDGPU_GEM_OP_GET_MAPPING_INFO
    
    commit 2e7f55eb408c3f72ee1957a0d0ad11d8648a6379 upstream.
    
    The AMDGPU_GEM_OP_GET_MAPPING_INFO branch of amdgpu_gem_op_ioctl()
    holds three cleanup-tracked resources before calling kvcalloc():
    the drm_gem_object reference from drm_gem_object_lookup(), the
    drm_exec lock on the looked-up GEM via drm_exec_lock_obj(), and
    the drm_exec lock on the per-process VM root page directory via
    amdgpu_vm_lock_pd().  All three are released by the out_exec
    label that every other error path in this function jumps to.
    The kvcalloc() failure path returns -ENOMEM directly, skipping
    out_exec and leaking all three.
    
    The leaked per-process VM root PD dma_resv lock is the
    load-bearing leak: any subsequent operation on the same VM
    (further GEM ops, command-submission, eviction, TTM shrinker
    callbacks) blocks on the held lock.  DRM_IOCTL_AMDGPU_GEM_OP is
    DRM_AUTH | DRM_RENDER_ALLOW, so this is an unprivileged-local
    denial of service against the caller's GPU context, reachable
    by any process with /dev/dri/renderD* access.
    
    Route the failure through out_exec so drm_exec_fini() and
    drm_gem_object_put() run.
    
    Reproduced on stock 7.0.0-10, Ryzen 7 5700U / Radeon Vega
    (Lucienne): the failing ioctl returns -ENOMEM and a second
    GET_MAPPING_INFO on the same fd then blocks in
    drm_exec_lock_obj() on the leaked dma_resv.  SIGKILL on the
    caller does not reap the task; the fd-release path during
    process exit goes through amdgpu_gem_object_close() ->
    drm_exec_prepare_obj() on the same lock, leaving the task in D
    state until the box is rebooted.  The patched kernel was not
    rebuilt and re-tested on this hardware; the fix is mechanical.
    Tested on a single Lucienne / Vega box only.
    
    Ziyi Guo posted an independent INT_MAX-bound check for
    args->num_entries in the same branch [1]; the two patches are
    complementary and can land in either order.
    
    Fixes: 4d82724f7f2b ("drm/amdgpu: Add mapping info option for GEM_OP ioctl")
    Link: https://lore.kernel.org/all/20260208000255.4073363-1-n7l8m4@u.northwestern.edu/ # [1]
    Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
    Assisted-by: Claude:claude-opus-4-7
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit b69d3256d79de15f54c322986ff4da68f1d65b0a)
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

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

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

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

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

 
drm/gem: fix race between change_handle and handle_delete [+ + +]
Author: Zhenghang Xiao <kipreyyy@gmail.com>
Date:   Tue May 26 16:53:13 2026 +0800

    drm/gem: fix race between change_handle and handle_delete
    
    commit 7164d78559b0ff29931a366a840a9e5dd53d4b7c upstream.
    
    drm_gem_change_handle_ioctl leaves the old handle live in the IDR
    during the window between spin_unlock(table_lock) and the final
    spin_lock(table_lock). A concurrent drm_gem_handle_delete on the old
    handle succeeds in this window, decrements handle_count to 0, and frees
    the GEM object while the new handle's IDR entry still references it.
    
    NULL the old handle's IDR entry before dropping table_lock so that any
    concurrent GEM_CLOSE on the old handle sees NULL and returns -EINVAL.
    Restore the old entry on the prime-bookkeeping error path.
    
    Fixes: 5e28b7b94408 ("drm: Set old handle to NULL before prime swap in change_handle")
    Signed-off-by: Zhenghang Xiao <kipreyyy@gmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Link: https://patch.msgid.link/20260526085313.26791-1-kipreyyy@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

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

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

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

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

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

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

drm/i915/psr: Block DC states on vblank enable when Panel Replay supported [+ + +]
Author: Jouni Högander <jouni.hogander@intel.com>
Date:   Wed May 20 13:49:43 2026 +0300

    drm/i915/psr: Block DC states on vblank enable when Panel Replay supported
    
    commit 8bb9093df555f9e89fdbe1405118b11384c03e04 upstream.
    
    Currently we are blocking DC states only when Panel Replay is enabled on
    vblank enable. It may happen that Panel Replay is getting enabled when
    vblank is already enabled. Fix this by blocking DC states always if Panel
    Replay is supported.
    
    While at it take care of possible dual eDP case by looping all encoders
    supporting PSR.
    
    Fixes: 0c427ac78a1d ("drm/i915/psr: Add interface to notify PSR of vblank enable/disable")
    Cc: <stable@vger.kernel.org> # v6.16+
    Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
    Reviewed-by: Michał Grzelak <michal.grzelak@intel.com>
    Link: https://patch.msgid.link/20260520104944.239797-1-jouni.hogander@intel.com
    (cherry picked from commit eb5911f990554f7ce947dd53df00c114362e4465)
    Signed-off-by: Tvrtko Ursulin <tursulin@ursulin.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

drm/i915/psr: Use DC_OFF wake reference to block DC6 on vblank enable [+ + +]
Author: Jouni Högander <jouni.hogander@intel.com>
Date:   Fri Jun 5 22:18:39 2026 -0400

    drm/i915/psr: Use DC_OFF wake reference to block DC6 on vblank enable
    
    [ Upstream commit 3549a9649dc7c5fc586ab12f675279283cdcb2a7 ]
    
    We are observing following warnings:
    
    *ERROR* power well DC_off state mismatch (refcount 0/enabled 1)
    
    gen9_dc_off_power_well_enabled is considering target state DC_STATE_DISABLE
    as DC_OFF power well being enabled. Fix this by using wakeref for the
    purpose.
    
    To achieve this we need to modify notification code as well. Currently it
    is possible that PSR gets notified vblank enable/disable twice on same
    status. This is currently not a problem as it is just triggering call to
    intel_display_power_set_target_dc_state with same target state as a
    parameter. When using wakeref this becomes a problem due to reference
    counting. Fix this storing vbank status on last notification and use that
    to ensure there are no more than one notification with same vblank status.
    
    v2: ensure there is no subsequent notifications with same status
    
    Fixes: aa451abcffb5 ("drm/i915/display: Prevent DC6 while vblank is enabled for Panel Replay")
    Cc: <stable@vger.kernel.org> # v6.13+
    Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
    Reviewed-by: Michał Grzelak <michal.grzelak@intel.com>
    Link: https://patch.msgid.link/20260520104944.239797-2-jouni.hogander@intel.com
    (cherry picked from commit 35485ac56d878192a3829a58cb26503125ec7104)
    Signed-off-by: Tvrtko Ursulin <tursulin@ursulin.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

 
drm/xe: Restore IDLEDLY regiter on engine reset [+ + +]
Author: Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>
Date:   Fri May 22 22:05:32 2026 +0530

    drm/xe: Restore IDLEDLY regiter on engine reset
    
    [ Upstream commit f657a6a3ba4c20bc01f5be3752d53498ee1bfe35 ]
    
    Wa_16023105232 programs the register IDLEDLY. The register is reset
    whenever the engine is reset. Therefore it should be added to the GuC
    save-restore register list for it to be restored after reset.
    
    Fixes: 7c53ff050ba8 ("drm/xe: Apply Wa_16023105232")
    Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
    Link: https://patch.msgid.link/20260522163531.1365540-2-balasubramani.vivekanandan@intel.com
    Signed-off-by: Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>
    (cherry picked from commit df1cfe24743a93b71eab27687e148ab8ae9b69e3)
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

ethtool: module: avoid racy updates to dev->ethtool bitfield [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri May 22 16:13:06 2026 -0700

    ethtool: module: avoid racy updates to dev->ethtool bitfield
    
    [ Upstream commit 7a84b965ffc12030af63cd10a8f3a1123ff39b7a ]
    
    When reviewing other changes Gemini points out that we currently
    update module_fw_flash_in_progress without holding any locks.
    Since module_fw_flash_in_progress is part of a bitfield this
    is not great, updates to other fields may be lost.
    
    We could use a bool and sprinkle some READ_ONCE/WRITE_ONCE here
    but seems like the issue is rather than the work is an unusual
    writer. The other writers already hold the right locks. So just
    very briefly take these locks when the work completes.
    
    Note that nothing ever cancels the FW update work, so there's
    no concern with deadlocks vs cancel.
    
    Fixes: 32b4c8b53ee7 ("ethtool: Add ability to flash transceiver modules' firmware")
    Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
    Reviewed-by: Danielle Ratson <danieller@nvidia.com>
    Link: https://patch.msgid.link/20260522231312.1710836-4-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ethtool: module: call ethnl_ops_complete() on module flash errors [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri May 22 16:13:04 2026 -0700

    ethtool: module: call ethnl_ops_complete() on module flash errors
    
    [ Upstream commit 84371fb58423f997939aacdcbc02d128d76a54e5 ]
    
    When validate() fails we are skipping over ethnl_ops_complete()
    even tho we already called ethnl_ops_begin().
    
    Fixes: 32b4c8b53ee7 ("ethtool: Add ability to flash transceiver modules' firmware")
    Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
    Reviewed-by: Danielle Ratson <danieller@nvidia.com>
    Link: https://patch.msgid.link/20260522231312.1710836-2-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

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

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

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

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

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

ethtool: rss: add missing errno on RSS context delete [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri May 22 16:06:43 2026 -0700

    ethtool: rss: add missing errno on RSS context delete
    
    [ Upstream commit 3e6c6e9782ff8a8d8ded774b07ad4590cd61d04c ]
    
    Remember to set ret before jumping out if someone tries
    to delete a context on a device which doesn't support
    contexts.
    
    Fixes: fbe09277fa63 ("ethtool: rss: support removing contexts via Netlink")
    Link: https://patch.msgid.link/20260522230647.1705600-3-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ethtool: rss: avoid device context leak on reply-build failure [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri May 22 16:06:47 2026 -0700

    ethtool: rss: avoid device context leak on reply-build failure
    
    [ Upstream commit 32a9ecde62731c9f7412507709192c84dafc38d1 ]
    
    We wait with filling the reply for new RSS context creation
    until after the driver ->create_rxfh_context call. The driver
    needs to fill some of the defaults in the context. The failure
    of rss_fill_reply() is somewhat theoretical, but doesn't take
    much effort to handle it properly. Call ->remove_rxfh_context().
    
    If the driver's remove callback fails (some implementations like sfc
    can return real command errors from firmware RPCs) - skip the xa_erase
    and kfree, leaving the context in the xarray. This matches how
    ethnl_rss_delete_doit() behaves.
    
    Fixes: a166ab7816c5 ("ethtool: rss: support creating contexts via Netlink")
    Link: https://patch.msgid.link/20260522230647.1705600-7-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ethtool: rss: avoid modifying the RSS context response [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri May 22 16:06:42 2026 -0700

    ethtool: rss: avoid modifying the RSS context response
    
    [ Upstream commit c75b6f6eaacd0b74b832414cc3b9289c3686e941 ]
    
    Gemini says that we're modifying the RSS_CREATE response skb.
    I think it's right, the comment says that unicast() should
    unshare the skb but I'm not entirely sure what I meant there.
    netlink_trim() does a copy but only if skb is not well sized
    (it's at least 2x larger than necessary for the payload).
    
    Fixes: a166ab7816c5 ("ethtool: rss: support creating contexts via Netlink")
    Link: https://patch.msgid.link/20260522230647.1705600-2-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ethtool: rss: fix falsely ignoring indir table updates [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri May 22 16:06:44 2026 -0700

    ethtool: rss: fix falsely ignoring indir table updates
    
    [ Upstream commit 8d60141a32875248ef71d49c9920fa5e2aa40b29 ]
    
    rss_set_prep_indir() compares the new indirection table against the
    current one to determine whether any update is needed. The memcmp
    call passes data->indir_size as the length argument, but indir_size
    is the number of u32 entries, not the byte count.
    
    Fixes: c0ae03588bbb ("ethtool: rss: initial RSS_SET (indirection table handling)")
    Link: https://patch.msgid.link/20260522230647.1705600-4-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

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

ethtool: rss: fix indir_table and hkey leak on get_rxfh failure [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri May 22 16:06:45 2026 -0700

    ethtool: rss: fix indir_table and hkey leak on get_rxfh failure
    
    [ Upstream commit 266297692f97008ca48bc311775c087c59bd7fe3 ]
    
    rss_prepare_get() allocates the indirection table and hash key buffer
    via rss_get_data_alloc(), then calls ops->get_rxfh() to populate them.
    If get_rxfh() fails, the function returns an error without freeing
    the allocation.
    
    Fixes: 4f038a6a02d2 ("net: ethtool: Don't call .cleanup_data when prepare_data fails")
    Link: https://patch.msgid.link/20260522230647.1705600-5-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

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

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

    ethtool: tsconfig: fix missing ethnl_ops_complete()
    
    [ Upstream commit 6386bd772de64e6760306eb91c7e86163af6c22f ]
    
    tsconfig_prepare_data() calls ethnl_ops_begin(), we need to call
    ethnl_ops_complete() before returning the error.
    
    Fixes: 6e9e2eed4f39 ("net: ethtool: Add support for tsconfig command to get/set hwtstamp config")
    Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
    Reviewed-by: Kory Maincent <kory.maincent@bootlin.com>
    Link: https://patch.msgid.link/20260526153533.2779187-6-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ethtool: tsconfig: fix reply error handling [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Tue May 26 08:35:25 2026 -0700

    ethtool: tsconfig: fix reply error handling
    
    [ Upstream commit a888bbd43940cada72f7686337741ce86d1cf869 ]
    
    A couple of trivial bugs in error handling in tsconfig_send_reply().
    If we failed to allocate rskb we need to set the error.
    If we did allocate it but failed to send it - we need to remember
    to free it.
    
    Fixes: 6e9e2eed4f39 ("net: ethtool: Add support for tsconfig command to get/set hwtstamp config")
    Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
    Reviewed-by: Kory Maincent <kory.maincent@bootlin.com>
    Link: https://patch.msgid.link/20260526153533.2779187-3-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ethtool: tsinfo: don't pass ERR_PTR to genlmsg_cancel on prepare failure [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Tue May 26 08:35:30 2026 -0700

    ethtool: tsinfo: don't pass ERR_PTR to genlmsg_cancel on prepare failure
    
    [ Upstream commit c3fc9976f686f9a95baf87db9d387f218fd65394 ]
    
    The goto err label leads to:
    
            genlmsg_cancel(skb, ehdr);
            return ret;
    
    If ethnl_tsinfo_prepare_dump() failed, it has not started a genlmsg.
    There's nothing to cancel, and passing an error pointer to
    genlmsg_cancel() would cause a crash.
    
    Fixes: b9e3f7dc9ed9 ("net: ethtool: tsinfo: Enhance tsinfo to support several hwtstamp by net topology")
    Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
    Reviewed-by: Kory Maincent <kory.maincent@bootlin.com>
    Link: https://patch.msgid.link/20260526153533.2779187-8-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ethtool: tsinfo: fix uninitialized stats on the by-PHC path [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Tue May 26 08:35:29 2026 -0700

    ethtool: tsinfo: fix uninitialized stats on the by-PHC path
    
    [ Upstream commit 1de405699c62c3a9544bcdcfb9eff8a01cfc7582 ]
    
    tsinfo_prepare_data() has two code paths: a "by-PHC" path for
    user-specified hardware timestamping providers, and the old path.
    Commit 89e281ebff72 ("ethtool: init tsinfo stats if requested") added
    ethtool_stats_init() to mark stat slots as ETHTOOL_STAT_NOT_SET before
    the driver callback populates them, but placed the call inside the
    old-path block.
    
    When commit b9e3f7dc9ed9 ("net: ethtool: tsinfo: Enhance tsinfo to
    support several hwtstamp by net topology") added the by-PHC early
    return, it landed above the stats initialization. On that path
    the stats array retains the zero-fill from ethnl_init_reply_data()'s
    zalloc. This leads to the reply including a stats nest with four
    zero-valued attributes that should have been absent.
    
    Reject GET requests for stats with HWTSTAMP_PROVIDER or dump.
    
    Fixes: b9e3f7dc9ed9 ("net: ethtool: tsinfo: Enhance tsinfo to support several hwtstamp by net topology")
    Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
    Link: https://patch.msgid.link/20260526153533.2779187-7-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
gpio: adnp: fix flow control regression caused by scoped_guard() [+ + +]
Author: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Date:   Fri May 22 09:35:27 2026 +0200

    gpio: adnp: fix flow control regression caused by scoped_guard()
    
    [ Upstream commit a5c627d90809b793fc053849b3a00609db305776 ]
    
    scoped_guard() is implemented as a for loop. Using it to protect code
    using the continue statement changes the flow as we now only break out
    of the hidden loop inside scoped_guard(), not the original for loop. Use
    a regular code block instead.
    
    Fixes: c7fe19ed3973 ("gpio: adnp: use lock guards for the I2C lock")
    Reported-by: David Lechner <dlechner@baylibre.com>
    Closes: https://lore.kernel.org/all/cde2abb2-4cc8-4fc9-b34a-0c5d2b95779f@baylibre.com/
    Reviewed-by: Linus Walleij <linusw@kernel.org>
    Link: https://patch.msgid.link/20260522073527.9812-1-bartosz.golaszewski@oss.qualcomm.com
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

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

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

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

gpio: rockchip: teardown bugs and resource leaks [+ + +]
Author: Marco Scardovi <scardracs@disroot.org>
Date:   Tue May 26 19:02:46 2026 +0200

    gpio: rockchip: teardown bugs and resource leaks
    
    [ Upstream commit 9500077678230e36d22bf16d2b9539c13e59a801 ]
    
    Address several teardown issues and resource leaks in the driver's remove
    path and error handling:
    
    1. Debounce clock reference leak: The debounce clock (bank->db_clk) is
       obtained using of_clk_get() which increments the clock's reference
       count, but clk_put() is never called. Register a devm action to
       cleanly release it on unbind. Note that of_clk_get(..., 1) remains
       necessary over devm_clk_get() because the DT binding does not define
       clock-names, precluding name-based lookup.
    
    2. Unregistered chained IRQ handler: The chained IRQ handler is not
       disconnected in remove(). If a stray interrupt fires after the driver
       is removed, the kernel attempts to execute a stale handler, leading
       to a panic. Fix this by clearing the handler in remove().
    
    3. IRQ domain leak: The linear IRQ domain and its generic chips are
       allocated manually during probe but never removed. Remove the IRQ
       domain during driver teardown to free the associated generic chips
       and mappings.
    
    Fixes: 936ee2675eee ("gpio/rockchip: add driver for rockchip gpio")
    Assisted-by: Antigravity:gemini-3.5-flash
    Signed-off-by: Marco Scardovi <scardracs@disroot.org>
    Link: https://patch.msgid.link/20260526171050.12785-3-scardracs@disroot.org
    [Bartosz: don't emit an error message on devres allocation failure]
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

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

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

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

HID: remove duplicate hid_warn_ratelimited definition [+ + +]
Author: Liu Kai <lukace97@outlook.com>
Date:   Thu May 7 16:32:04 2026 +0800

    HID: remove duplicate hid_warn_ratelimited definition
    
    [ Upstream commit dd2147375a8fe7c5bc3f1f1b1d3a9567c26faefa ]
    
    The hid_warn_ratelimited macro is defined twice in include/linux/hid.h:
    - first one added by commit 4051ead99888 ("HID: rate-limit hid_warn to
      prevent log flooding")
    - second one added by commit 1d64624243af ("HID: core: Add
      printk_ratelimited variants to hid_warn() etc")).
    
    The second definition is correctly grouped with other ratelimited macros.
    Remove the duplicate definition.
    
    Fixes: 1d64624243af ("HID: core: Add printk_ratelimited variants to hid_warn() etc")
    Signed-off-by: Liu Kai <lukace97@outlook.com>
    [bentiss: edited commit message]
    Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

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

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

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

 
hwmon: (pmbus) Add support for guarded PMBus lock [+ + +]
Author: Guenter Roeck <linux@roeck-us.net>
Date:   Mon Jun 1 08:49:48 2026 -0400

    hwmon: (pmbus) Add support for guarded PMBus lock
    
    [ Upstream commit 1814f4d3ff358277a5b6957e7f133c2812dc80ec ]
    
    Add support for guard(pmbus_lock)() and scoped_guard(pmbus_lock)()
    to be able to simplify the PMBus code.
    
    Also introduce pmbus_lock() as pre-requisite for supporting
    guard().
    
    Reviewed-by: Sanman Pradhan <psanman@juniper.net>
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Stable-dep-of: 4e4af55aaca7 ("hwmon: (pmbus/adm1266) serialize sequencer_state debugfs read with pmbus_lock")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

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

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

 
i2c: davinci: fix division by zero on missing clock-frequency [+ + +]
Author: Chaitanya Sabnis <chaitanya.msabnis@gmail.com>
Date:   Tue May 26 15:52:40 2026 +0530

    i2c: davinci: fix division by zero on missing clock-frequency
    
    commit 030675aa54cf757769b3db65642433d626b3ed7c upstream.
    
    When the 'clock-frequency' property is missing from the device tree,
    the driver falls back to DAVINCI_I2C_DEFAULT_BUS_FREQ. However, this
    macro was defined in kHz (100), whereas the device tree property is
    expected in Hz.
    
    The probe function divided the fallback value by 1000, causing
    integer truncation that resulted in dev->bus_freq = 0. This triggered
    a deterministic division-by-zero kernel panic when calculating clock
    dividers later in the probe sequence.
    
    Fix this by redefining DAVINCI_I2C_DEFAULT_BUS_FREQ in Hz (100000)
    to match the expected device tree property unit, allowing the existing
    division logic to work correctly for both cases.
    
    Fixes: b04ce6385979 ("i2c: davinci: kill platform data")
    Reported-by: Sashiko <sashiko-bot@kernel.org>
    Closes: https://lore.kernel.org/all/20260514044726.57297C2BCB7@smtp.kernel.org/
    Signed-off-by: Chaitanya Sabnis <chaitanya.msabnis@gmail.com>
    Cc: <stable@vger.kernel.org> # v6.14+
    Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
    Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
    Link: https://lore.kernel.org/r/20260526102240.4949-1-chaitanya.msabnis@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
iio: adc: ad4695: Fix call ordering in offload buffer postenable [+ + +]
Author: Radu Sabau <radu.sabau@analog.com>
Date:   Wed Apr 8 13:32:13 2026 +0300

    iio: adc: ad4695: Fix call ordering in offload buffer postenable
    
    commit 1a772719318c11e146f6fbe621fffd230a6f456a upstream.
    
    ad4695_enter_advanced_sequencer_mode() was called after
    spi_offload_trigger_enable(). That is wrong because
    ad4695_enter_advanced_sequencer_mode() issues regular SPI transfers to
    put the ADC into advanced sequencer mode, and not all SPI offload capable
    controllers support regular SPI transfers while offloading is enabled.
    
    Fix this by calling ad4695_enter_advanced_sequencer_mode() before
    spi_offload_trigger_enable(), so the ADC is fully configured before the
    first CNV pulse can occur. This is consistent with the same constraint
    that already applies to the BUSY_GP_EN write above it.
    
    Update the error unwind labels accordingly: add err_exit_conversion_mode
    so that a failure of spi_offload_trigger_enable() correctly exits
    conversion mode before clearing BUSY_GP_EN.
    
    Fixes: f09f140e3ea8 ("iio: adc: ad4695: Add support for SPI offload")
    Reviewed-by: Nuno Sá <nuno.sa@analog.com>
    Reviewed-by: David Lechner <dlechner@baylibre.com>
    Signed-off-by: Radu Sabau <radu.sabau@analog.com>
    Cc: Stable@vger.kernel.org
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

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

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

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

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

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

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

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

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

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

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

iio: chemical: mhz19b: reject oversized serial replies [+ + +]
Author: Pengpeng Hou <pengpeng@iscas.ac.cn>
Date:   Thu Apr 2 13:40:15 2026 +0800

    iio: chemical: mhz19b: reject oversized serial replies
    
    commit 673478bc29cf72010faaf293c1c8c667393335a0 upstream.
    
    mhz19b_receive_buf() appends each serdev chunk into the fixed
    MHZ19B_CMD_SIZE receive buffer and advances buf_idx by len without
    checking that the chunk fits in the remaining space. A large callback
    can therefore overflow st->buf before the command path validates the
    reply.
    
    Reset the reply state before each command and reject oversized serial
    replies before copying them into the fixed buffer. When an oversized
    reply is detected, wake the waiter and report -EMSGSIZE instead of
    overwriting st->buf.
    
    Fixes: 4572a70b3681 ("iio: chemical: Add support for Winsen MHZ19B CO2 sensor")
    Cc: stable@vger.kernel.org
    Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
    Acked-by: Gyeyoung Baek <gye976@gmail.com>
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: chemical: scd30: fix division by zero in write_raw [+ + +]
Author: Antoniu Miclaus <antoniu.miclaus@analog.com>
Date:   Wed Apr 1 14:08:29 2026 +0300

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

iio: dac: ad3530r: Fix AD3531/AD3531R powerdown mode strings [+ + +]
Author: Kim Seer Paller <kimseer.paller@analog.com>
Date:   Tue May 5 12:34:32 2026 +0800

    iio: dac: ad3530r: Fix AD3531/AD3531R powerdown mode strings
    
    commit ebd250c2581ec46c64c73fdfa918c9a7f757505e upstream.
    
    The AD3531/AD3531R has different output operating modes from the
    AD3530/AD3530R. According to the AD3531/AD3531R datasheet, the
    powerdown modes are:
      01: 500 Ohm output impedance
      10: 3.85 kOhm output impedance
      11: 16 kOhm output impedance
    
    The driver currently uses the AD3530R modes (1k, 7.7k, 32k) for all
    variants, which is incorrect for AD3531/AD3531R.
    
    Add AD3531R-specific powerdown mode strings and assign them to the
    AD3531/AD3531R chip variants.
    
    Fixes: 93583174a3df ("iio: dac: ad3530r: Add driver for AD3530R and AD3531R")
    Signed-off-by: Kim Seer Paller <kimseer.paller@analog.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

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

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

iio: dac: ad5686: fix powerdown control on dual-channel devices [+ + +]
Author: Rodrigo Alencar <rodrigo.alencar@analog.com>
Date:   Tue May 5 13:35:05 2026 +0100

    iio: dac: ad5686: fix powerdown control on dual-channel devices
    
    commit 8aeaf25a85263a7a43357e16ad78ab969f6f8aeb upstream.
    
    Fix powerdown control by using a proper bit shift for the powerdown mask
    values. During initialization, powerdown bits are initialized so that
    unused bits are set to 1 and the correct bit shift is used. Dual-channel
    devices use one-hot encoding in the address and that reflects on the
    position of the powerdown bits, which are not channel-index based
    for that case. Quad-channel devices also use one-hot encoding for the
    channel address but the result of log2(address) coincides with the channel
    index value. Mask as 0x3U is used rather than 0x3, because shift can reach
    value of 30 (last channel of a 16-channel device), which would mess with
    the sign bit. The issue was introduced when first adding support for
    dual-channel devices, which overlooked powerdown control differences.
    
    Fixes: 7dc8faeab3e3 ("iio: dac: ad5686: add support for AD5338R")
    Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iio: dac: ad5686: fix ref bit initialization for single-channel parts [+ + +]
Author: Rodrigo Alencar <rodrigo.alencar@analog.com>
Date:   Fri May 1 10:14:54 2026 +0100

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

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

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

iio: Fix iio_multiply_value use in iio_read_channel_processed_scale [+ + +]
Author: Svyatoslav Ryhel <clamor95@gmail.com>
Date:   Thu Apr 16 14:14:42 2026 +0300

    iio: Fix iio_multiply_value use in iio_read_channel_processed_scale
    
    commit bb21ee31f5753a7972148798fd7dfb841dd33bdb upstream.
    
    The function iio_multiply_value returns IIO_VAL_INT (1) on success or a
    negative error number on failure, while iio_read_channel_processed_scale
    should return an error code or 0. This creates a situation where the
    expected result is treated as an error. Fix this by checking the
    iio_multiply_value result separately, instead of passing it as a return
    value.
    
    Fixes: 05f958d003c9 ("iio: Improve iio_read_channel_processed_scale() precision")
    Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
    Reviewed-by: Hans de Goede <johannes.goede@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: gyro: adis16260: fix division by zero in write_raw [+ + +]
Author: Antoniu Miclaus <antoniu.miclaus@analog.com>
Date:   Tue Mar 31 13:13:00 2026 +0300

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

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

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

iio: imu: adis16550: fix stack leak in trigger handler [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Thu Apr 9 15:40:49 2026 +0200

    iio: imu: adis16550: fix stack leak in trigger handler
    
    commit 474f8928d50b09f7dcf507049f08732640b88b49 upstream.
    
    adis16550_trigger_handler() declares the scan data array on the stack
    without initializing it.  The memcpy() at the bottom fills only the
    first 28 bytes (TEMP + 6 channels of GYRO/ACCEL data), and
    iio_push_to_buffers_with_timestamp() writes the s64 timestamp at the
    8-byte-aligned offset 32.  Bytes 28-31 remain uninitialized stack data
    which leaks to userspace on ever trigger.
    
    Fix this all by just zero-initializing the structure on the stack.
    
    Cc: Lars-Peter Clausen <lars@metafoo.de>
    Cc: Michael Hennerich <Michael.Hennerich@analog.com>
    Cc: Jonathan Cameron <jic23@kernel.org>
    Cc: David Lechner <dlechner@baylibre.com>
    Cc: "Nuno Sá" <nuno.sa@analog.com>
    Cc: Andy Shevchenko <andy@kernel.org>
    Fixes: e4570f4bb231 ("iio: imu: adis16550: align buffers for timestamp")
    Cc: stable <stable@kernel.org>
    Assisted-by: gregkh_clanker_t1000
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Reviewed-by: David Lechner <dlechner@baylibre.com>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

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

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

iio: light: veml6070: Fix resource leak in probe error path [+ + +]
Author: Felix Gu <ustc.gu@gmail.com>
Date:   Fri Mar 27 20:27:54 2026 +0800

    iio: light: veml6070: Fix resource leak in probe error path
    
    commit b66f922f6a4fa92840f662fbcfeb4f8a0f774bcc upstream.
    
    The driver calls i2c_new_dummy_device() to create a dummy device,
    then calls i2c_smbus_write_byte(). If i2c_smbus_write_byte() fails and
    returns, the cleanup via devm_add_action_or_reset() was never registered,
    so the dummy device leaks.
    
    Switch to devm_i2c_new_dummy_device() which registers cleanup atomically
    with device creation, eliminating the error-path window.
    
    Fixes: 7501bff87c3e ("iio: light: veml6070: add action for i2c_unregister_device")
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
    Signed-off-by: Felix Gu <ustc.gu@gmail.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

iio: pressure: bmp280: fix stack leak in bmp580 trigger handler [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Thu Apr 9 15:40:47 2026 +0200

    iio: pressure: bmp280: fix stack leak in bmp580 trigger handler
    
    commit 387c86b582e0782ab332e7bfcd4e6e3f93922961 upstream.
    
    bmp580_trigger_handler() declares its scan buffer on the stack without
    an initializer and then memcpy()s 3 bytes of 24-bit sensor data into
    each 4-byte __le32 field.  The high byte of comp_temp and comp_press is
    left uninitialized, and the channel storagebits is 32, so two bytes of
    stack are pushed to userspace per scan.
    
    This is a regression from when the buffer lived in the private data, the
    move to a stack-local struct dropped the implicit zeroing.
    bme280_trigger_handler() was fixed up to handle this bug, but this
    driver was not fixed because there was no padding hole, but rather a
    short-fill issue.
    
    Fix this all by just zero-initializing the structure on the stack.
    
    Cc: Jonathan Cameron <jic23@kernel.org>
    Cc: David Lechner <dlechner@baylibre.com>
    Cc: "Nuno Sá" <nuno.sa@analog.com>
    Cc: Andy Shevchenko <andy@kernel.org>
    Fixes: 872c8014e05e ("iio: pressure: bmp280: drop sensor_data array")
    Cc: stable <stable@kernel.org>
    Assisted-by: gregkh_clanker_t1000
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Reviewed-by: David Lechner <dlechner@baylibre.com>
    Signed-off-by: Jonathan Cameron <jic23@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

 
ksmbd: fix FSCTL permission bypass by adding a permission check for FSCTL_SET_SPARSE [+ + +]
Author: Sean Shen <grayhat@foxmail.com>
Date:   Tue May 26 22:07:16 2026 +0900

    ksmbd: fix FSCTL permission bypass by adding a permission check for FSCTL_SET_SPARSE
    
    [ Upstream commit cc57232cae23c0df91b4a59d0f519141ce9b5b02 ]
    
    FSCTL_SET_SPARSE in fsctl_set_sparse() modifies the file's sparse
    attribute and saves it through xattr without any permission checks.
    
    This exposes two issues:
    
    1) A client on a read-only share can change the sparse attribute
       on files it opened, even though the share is read-only.
       Other FSCTL write operations already check
       test_tree_conn_flag(work->tcon, KSMBD_TREE_CONN_FLAG_WRITABLE),
       but FSCTL_SET_SPARSE does not.
    
    2) Even on writable shares, clients without FILE_WRITE_DATA or
       FILE_WRITE_ATTRIBUTES access should not modify the sparse
       attribute. Similar handle-level checks exist in other functions
       but are missing here.
    
    Add both share-level writable check and per-handle access check.
    Use goto out on error to avoid leaking file references.
    
    Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
    Cc: Namjae Jeon <linkinjeon@kernel.org>
    Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
    Cc: Steve French <smfrench@gmail.com>
    Signed-off-by: Sean Shen <grayhat@foxmail.com>
    Acked-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

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

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

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

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

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

KVM: arm64: Reassign nested_mmus array behind mmu_lock [+ + +]
Author: Hyunwoo Kim <imv4bel@gmail.com>
Date:   Fri Jun 5 17:27:01 2026 +0900

    KVM: arm64: Reassign nested_mmus array behind mmu_lock
    
    commit 70543358fa08e0f7cebc3447c3b70fe97ad7aaa8 upstream.
    
    kvm->arch.nested_mmus[] is walked under kvm->mmu_lock, including from the
    MMU notifier path (kvm_unmap_gfn_range() -> kvm_nested_s2_unmap()), which
    can run at any time. kvm_vcpu_init_nested() reallocates the array and frees
    the old buffer while holding only kvm->arch.config_lock, so such a walker
    can reference the freed array.
    
    Allocate the new array outside of mmu_lock, as the allocation can sleep.
    Under the lock, copy the existing entries, fix up the back pointers and
    reassign the array. Free the old buffer after dropping the lock, as
    kvfree() can sleep as well.
    
    Fixes: 4f128f8e1aaac ("KVM: arm64: nv: Support multiple nested Stage-2 mmu structures")
    Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
    Reviewed-by: Oliver Upton <oupton@kernel.org>
    Link: https://patch.msgid.link/aiKIVVeIr1aAB1yp@v4bel
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Cc: stable@vger,kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

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

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

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

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

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

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

KVM: SEV: Ignore Port I/O requests of length '0' [+ + +]
Author: Sean Christopherson <seanjc@google.com>
Date:   Fri May 1 13:22:29 2026 -0700

    KVM: SEV: Ignore Port I/O requests of length '0'
    
    commit 3988bd2723de407ae90fa7a6f6029b4e60238c58 upstream.
    
    Explicitly ignore Port I/O requests of length '0' (or count '0'), so that
    setting up the software scratch area (and other code) doesn't have to
    worry about underflowing the length, and to allow for WARNing on trying
    to configure the scratch area with len==0.
    
    Fixes: 291bd20d5d88 ("KVM: SVM: Add initial support for a VMGEXIT VMEXIT")
    Cc: stable@vger.kernel.org
    Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Message-ID: <20260501202250.2115252-5-seanjc@google.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

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

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

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

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

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

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

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

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

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

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

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

    Linux 6.18.35
    
    Link: https://lore.kernel.org/r/20260607095727.528828913@linuxfoundation.org
    Tested-by: Miguel Ojeda <ojeda@kernel.org>
    Tested-by: Peter Schneider <pschneider1968@googlemail.com>
    Tested-by: Wentao Guan <guanwentao@uniontech.com>
    Tested-by: Ron Economos <re@w6rz.net>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

 
mailbox: Fix NULL message support in mbox_send_message() [+ + +]
Author: Jassi Brar <jassisinghbrar@gmail.com>
Date:   Fri Mar 27 17:00:40 2026 -0500

    mailbox: Fix NULL message support in mbox_send_message()
    
    commit c58e9456e30c7098cbcd9f04571992be8a2e4e63 upstream.
    
    The active_req field serves double duty as both the "is a TX in
    flight" flag (NULL means idle) and the storage for the in-flight
    message pointer. When a client sends NULL via mbox_send_message(),
    active_req is set to NULL, which the framework misinterprets as
    "no active request". This breaks the TX state machine by:
    
     - tx_tick() short-circuits on (!mssg), skipping the tx_done
       callback and the tx_complete completion
     - txdone_hrtimer() skips the channel entirely since active_req
       is NULL, so poll-based TX-done detection never fires.
    
    Fix this by introducing a MBOX_NO_MSG sentinel value that means
    "no active request," freeing NULL to be valid message data. The
    sentinel is defined in the subsystem-internal mailbox.h so that
    controller drivers within drivers/mailbox/ can reference it, but
    it is not exposed to clients outside the subsystem.
    
    Fifteen in-tree callers send NULL (doorbell-style IPCs on Qualcomm,
    Tegra, TI, Xilinx, i.MX, SCMI, and PCC platforms). All were
    audited for regression:
    
     - Most already work around the bug via knows_txdone=true with a
       manual mbox_client_txdone() call, making the framework's
       tracking irrelevant. These are unaffected.
    
     - Poll-based callers (Xilinx zynqmp/r5) are strictly better off:
       the poll timer now correctly detects NULL-active channels
       instead of silently skipping them.
    
     - irq-qcom-mpm.c was a pre-existing bug -- the only Qualcomm
       caller that omitted the knows_txdone + mbox_client_txdone()
       pattern. Fixed in a companion commit ("irqchip/qcom-mpm: Fix
       missing mailbox TX done acknowledgment").
    
     - No caller sets both a tx_done callback and sends NULL, nor
       combines tx_block=true with NULL sends, so the newly reachable
       callback/completion paths are never exercised.
    
    Also update tegra-hsp's flush callback, which directly inspects
    active_req to wait for the channel to drain: the old "!= NULL"
    check becomes "!= MBOX_NO_MSG", otherwise flush spins until
    timeout since the sentinel is non-NULL.
    
    The only tradeoff is that 'MBOX_NO_MSG' can not be used as a message
    by clients.
    
    Reported-by: Joonwon Kang <joonwonkang@google.com>
    Reviewed-by: Douglas Anderson <dianders@chromium.org>
    Signed-off-by: Jassi Brar <jassisinghbrar@gmail.com>
    Signed-off-by: Joonwon Kang <joonwonkang@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

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

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

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

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

 
memfd: deny writeable mappings when implying SEAL_WRITE [+ + +]
Author: Pratyush Yadav (Google) <pratyush@kernel.org>
Date:   Tue May 5 15:39:20 2026 +0200

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

 
misc: rp1: Send IACK on IRQ activate to fix kdump/kexec [+ + +]
Author: Xiaolei Wang <xiaolei.wang@windriver.com>
Date:   Mon May 18 15:34:05 2026 +0800

    misc: rp1: Send IACK on IRQ activate to fix kdump/kexec
    
    commit 36770417153644bc88281c7284730ef1d14d8d3c upstream.
    
    After a kexec/kdump reboot, the macb Ethernet controller fails to
    receive any packets, causing DHCP to hang indefinitely and the network
    interface to be unusable despite link being up.
    
    The root cause is that RP1's level-triggered MSI-X interrupt sources
    (such as macb on hwirq 6) may have their internal state machines stuck
    in the "waiting for IACK" state. This happens because the previous
    kernel crashed before sending the acknowledgment for a pending level
    interrupt.
    
    In this stuck state, RP1 will not generate new MSI-X writes even though
    the interrupt source remains asserted. Since no new MSI-X is sent, the
    GIC never sees a new edge, the chained IRQ handler is never invoked,
    and the interrupt is permanently lost.
    
    Fix this by sending MSIX_CFG_IACK in rp1_irq_activate(). This
    unconditionally resets the MSI-X state machine back to idle when a
    child device requests its interrupt. If the interrupt source is still
    asserted, RP1 will immediately issue a new MSI-X with the freshly
    configured msg_addr/msg_data, and normal interrupt delivery resumes.
    
    Writing IACK when the state machine is already idle (i.e., on a normal
    cold boot) is harmless — it has no effect.
    
    Fixes: 49d63971f963 ("misc: rp1: RaspberryPi RP1 misc driver")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
    Link: https://patch.msgid.link/20260518073405.2115003-1-xiaolei.wang@windriver.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm/damon/sysfs-schemes: delete tried region in regions_rmdirs() [+ + +]
Author: SeongJae Park <sj@kernel.org>
Date:   Mon May 18 08:25:58 2026 -0700

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

 
mm/rmap: initialize nr_pages to 1 at loop start in try_to_unmap_one [+ + +]
Author: Dev Jain <dev.jain@arm.com>
Date:   Mon May 18 12:06:56 2026 +0530

    mm/rmap: initialize nr_pages to 1 at loop start in try_to_unmap_one
    
    commit 3f8968e9cbf95d5d87d32218906cab0b9b9eddbe upstream.
    
    Initialize nr_pages to 1 at the start of each loop iteration, like
    folio_referenced_one() does.
    
    Without this, nr_pages computed by a previous folio_unmap_pte_batch() call
    can be reused on a later iteration that does not run
    folio_unmap_pte_batch() again.
    
    mmap a 64K large folio with MAP_ANONYMOUS | MAP_DROPPABLE, then call
    madvise(MADV_FREE), then make the last page device-exclusive via
    HMM_DMIRROR_EXCLUSIVE.
    
    Trigger node reclaim through sysfs.  Now, in try_to_unmap_one(), we will
    first clear the first 15 out of 16 entries mapping the lazyfree folio.
    This will set nr_pages to 15.  In the next pvmw walk, this nr_pages gets
    reused on a device-exclusive pte, thus potentially corrupting folio
    refcount/mapcount.
    
    At the moment, I have a userspace program which can make the kernel spit
    out a trace, but the blow up is in folio_referenced_one(), because there
    are existing bugs in the interaction between device-private and rmap
    (which too I am investigating).  I did a one liner kernel change to avoid
    going into folio_referenced_one(), and the kernel blows up at
    folio_remove_rmap_ptes in try_to_unmap_one which is what I wanted.
    
    Note that the bug is there not since file folio batching but lazyfree
    folio batching, since device-exclusive only works for anonymous folios.
    
    Userspace visible effect is simply kernel crashing somewhere due to
    refcount/mapcount corruption.
    
    Link: https://lore.kernel.org/20260518063656.3721056-1-dev.jain@arm.com
    Fixes: 354dffd29575 ("mm: support batched unmap for lazyfree large folios during reclamation")
    Signed-off-by: Dev Jain <dev.jain@arm.com>
    Acked-by: Barry Song <baohua@kernel.org>
    Acked-by: David Hildenbrand (Arm) <david@kernel.org>
    Reviewed-by: Lorenzo Stoakes <ljs@kernel.org>
    Cc: Anshuman Khandual <anshuman.khandual@arm.com>
    Cc: Barry Song <baohua@kernel.org>
    Cc: Dev Jain <dev.jain@arm.com>
    Cc: Harry Yoo <harry@kernel.org>
    Cc: Jann Horn <jannh@google.com>
    Cc: Liam R. Howlett <liam@infradead.org>
    Cc: Rik van Riel <riel@surriel.com>
    Cc: Ryan Roberts <ryan.roberts@arm.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/slub: hold cpus_read_lock around flush_rcu_sheaves_on_cache() [+ + +]
Author: Qing Wang <wangqing7171@gmail.com>
Date:   Mon Jun 1 07:05:09 2026 -0400

    mm/slub: hold cpus_read_lock around flush_rcu_sheaves_on_cache()
    
    [ Upstream commit 67ea9d353d0ba12bdbc9183ff568dead9e949b80 ]
    
    flush_rcu_sheaves_on_cache() calls queue_work_on() in a
    for_each_online_cpu() loop, which requires the cpu to stay online.
    But cpus_read_lock() is not held in kvfree_rcu_barrier_on_cache() and the
    set of "online cpus" is subject to change.
    
    There are two paths that call flush_rcu_sheaves_on_cache():
    
      // has cpus_read_lock()
      flush_all_rcu_sheaves()
        -> flush_rcu_sheaves_on_cache()
    
      // no cpus_read_lock()
      kvfree_rcu_barrier_on_cache()
        -> flush_rcu_sheaves_on_cache()
    
    Fix this by holding cpus_read_lock() in kvfree_rcu_barrier_on_cache().
    
    Why not move cpus_read_lock() from flush_all_rcu_sheaves() into
    flush_rcu_sheaves_on_cache()? The reason is it would introduce a new lock
    order (slab_mutex -> cpu_hotplug_lock). The reverse order
    (cpu_hotplug_lock -> slab_mutex) is established by
    
    - cpuhp_setup_state_nocalls(..., slub_cpu_setup, ...)
    - kmem_cache_destroy()
    
    The two orders together would form an AB-BA deadlock.
    
    Finally, add lockdep_assert_cpus_held() in flush_rcu_sheaves_on_cache()
    to catch the same problem in the future.
    
    Fixes: 0f35040de593 ("mm/slab: introduce kvfree_rcu_barrier_on_cache() for cache destruction")
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Qing Wang <wangqing7171@gmail.com>
    Link: https://patch.msgid.link/20260512035035.762317-1-wangqing7171@gmail.com
    Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
mm: memcontrol: propagate NMI slab stats to memcg vmstats [+ + +]
Author: Alexandre Ghiti <alex@ghiti.fr>
Date:   Mon May 18 10:28:19 2026 +0200

    mm: memcontrol: propagate NMI slab stats to memcg vmstats
    
    commit e16f17a9c5af50221184d1ef4be4056bf3c4209e upstream.
    
    flush_nmi_stats() drains per-node NMI slab atomics into the per-node
    lruvec_stats, but does not propagate them to the memcg-level vmstats.
    
    For non NMI case, account_slab_nmi_safe() calls mod_memcg_lruvec_state()
    which updates both per-node lruvec_stats and memcg-level vmstats, so
    flush_nmi_stats() needs to flush to per-node lruvec_stats as well as
    memcg-level vmstats.
    
    So fix this by flushing to the memcg-level vmstats for NMI too.
    
    Link: https://lore.kernel.org/20260518082830.599102-1-alex@ghiti.fr
    Fixes: 940b01fc8dc1 ("memcg: nmi safe memcg stats for specific archs")
    Signed-off-by: Alexandre Ghiti <alex@ghiti.fr>
    Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
    Acked-by: Johannes Weiner <hannes@cmpxchg.org>
    Reviewed-by: Harry Yoo (Oracle) <harry@kernel.org>
    Cc: Michal Hocko <mhocko@kernel.org>
    Cc: Muchun Song <muchun.song@linux.dev>
    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>

 
mptcp: borrow forward memory from subflow [+ + +]
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Sat May 30 07:48:09 2026 -0400

    mptcp: borrow forward memory from subflow
    
    [ Upstream commit 9db5b3cec4ec1c0cd3239689f5c8653d691a1754 ]
    
    In the MPTCP receive path, we release the subflow allocated fwd
    memory just to allocate it again shortly after for the msk.
    
    That could increases the failures chances, especially when we will
    add backlog processing, with other actions could consume the just
    released memory before the msk socket has a chance to do the
    rcv allocation.
    
    Replace the skb_orphan() call with an open-coded variant that
    explicitly borrows, the fwd memory from the subflow socket instead
    of releasing it.
    
    The borrowed memory does not have PAGE_SIZE granularity; rounding to
    the page size will make the fwd allocated memory higher than what is
    strictly required and could make the incoming subflow fwd mem
    consistently negative. Instead, keep track of the accumulated frag and
    borrow the full page at subflow close time.
    
    This allow removing the last drop in the TCP to MPTCP transition and
    the associated, now unused, MIB.
    
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Reviewed-by: Mat Martineau <martineau@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://patch.msgid.link/20251121-net-next-mptcp-memcg-backlog-imp-v1-12-1f34b6c1e0b1@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: 50c2d91c5dfa ("mptcp: do not drop partial packets")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

 
net/mlx5: HWS: Reject unsupported remove-header action [+ + +]
Author: Prathamesh Deshpande <prathameshdeshpande7@gmail.com>
Date:   Wed May 6 01:00:31 2026 +0100

    net/mlx5: HWS: Reject unsupported remove-header action
    
    [ Upstream commit 86f1d0f063e423a5c1982db1e5e7a8eac511e603 ]
    
    mlx5_cmd_hws_packet_reformat_alloc() handles
    MLX5_REFORMAT_TYPE_REMOVE_HDR by looking up a matching HWS remove-header
    action.
    
    If mlx5_fs_get_action_remove_header_vlan() returns NULL, the code only
    logs an error and continues. The function then returns success with a NULL
    HWS action stored in the packet-reformat object.
    
    Return an error when no matching remove-header action is available.
    
    Fixes: aecd9d1020e3 ("net/mlx5: fs, add HWS packet reformat API function")
    Signed-off-by: Prathamesh Deshpande <prathameshdeshpande7@gmail.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Reviewed-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
    Acked-by: Tariq Toukan <tariqt@nvidia.com>
    Link: https://patch.msgid.link/20260506000054.51797-1-prathameshdeshpande7@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

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

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

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

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

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

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

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

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

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

net: devmem: reject dma-buf bind with non-page-aligned size or SG length [+ + +]
Author: David Carlier <devnexen@gmail.com>
Date:   Fri May 29 19:22:54 2026 -0400

    net: devmem: reject dma-buf bind with non-page-aligned size or SG length
    
    [ Upstream commit 4eb82ba543421e9e38cc14e4e82058b78850df50 ]
    
    net_devmem_bind_dmabuf() trusts dmabuf->size and sg_dma_len() to be
    PAGE_SIZE multiples without checking:
    
      - tx_vec is sized dmabuf->size / PAGE_SIZE, and
        net_devmem_get_niov_at() only bounds-checks virt_addr < dmabuf->size
        before indexing tx_vec[virt_addr / PAGE_SIZE]. With size =
        N*PAGE_SIZE + r (1 <= r < PAGE_SIZE), sendmsg() at iov_base =
        N*PAGE_SIZE passes the bound check and reads tx_vec[N] -- one past.
    
      - owner->area.num_niovs = len / PAGE_SIZE while gen_pool_add_owner()
        covers the full byte len, so a non-page-multiple non-final sg
        desyncs num_niovs from the gen_pool region for every later sg, on
        both RX and TX.
    
    dma-buf does not require page-aligned sizes, so the bind path has to
    enforce what its own indexing assumes. Reject both with -EINVAL.
    
    The size check is TX-only (only tx_vec is sized off dmabuf->size); the
    SG-length check covers both directions.
    
    Fixes: bd61848900bf ("net: devmem: Implement TX path")
    Cc: stable@vger.kernel.org
    Signed-off-by: David Carlier <devnexen@gmail.com>
    Reviewed-by: Bobby Eshleman <bobbyeshleman@meta.com>
    Acked-by: Stanislav Fomichev <sdf@fomichev.me>
    Reviewed-by: Mina Almasry <almasrymina@google.com>
    Link: https://patch.msgid.link/20260519203530.66310-1-devnexen@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

net: hibmcge: disable Relaxed Ordering to fix RX packet corruption [+ + +]
Author: Jijie Shao <shaojijie@huawei.com>
Date:   Mon May 25 22:45:24 2026 +0800

    net: hibmcge: disable Relaxed Ordering to fix RX packet corruption
    
    [ Upstream commit 463a1271aa26eac992851b9d98cc75bc3cd4a1ed ]
    
    When SMMU is disabled, the hibmcge driver may receive corrupted packets.
    The hardware writes packet data and descriptors to the same page, but
    with Relaxed Ordering enabled, PCI write transactions may not be
    strictly ordered. This can cause the driver to observe a valid
    descriptor before the corresponding packet data is fully written.
    
    Fix this by clearing PCI_EXP_DEVCTL_RELAX_EN in the PCI bridge control
    register to ensure strict write ordering between packet data and
    descriptors.
    
    Fixes: f72e25594061 ("net: hibmcge: Implement rx_poll function to receive packets")
    Signed-off-by: Jijie Shao <shaojijie@huawei.com>
    Link: https://patch.msgid.link/20260525144525.94884-2-shaojijie@huawei.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

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

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

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

net: mana: Skip redundant detach on already-detached port [+ + +]
Author: Dipayaan Roy <dipayanroy@linux.microsoft.com>
Date:   Mon May 25 01:08:25 2026 -0700

    net: mana: Skip redundant detach on already-detached port
    
    [ Upstream commit 5b05aa36ee24297d7296ca58dfd8c448d0e4cda3 ]
    
    When mana_per_port_queue_reset_work_handler() runs after a previous
    detach succeeded but attach failed, the port is left in a detached
    state with apc->tx_qp and apc->rxqs already freed. Calling
    mana_detach() again unconditionally leads to NULL pointer dereferences
    during queue teardown.
    
    Add an early exit in mana_detach() when the port is already in
    detached state (!netif_device_present) for non-close callers, making
    it safe to call idempotently. This allows the queue reset handler and
    other recovery paths to simply retry mana_attach() without redundant
    teardown.
    
    Fixes: 3b194343c250 ("net: mana: Implement ndo_tx_timeout and serialize queue resets per port.")
    Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
    Signed-off-by: Dipayaan Roy <dipayanroy@linux.microsoft.com>
    Link: https://patch.msgid.link/20260525081129.1230035-3-dipayanroy@linux.microsoft.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

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

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

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

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

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

net: phy: micrel: fix LAN8814 QSGMII soft reset [+ + +]
Author: Robert Marko <robert.marko@sartura.hr>
Date:   Tue Apr 28 15:41:01 2026 +0200

    net: phy: micrel: fix LAN8814 QSGMII soft reset
    
    [ Upstream commit e027c218c482c6a0ae1948129ccda3b0a2033368 ]
    
    LAN8814 QSGMII soft reset was moved into the probe function to avoid
    triggering it for each of 4 PHY-s in the package.
    
    However, that broke QSGMII link between the MAC and PHY on most LAN8814
    PHY-s, specificaly for us on the Microchip LAN969x switch.
    Reading the QSGMII status registers it was visible that lanes were only
    partially synced.
    
    It looks like the reset timing is crucial, so lets move the reset back
    into the .config_init function but guard it with phy_package_init_once()
    to avoid it being triggered on each of 4 PHY-s in the package.
    Change the probe function to use phy_package_probe_once() for coma and PtP
    setup.
    
    Fixes: 96a9178a29a6 ("net: phy: micrel: lan8814 fix reset of the QSGMII interface")
    Signed-off-by: Robert Marko <robert.marko@sartura.hr>
    Link: https://patch.msgid.link/20260428134138.1741253-1-robert.marko@sartura.hr
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

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

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

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

net: team: fix NULL pointer dereference in team_xmit during mode change [+ + +]
Author: Weiming Shi <bestswngs@gmail.com>
Date:   Thu May 21 01:12:01 2026 -0700

    net: team: fix NULL pointer dereference in team_xmit during mode change
    
    [ Upstream commit 25fe708bbc59289d3d1ea4b126fbc1b460a072a5 ]
    
    __team_change_mode() clears team->ops with memset() before restoring
    safe dummy handlers via team_adjust_ops(). A concurrent team_xmit()
    running under RCU on another CPU can read team->ops.transmit during
    this window and call a NULL function pointer, crashing the kernel.
    
    The race requires a mode change (CAP_NET_ADMIN) concurrent with
    transmit on the team device.
    
     BUG: kernel NULL pointer dereference, address: 0000000000000000
     Oops: 0010 [#1] SMP KASAN NOPTI
     RIP: 0010:0x0
     Call Trace:
      team_xmit (drivers/net/team/team_core.c:1853)
      dev_hard_start_xmit (net/core/dev.c:3904)
      __dev_queue_xmit (net/core/dev.c:4871)
      packet_sendmsg (net/packet/af_packet.c:3109)
      __sys_sendto (net/socket.c:2265)
    
    The original code assumed that no ports means no traffic, so mode
    changes could freely memset()/memcpy() the ops.  AF_PACKET with
    forced carrier breaks that assumption.
    
    Prevent the race instead of making it safe: replace memset()/memcpy()
    with per-field updates that never touch transmit or receive.  Those
    two handlers are managed solely by team_adjust_ops(), which already
    installs dummies when tx_en_port_count == 0 (always true during mode
    change since no ports are present).  WRITE_ONCE/READ_ONCE prevent
    store/load tearing on the handler pointers.
    
    synchronize_net() before exit_op() drains in-flight readers that may
    still reference old mode state from before port removal switched the
    handlers to dummies.
    
    Fixes: 3d249d4ca7d0 ("net: introduce ethernet teaming device")
    Reported-by: Xiang Mei <xmei5@asu.edu>
    Signed-off-by: Weiming Shi <bestswngs@gmail.com>
    Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
    Link: https://patch.msgid.link/20260521081159.1491563-3-bestswngs@gmail.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: team: Remove unused team_mode_op, port_enabled [+ + +]
Author: Marc Harvey <marcharvey@google.com>
Date:   Thu Apr 9 02:59:24 2026 +0000

    net: team: Remove unused team_mode_op, port_enabled
    
    [ Upstream commit 014f249121d73909528df320818fba7693d0ec92 ]
    
    This team_mode_op wasn't used by any of the team modes, so remove it.
    
    Reviewed-by: Jiri Pirko <jiri@nvidia.com>
    Signed-off-by: Marc Harvey <marcharvey@google.com>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
    Link: https://patch.msgid.link/20260409-teaming-driver-internal-v7-2-f47e7589685d@google.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Stable-dep-of: 25fe708bbc59 ("net: team: fix NULL pointer dereference in team_xmit during mode change")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

net: team: Rename port_disabled team mode op to port_tx_disabled [+ + +]
Author: Marc Harvey <marcharvey@google.com>
Date:   Thu Apr 9 02:59:25 2026 +0000

    net: team: Rename port_disabled team mode op to port_tx_disabled
    
    [ Upstream commit cfa477df2cc62ba53cb936669886361152b594a7 ]
    
    This team mode op is only used by the load balance mode, and it only
    uses it in the tx path.
    
    Reviewed-by: Jiri Pirko <jiri@nvidia.com>
    Signed-off-by: Marc Harvey <marcharvey@google.com>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
    Link: https://patch.msgid.link/20260409-teaming-driver-internal-v7-3-f47e7589685d@google.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Stable-dep-of: 25fe708bbc59 ("net: team: fix NULL pointer dereference in team_xmit during mode change")
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

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

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

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

netfilter: nf_tables: fix dst corruption in same register operation [+ + +]
Author: Fernando Fernandez Mancera <fmancera@suse.de>
Date:   Mon May 11 16:37:56 2026 +0200

    netfilter: nf_tables: fix dst corruption in same register operation
    
    [ Upstream commit 18014147d3ee7831dce53fe65d7fc8d428b02552 ]
    
    For lshift and rshift, the shift operations are performed in a loop over
    32-bit words. The loop calculates the shifted value and write it to dst,
    and then immediately reads from src to calculate the carry for the next
    iteration. Because src and dst could point to the same memory location,
    the carry is incorrectly calculated using the newly modified dst value
    instead of the original src value.
    
    Adding a temporary local variable to cache the original value before
    writing to dst and using it for the carry calculation solves the
    problem. In addition, partial overlap is rejected from control plane for
    all kind of operations including byteorder. This was tested with the
    following bytecode:
    
    table test_table ip flags 0 use 1 handle 1
    ip test_table test_chain use 3 type filter hook input prio 0 policy accept packets 0 bytes 0 flags 1
    ip test_table test_chain 2
      [ immediate reg 1 0x44332211 0x88776655 ]
      [ bitwise reg 1 = ( reg 1 << 0x08000000 ) ]
      [ cmp eq reg 1 0x66443322 0x00887766 ]
      [ counter pkts 0 bytes 0 ]
    ip test_table test_chain 4 3
      [ immediate reg 1 0x44332211 0x88776655 ]
      [ bitwise reg 1 = ( reg 1 << 0x08000000 ) ]
      [ cmp eq reg 1 0x55443322 0x00887766 ]
      [ counter pkts 21794 bytes 1917798 ]
    
    Fixes: 567d746b55bc ("netfilter: bitwise: add support for shifts.")
    Acked-by: Jeremy Sowden <jeremy@azazel.net>
    Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

platform/x86/intel/vsec: Make driver_data info const [+ + +]
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Fri May 29 12:59:25 2026 -0400

    platform/x86/intel/vsec: Make driver_data info const
    
    [ Upstream commit 9577c74c96f88d807d1ba005adbf5952e7127e55 ]
    
    Treat PCI id->driver_data (intel_vsec_platform_info) as read-only by making
    vsec_priv->info a const pointer and updating all function signatures to
    accept const intel_vsec_platform_info *.
    
    This improves const-correctness and clarifies that the platform info data
    from the driver_data table is not meant to be modified at runtime.
    
    No functional changes intended.
    
    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
    Link: https://patch.msgid.link/20260313015202.3660072-3-david.e.box@linux.intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Stable-dep-of: 348ccc754d89 ("platform/x86/intel/vsec: Fix enable_cnt imbalance on PCIe error recovery")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

platform/x86/intel/vsec: Refactor base_addr handling [+ + +]
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Fri May 29 12:59:24 2026 -0400

    platform/x86/intel/vsec: Refactor base_addr handling
    
    [ Upstream commit 904b333fc51cc045941df9656302449a0fc9978e ]
    
    The base_addr field in intel_vsec_platform_info was originally added to
    support devices that emulate PCI VSEC capabilities in MMIO. Previously,
    the code would check at registration time whether base_addr was set,
    falling back to the PCI BAR if not.
    
    Refactor this by making base_addr an explicit function parameter. This
    clarifies ownership of the value and removes conditional logic from
    intel_vsec_add_dev(). It also enables making intel_vsec_platform_info
    const in a later patch, since the function no longer needs to write to
    info->base_addr.
    
    No functional change intended.
    
    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
    Link: https://patch.msgid.link/20260313015202.3660072-2-david.e.box@linux.intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Stable-dep-of: 348ccc754d89 ("platform/x86/intel/vsec: Fix enable_cnt imbalance on PCIe error recovery")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Revert "x86/fpu: Refine and simplify the magic number check during signal return" [+ + +]
Author: Andrei Vagin <avagin@google.com>
Date:   Tue May 26 20:50:43 2026 +0000

    Revert "x86/fpu: Refine and simplify the magic number check during signal return"
    
    [ Upstream commit 44eeff9bc467bc7d1fec34fc3f6001f385fe462c ]
    
    This reverts
    
      dc8aa31a7ac2 ("x86/fpu: Refine and simplify the magic number check during signal return").
    
    The aforementioned commit broke applications that construct signal frames in
    userspace (such as CRIU and gVisor) if the frame's xstate size is smaller than
    the kernel's fpstate->user_size.
    
    Furthermore, this introduces a critical issue for checkpoint/restore tools
    like CRIU. If a process is checkpointed while inside a signal handler, its
    stack contains a signal frame formatted according to the source host's xstate
    capabilities.
    
    If that process is later restored on a destination host with larger xstate
    capabilities (e.g., a newer CPU with more features enabled, resulting in
    a larger fpstate->user_size), the kernel will look for FP_XSTATE_MAGIC2 at the
    destination host's larger user_size offset instead of the offset encoded in
    the frame's fx_sw->xstate_size.
    
    This causes the magic2 check to fail, forcing sigreturn to silently fall back
    to "FX-only" mode. Upon return from the signal handler, the process's extended
    state is reset to initial values instead of being restored, leading to silent
    data corruption.
    
    The aforementioned commit cited
    
      d877550eaf2d ("x86/fpu: Stop relying on userspace for info to fault in xsave buffer")
    
    as justification to stop relying on userspace for the magic number check.
    
    However, these two changes are fundamentally different. The last one only
    changed how much memory the kernel ensures is paged-in before running XRSTOR
    to prevent an infinite loop. It did not change the signal frame format or how
    the layout is validated.
    
    Reverting this change restores the use of fx_sw->xstate_size for
    locating magic2 and restores the necessary sanity checks, ensuring that
    the signal frame remains self-describing and portable.
    
      [ bp: Massage commit message. ]
    
    Fixes: dc8aa31a7ac2 ("x86/fpu: Refine and simplify the magic number check during signal return")
    Signed-off-by: Andrei Vagin <avagin@google.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Acked-by: Chang S. Bae <chang.seok.bae@intel.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/all/20260429000623.3356606-1-avagin@google.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
rust_binder: avoid calling pending_oneway_finished() on TF_UPDATE_TXN [+ + +]
Author: Alice Ryhl <aliceryhl@google.com>
Date:   Tue Apr 14 12:02:34 2026 +0000

    rust_binder: avoid calling pending_oneway_finished() on TF_UPDATE_TXN
    
    commit 4c19719eb8b8df08c5bec7c499f73ddaea6f09fc upstream.
    
    When an outdated transaction is removed from `oneway_todo` due to
    `TF_UPDATE_TXN`, its `Allocation` is dropped. The current implementation
    of `Allocation::drop` calls `pending_oneway_finished()`, assuming the
    transaction was executed. This leads to premature execution of the next
    queued one-way transaction.
    
    Fix this by taking the `oneway_node` from the `Allocation` of the
    outdated transaction before it is dropped. This prevents
    `Allocation::drop` from signaling completion.
    
    We do not call `take_oneway_node()` from `Transaction::cancel` because
    it's actually correct to call `pending_oneway_finished()` on cancel if
    the transaction did not come from `oneway_todo`. This ensures that if
    `BINDER_THREAD_EXIT` is invoked and cancels a oneway transaction, then
    the next transaction is taken from `oneway_todo`.
    
    This bug does not lead to any issues in the kernel, but may lead to
    Binder delivering transactions to userspace earlier than userspace
    expected to receive them.
    
    Cc: stable <stable@kernel.org>
    Fixes: eafedbc7c050 ("rust_binder: add Rust Binder driver")
    Assisted-by: Antigravity:gemini
    Signed-off-by: Alice Ryhl <aliceryhl@google.com>
    Acked-by: Carlos Llamas <cmllamas@google.com>
    Link: https://patch.msgid.link/20260414-tf-update-txn-fix-v1-1-d2b83303acc9@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

rust_binder: Avoid holding lock when dropping delivered_death [+ + +]
Author: Matthew Maurer <mmaurer@google.com>
Date:   Fri Apr 3 18:18:58 2026 +0000

    rust_binder: Avoid holding lock when dropping delivered_death
    
    commit f6d8fea9e3953151a4adb4f603503dc3dc9c69da upstream.
    
    In 6c37bebd8c926, we switched to looping over the list and dropping each
    individual node, ostensibly without the lock held in the loop body.
    
    If the kernel were using Rust Edition 2024, the comment would be
    accurate, and the lock would not be held across the drop. However, the
    kernel is currently using 2021, so tail expression lifetime extension
    results in the lock being held across the drop. Explicitly binding the
    expression result to a variable makes the lockguard no longer part of a
    tail expression, causing the lock to be dropped before entering the loop
    body.
    
    This was detected via `CONFIG_PROVE_LOCKING` identifying an invalid wait
    context at the drop site.
    
    Reported-by: David Stevens <stevensd@google.com>
    Signed-off-by: Matthew Maurer <mmaurer@google.com>
    Cc: stable <stable@kernel.org>
    Fixes: 6c37bebd8c92 ("rust_binder: avoid mem::take on delivered_deaths")
    Reviewed-by: Alice Ryhl <aliceryhl@google.com>
    Acked-by: Carlos Llamas <cmllamas@google.com>
    Link: https://patch.msgid.link/20260403-lockhold-v1-1-c332b56cd8ae@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

scsi: target: iscsi: Fix CRC overread and double-free in iscsit_handle_text_cmd() [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
Date:   Sat Apr 18 11:49:27 2026 -0400

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

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

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

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

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

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

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

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

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

 
serial: 8250: dispatch SysRq character in serial8250_handle_irq() [+ + +]
Author: Jacques Nilo <jnilo@free.fr>
Date:   Wed May 13 15:30:24 2026 +0200

    serial: 8250: dispatch SysRq character in serial8250_handle_irq()
    
    commit 71f42b2149a1307a97165b409493665579462ea0 upstream.
    
    serial8250_handle_irq() captures a SysRq character into port->sysrq_ch
    inside serial8250_handle_irq_locked() via uart_prepare_sysrq_char()
    (reached from serial8250_read_char()). Dispatch of that captured
    character to handle_sysrq() is expected to happen at port-unlock time,
    through uart_unlock_and_check_sysrq[_irqrestore]().
    
    After commit 8324a54f604d ("serial: 8250: Add
    serial8250_handle_irq_locked()") the function was reduced to a wrapper
    that takes the port lock via guard(uart_port_lock_irqsave) whose
    destructor is plain uart_port_unlock_irqrestore(). The sysrq-aware
    unlock helper is no longer called, so port->sysrq_ch is captured but
    never dispatched: BREAK + SysRq key is consumed silently.
    
    This was the very condition Johan Hovold's 853a9ae29e978 ("serial:
    8250: fix handle_irq locking", 2021) introduced
    uart_unlock_and_check_sysrq_irqrestore() to address.
    
    Switch to the new guard(uart_port_lock_check_sysrq_irqsave), whose
    destructor is the sysrq-aware unlock helper, restoring the pre-split
    behaviour. Update the Context: comment on serial8250_handle_irq_locked()
    so future HW-specific 8250 wrappers know to use the same guard or the
    explicit sysrq-aware unlock.
    
    Verified on RTL8196E with CONFIG_MAGIC_SYSRQ_SERIAL=y: BREAK + 'h' on
    the console UART produces the SysRq help dump in dmesg and the brk
    counter in /proc/tty/driver/serial increments correctly.
    
    Fixes: 8324a54f604d ("serial: 8250: Add serial8250_handle_irq_locked()")
    Cc: stable@vger.kernel.org
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Jacques Nilo <jnilo@free.fr>
    Link: https://patch.msgid.link/52692ae6c3501f7940347cef364ad7fcacaab7e5.1778675349.git.jnilo@free.fr
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

serial: 8250_dw: dispatch SysRq character in dw8250_handle_irq() [+ + +]
Author: Jacques Nilo <jnilo@free.fr>
Date:   Wed May 13 15:30:25 2026 +0200

    serial: 8250_dw: dispatch SysRq character in dw8250_handle_irq()
    
    commit 2e211723953f7740e54b53f3d3a0d5e351a5e223 upstream.
    
    dw8250_handle_irq() calls serial8250_handle_irq_locked() with the port
    lock held via guard(uart_port_lock_irqsave). The guard destructor is
    plain uart_port_unlock_irqrestore(), so a SysRq character captured into
    port->sysrq_ch by uart_prepare_sysrq_char() is dropped without ever
    being dispatched to handle_sysrq().
    
    This is the same regression pattern as in serial8250_handle_irq(),
    introduced when 883c5a2bc934 ("serial: 8250_dw: Rework
    dw8250_handle_irq() locking and IIR handling") moved the function to
    the guard()-based locking scheme without using the sysrq-aware unlock
    helper.
    
    Switch to guard(uart_port_lock_check_sysrq_irqsave) so that captured
    sysrq_ch is dispatched on scope exit, matching the fix in
    serial8250_handle_irq().
    
    Fixes: 883c5a2bc934 ("serial: 8250_dw: Rework dw8250_handle_irq() locking and IIR handling")
    Cc: stable@vger.kernel.org
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Jacques Nilo <jnilo@free.fr>
    Link: https://patch.msgid.link/ed56fcaf4af24e4ed011a7bce206e0182acb761c.1778675349.git.jnilo@free.fr
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

serial: core: introduce guard(uart_port_lock_check_sysrq_irqsave) [+ + +]
Author: Jacques Nilo <jnilo@free.fr>
Date:   Wed May 13 15:30:23 2026 +0200

    serial: core: introduce guard(uart_port_lock_check_sysrq_irqsave)
    
    commit c3cce2e67bb22a223f5b8ef05db0fcde70994068 upstream.
    
    uart_handle_break() and uart_prepare_sysrq_char() (in
    include/linux/serial_core.h) capture a SysRq character into
    port->sysrq_ch while the port lock is held and rely on the unlock
    helper -- uart_unlock_and_check_sysrq_irqrestore() -- to dispatch the
    captured character to handle_sysrq() on scope exit.
    
    The existing guard(uart_port_lock_irqsave) cannot be used by IRQ
    handlers that process RX, because its destructor calls plain
    uart_port_unlock_irqrestore() and silently drops port->sysrq_ch.
    
    Add a dedicated guard(uart_port_lock_check_sysrq_irqsave) variant
    whose destructor is the sysrq-aware unlock helper. The lock side is
    identical to uart_port_lock_irqsave -- only the unlock-time behaviour
    differs. Callers that may capture SysRq characters must use
    guard(uart_port_lock_check_sysrq_irqsave); the existing
    guard(uart_port_lock_irqsave) keeps its current plain-unlock semantics
    for the many callers that do not process RX.
    
    The new macro is placed after the CONFIG_MAGIC_SYSRQ_SERIAL block so
    both definitions of uart_unlock_and_check_sysrq_irqrestore() (sysrq
    enabled and disabled) are visible at expansion time. When
    CONFIG_MAGIC_SYSRQ_SERIAL=n the destructor degenerates to plain
    uart_port_unlock_irqrestore(), so there is no overhead.
    
    No functional change on its own; users are converted in the following
    patches.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Jacques Nilo <jnilo@free.fr>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://patch.msgid.link/3849af4bc55d5d2a424fa850844e94d641b2f8a6.1778675349.git.jnilo@free.fr
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

 
smb: client: fix uninitialized variable in smb2_writev_callback [+ + +]
Author: Steve French <stfrench@microsoft.com>
Date:   Fri May 22 18:28:49 2026 -0500

    smb: client: fix uninitialized variable in smb2_writev_callback
    
    commit 9d2491197a00acf8c423512078458c2855102b66 upstream.
    
    compiling with W=2 pointed out that "written may be used uninitialized"
    
    Fixes: 20d72b00ca81 ("netfs: Fix the request's work item to not require a ref")
    Cc: stable@vger.kernel.org
    Reviewed-by: David Howells <dhowells@redhat.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

smb: client: validate the whole DACL before rewriting it in cifsacl [+ + +]
Author: Michael Bommarito <michael.bommarito@gmail.com>
Date:   Sun Apr 19 20:11:31 2026 -0400

    smb: client: validate the whole DACL before rewriting it in cifsacl
    
    [ Upstream commit 0a8cf165566ba55a39fd0f4de172119dd646d39a ]
    
    build_sec_desc() and id_mode_to_cifs_acl() derive a DACL pointer from a
    server-supplied dacloffset and then use the incoming ACL to rebuild the
    chmod/chown security descriptor.
    
    The original fix only checked that the struct smb_acl header fits before
    reading dacl_ptr->size or dacl_ptr->num_aces.  That avoids the immediate
    header-field OOB read, but the rewrite helpers still walk ACEs based on
    pdacl->num_aces with no structural validation of the incoming DACL body.
    
    A malicious server can return a truncated DACL that still contains a
    header, claims one or more ACEs, and then drive
    replace_sids_and_copy_aces() or set_chmod_dacl() past the validated
    extent while they compare or copy attacker-controlled ACEs.
    
    Factor the DACL structural checks into validate_dacl(), extend them to
    validate each ACE against the DACL bounds, and use the shared validator
    before the chmod/chown rebuild paths.  parse_dacl() reuses the same
    validator so the read-side parser and write-side rewrite paths agree on
    what constitutes a well-formed incoming DACL.
    
    Fixes: bc3e9dd9d104 ("cifs: Change SIDs in ACEs while transferring file ownership.")
    Cc: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-4-6
    Assisted-by: Codex:gpt-5-4
    Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
spi: spi-mem: avoid mutating op template in spi_mem_supports_op() [+ + +]
Author: Santhosh Kumar K <s-k6@ti.com>
Date:   Wed May 27 23:07:36 2026 +0530

    spi: spi-mem: avoid mutating op template in spi_mem_supports_op()
    
    commit 79378db6a86c7014cce40b65252e6c18f5b8bcc2 upstream.
    
    spi_mem_supports_op() accepts a const struct spi_mem_op pointer but
    casts away const internally to call spi_mem_adjust_op_freq(). This
    mutates the caller's op template, which causes stale max_freq values
    when callers reuse persistent templates - subsequent calls won't
    re-apply the device frequency cap since spi_mem_adjust_op_freq()
    skips non-zero values.
    
    Fix by operating on a stack-local copy instead.
    
    Fixes: a4f8e70d75dd ("spi: spi-mem: add spi_mem_adjust_op_freq() in spi_mem_supports_op()")
    Cc: Tianyu Xu <xtydtc@gmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Santhosh Kumar K <s-k6@ti.com>
    Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://patch.msgid.link/20260527173736.2243004-1-s-k6@ti.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

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

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

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

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

 
tools/bootconfig: Fix buf leaks in apply_xbc [+ + +]
Author: Hongtao Lee <lihongtao@kylinos.cn>
Date:   Wed May 20 11:01:26 2026 +0800

    tools/bootconfig: Fix buf leaks in apply_xbc
    
    [ Upstream commit f42d01aadcedd7bbf4f9a466cabe25c1781dedad ]
    
    If data calloc failed, free the buf before return.
    
    Link: https://lore.kernel.org/all/20260520030126.147782-1-lihongtao@kylinos.cn/
    
    Fixes: 950313ebf79c ("tools: bootconfig: Add bootconfig command")
    Signed-off-by: Hongtao Lee <lihongtao@kylinos.cn>
    Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
tools: ynl: add scope qualifier for definitions [+ + +]
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Sun May 10 12:29:01 2026 -0700

    tools: ynl: add scope qualifier for definitions
    
    commit fbf5df34a4dbcd09d433dd4f0916bf9b2ddb16de upstream.
    
    Using definitions in kernel policies is awkward right now.
    On one hand we want defines for max values and such.
    On the other we don't have a way of adding kernel-only defines.
    Adding unnecessary defines to uAPI is a bad idea, we won't
    be able to delete them. And when it comes to policy user
    space should just query it via the policy dump, not use
    hard coded defines.
    
    Add a "scope" property to definitions, which will let us tell
    the codegen that a definition is for kernel use only. Support
    following values:
      - uapi: render into the uAPI header (default, today's behavior)
      - kernel: render to kernel header only
      - user: same as kernel but for the user-side generated header
    
    Definitions may have a header property (definition is "external",
    provided by existing header). Extend the scope to headers, too.
    If definition has both scope and header properties we will only
    generate the includes in the right scope.
    
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Link: https://patch.msgid.link/20260510192904.3987113-8-kuba@kernel.org
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

usb: musb: omap2430: Fix use-after-free in omap2430_probe() [+ + +]
Author: Wentao Liang <vulab@iscas.ac.cn>
Date:   Thu Apr 9 10:11:04 2026 +0000

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    USB: serial: mct_u232: fix memory corruption with small endpoint
    
    commit 915b36d701950503c4ea0f6e314b10868e59fce3 upstream.
    
    The driver overrides the maximum transfer size for a specific device
    which only accepts 16 byte packets for its 32 byte bulk-out endpoint.
    
    Make sure to never increase the maximum transfer size to prevent slab
    corruption should a malicious device report a smaller endpoint max
    packet size than expected.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable@vger.kernel.org
    Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

usb: typec: tipd: Fix error code in tps6598x_probe() [+ + +]
Author: Dan Carpenter <error27@gmail.com>
Date:   Tue May 12 13:14:59 2026 +0300

    usb: typec: tipd: Fix error code in tps6598x_probe()
    
    commit b02900c85a6423cf9b3dcc6b47bf060c85075e69 upstream.
    
    Set the error code on these two error paths.  The existing code returns
    success.
    
    Fixes: 77ed2f4538da ("usb: typec: tipd: Use read_power_status function in probe")
    Fixes: 04041fd7d6ec ("usb: typec: tipd: Read data status in probe and cache its value")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Dan Carpenter <error27@gmail.com>
    Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Link: https://patch.msgid.link/agL9o7wUK1dOVBTy@stanley.mountain
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

usb: typec: ucsi: Check if power role change actually happened before handling [+ + +]
Author: Myrrh Periwinkle <myrrhperiwinkle@qtmlabs.xyz>
Date:   Tue May 19 18:41:39 2026 +0700

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

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

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

usb: typec: ucsi: Don't update power_supply on power role change if not connected [+ + +]
Author: Myrrh Periwinkle <myrrhperiwinkle@qtmlabs.xyz>
Date:   Tue May 19 18:41:40 2026 +0700

    usb: typec: ucsi: Don't update power_supply on power role change if not connected
    
    commit d98d413ca65d0790a8f3695d0a5845538958ab84 upstream.
    
    We only need to update the power_supply on power role change if the port
    is connected, because otherwise the online status should be the same for
    both cases.
    
    Cc: stable <stable@kernel.org>
    Fixes: 7616f006db07 ("usb: typec: ucsi: Update power_supply on power role change")
    Signed-off-by: Myrrh Periwinkle <myrrhperiwinkle@qtmlabs.xyz>
    Reported-and-tested-by: Sergey Senozhatsky <senozhatsky@chromium.org>
    Link: https://patch.msgid.link/20260519-ucsi-fix-2-v1-2-6f1239535187@qtmlabs.xyz
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

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

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

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

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

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

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

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

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

 
vsock/virtio: bind uarg before filling zerocopy skb [+ + +]
Author: Jingguo Tan <tanjingguo@huawei.com>
Date:   Wed May 27 10:33:01 2026 +0800

    vsock/virtio: bind uarg before filling zerocopy skb
    
    [ Upstream commit 1e584c304cfb94a759417130b1fc6d30b30c4cce ]
    
    virtio_transport_send_pkt_info() allocates or reuses the zerocopy uarg
    before entering the send loop, but virtio_transport_alloc_skb() still
    fills the skb before it inherits that uarg. When fixed-buffer vectored
    zerocopy hits MAX_SKB_FRAGS, io_sg_from_iter() may partially attach
    managed frags and return -EMSGSIZE. The rollback path call kfree_skb()
    to free an skb that carries SKBFL_MANAGED_FRAG_REFS but no uarg, so
    skb_release_data() falls through to ordinary frag unref.
    
    Pass the uarg into virtio_transport_alloc_skb() and bind it immediately
    before virtio_transport_fill_skb(). This keeps control or no-payload skbs
    untouched while ensuring success and rollback share one lifetime rule.
    
    Fixes: 581512a6dc93 ("vsock/virtio: MSG_ZEROCOPY flag support")
    Signed-off-by: Lin Ma <malin89@huawei.com>
    Signed-off-by: Rongzhen Cui <cuirongzhen@huawei.com>
    Signed-off-by: Jingguo Tan <tanjingguo@huawei.com>
    Acked-by: Arseniy Krasnov <avkrasnov@salutedevices.com>
    Acked-by: Michael S. Tsirkin <mst@redhat.com>
    Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
    Link: https://patch.msgid.link/20260527023301.1075581-1-malin89@huawei.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

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

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

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

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

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

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

 
x86/ftrace: Relocate %rip-relative percpu refs in dynamic trampolines [+ + +]
Author: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
Date:   Wed May 27 21:12:31 2026 +0200

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

 
x86/mm: Disable broadcast TLB flush when PCID is disabled [+ + +]
Author: Tom Lendacky <thomas.lendacky@amd.com>
Date:   Fri May 29 14:07:46 2026 -0400

    x86/mm: Disable broadcast TLB flush when PCID is disabled
    
    [ Upstream commit 44126343d58c68adaa8343fbf1c07dd20078c35e ]
    
    Booting with "nopcid" clears X86_FEATURE_PCID and keeps CR4.PCIDE from being
    set to one. On AMD CPUs that support INVLPGB, broadcast TLB flushing remains
    enabled.
    
    There are two checks that decide whether the global ASID code runs,
    mm_global_asid() and consider_global_asid(), that key off of the
    X86_FEATURE_INVLPGB feature. Once an mm becomes active on more than three
    CPUs, consider_global_asid() assigns it a global ASID, after which
    flush_tlb_mm_range() takes the broadcast_tlb_flush() path using a non-zero
    PCID. Issuing an INVLPGB with a non-zero PCID while CR4.PCIDE is not set
    results in a #GP:
    
      Oops: general protection fault, kernel NULL pointer dereference 0x1: 0000 [#1] SMP NOPTI
      CPU: 158 UID: 0 PID: 3119 Comm: snap Not tainted 7.1.0-rc3 #1 PREEMPT(full)
      Hardware name: ...
      RIP: 0010:broadcast_tlb_flush
      Code: ... 89 da 48 83 c8 07 <0f> 01 fe eb 08 cc cc cc ...
      Call Trace:
       <TASK>
       flush_tlb_mm_range
       ptep_clear_flush
       wp_page_copy
       ? _raw_spin_unlock
       __handle_mm_fault
       handle_mm_fault
       do_user_addr_fault
       exc_page_fault
       asm_exc_page_fault
    
    All processors that support broadcast TLB invalidation also have PCID support,
    so it is only the "nopcid" scenario that is of concern. In this situation just
    disable the broadcast TLB support using the CPUID dependency support by making
    X86_FEATURE_INVLPGB dependent on X86_FEATURE_PCID.
    
      [ bp: Massage commit message. ]
    
    Fixes: 4afeb0ed1753 ("x86/mm: Enable broadcast TLB invalidation for multi-threaded processes")
    Suggested-by: Dave Hansen <dave.hansen@intel.com>
    Assisted-by: Claude:claude-opus-4.7
    Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Acked-by: Rik van Riel <riel@surriel.com>
    Cc: <stable@kernel.org>
    Link: https://patch.msgid.link/b915acfd63e8b2a094fdeb8dc608738072518764.1779296450.git.thomas.lendacky@amd.com
    [ adjusted insertion point to after X86_FEATURE_SPEC_CTRL_SSBD ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

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

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

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

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

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

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

xfrm: ipcomp: Free destination pages on acomp errors [+ + +]
Author: Herbert Xu <herbert@gondor.apana.org.au>
Date:   Wed May 6 21:23:28 2026 +0800

    xfrm: ipcomp: Free destination pages on acomp errors
    
    commit 7dbac7680eb629b3b4dc7e98c34f943b8814c0c8 upstream.
    
    Move the out_free_req label up by a couple of lines so that the
    allocated dst SG list gets freed on error as well as success.
    
    Fixes: eb2953d26971 ("xfrm: ipcomp: Use crypto_acomp interface")
    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: Xin Liu <bird@lzu.edu.cn>
    Reported-by: Yilin Zhu <zylzyl2333@gmail.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfrm: iptfs: reset runtime state when cloning SAs [+ + +]
Author: Shaomin Chen <eeesssooo020@gmail.com>
Date:   Fri Jun 5 08:59:53 2026 -0400

    xfrm: iptfs: reset runtime state when cloning SAs
    
    [ Upstream commit 7f83d174073234839aea176f265e517e0d50a1d2 ]
    
    iptfs_clone_state() clones the IPTFS mode data with kmemdup(). This
    copies runtime objects which must not be shared with the original SA,
    including the embedded sk_buff_head, hrtimers, spinlock, and in-flight
    reassembly/reorder state.
    
    If xfrm_state_migrate() fails after clone_state() but before the later
    init_state() call has reinitialized those fields, the cloned state can be
    destroyed by xfrm_state_gc_task() with list and timer state copied from the
    original SA. With queued packets this lets the clone splice and free skbs
    owned by the original IPTFS queue, leading to use-after-free and
    double-free reports in iptfs_destroy_state() and skb release paths.
    
    Reinitialize the clone's runtime state before publishing it through
    x->mode_data. Because clone_state() now publishes a destroyable mode_data
    object before init_state(), take the mode callback module reference there.
    Avoid taking it again from __iptfs_init_state() for the same object.
    
    Fixes: 0e4fbf013fa5 ("xfrm: iptfs: add user packet (tunnel ingress) handling")
    Cc: stable@vger.kernel.org
    Signed-off-by: Shaomin Chen <eeesssooo020@gmail.com>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

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

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

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

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