Changelog in Linux kernel 6.12.108

 
accessibility: speakup: unregister tty ldisc on later init failures [+ + +]
Author: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Date:   Mon Jun 1 01:08:04 2026 +0200

    accessibility: speakup: unregister tty ldisc on later init failures
    
    commit a76acbaec9b8fd74413646984d2e3626d0543e39 upstream.
    
    The ldisc registration is intentionally non-fatal, since some synth
    drivers do not use tty/ldisc.  However, once speakup_init() continues
    past the registration point and later fails, the init unwind path should
    mirror speakup_exit() and call spk_ttyio_unregister_ldisc().
    
    Add the missing unregister call to the error path after synth_release(),
    matching the normal module exit cleanup order.
    
    Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
    Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Fixes: e23a9b439ce9 ("staging: speakup: safely register and unregister ldisc")
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20260531230804.254962-16-samuel.thibault@ens-lyon.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ALSA: usb-audio: Complete cleanup after system-resume errors [+ + +]
Author: Will Porter <mrwillporter@gmail.com>
Date:   Mon Aug 24 17:57:57 2026 -0500

    ALSA: usb-audio: Complete cleanup after system-resume errors
    
    commit 1739a976312e110c93a8dee66a1cdf893a1b187e upstream.
    
    A failed system resume can leave the card unusable until reboot.
    usb_audio_resume() jumps to err_out when snd_usb_pcm_resume() or
    snd_usb_mixer_resume() fails. The error path skips the out: block, which
    restores D0 and decrements chip->num_suspended_intf.
    
    The card stays in SNDRV_CTL_POWER_D3hot, so later control access blocks in
    snd_power_ref_and_wait(). USB core logs an interface resume callback error.
    It does not retry that callback, so a later callback cannot complete the
    skipped cleanup.
    
    usb_audio_suspend() increments num_suspended_intf before returning success.
    A system-resume callback must consume the system-suspend count even if a
    component resume fails. Otherwise, the stranded count skews later suspend
    and resume cycles.
    
    Do not apply this cleanup to runtime-resume errors. Runtime PM can retry
    -EAGAIN or -EBUSY without another suspend callback. The count must continue
    to describe that suspended interface. Other runtime-resume errors latch
    runtime_error in the PM core and do not cause an immediate callback retry.
    
    Both parts of the system-resume error path are longstanding. Commit
    88a8516a2128a ("ALSA: usbaudio: implement USB autosuspend") introduced
    err_out past the D0 restore. Commit 862b2509d157c ("ALSA: usb-audio: Fix
    inconsistent card PM state after resume") later moved
    num_suspended_intf-- into the out: block. The error path now skips both
    operations.
    
    No third-party code is needed to reach the error path.
    snd_usb_mixer_resume() ends in snd_usb_mixer_activate(), which returns the
    result of usb_submit_urb() for devices that have a mixer status URB. Its
    mixer->private_resume hook can also fail through scarlett2_init_notify().
    snd_usb_pcm_resume() issues a SET_CUR request to a UAC3 power domain. It
    can return -EPIPE or -EIO when the device stalls the request.
    
    Route a component error through out: only when system_suspend is nonzero.
    Continue to return runtime-resume errors through err_out. Later component
    resume stages remain skipped. The original error still reaches USB core.
    A later transfer can fail if the device did not recover.
    
    I reproduced the system-resume failure on an Audient iD14 MkI with an
    out-of-tree diagnostic mixer resume hook. An injected -EIO on the unpatched
    core left control readers in uninterruptible sleep in
    snd_power_ref_and_wait() until a reboot. With this patch, the same failure
    restored control access. A second system suspend and resume also succeeded
    after I disabled fault injection.
    
    Assisted-by: Claude:claude-opus-5
    Assisted-by: Antigravity:gemini-3.1-pro-high
    Assisted-by: Codex:gpt-5.6-sol
    Fixes: 88a8516a2128a ("ALSA: usbaudio: implement USB autosuspend")
    Fixes: 862b2509d157c ("ALSA: usb-audio: Fix inconsistent card PM state after resume")
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Will Porter <mrwillporter@gmail.com>
    Link: https://patch.msgid.link/20260824225757.26749-1-mrwillporter@gmail.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: usb-audio: fix OOB write in snd_usbmidi_novation_output() [+ + +]
Author: Marouane El Moufid <eun0us@espilon.net>
Date:   Sun Aug 23 13:55:48 2026 +0000

    ALSA: usb-audio: fix OOB write in snd_usbmidi_novation_output()
    
    commit 1035a8f63bae28e498b0e7b5ac91d749844a7158 upstream.
    
    snd_usbmidi_novation_output() lays out a two-byte header at
    transfer_buffer[0..1] and passes &transfer_buffer[2] together with a
    length of ep->max_transfer - 2 to snd_rawmidi_transmit():
    
            count = snd_rawmidi_transmit(ep->ports[0].substream,
                                         &transfer_buffer[2],
                                         ep->max_transfer - 2);
    
    ep->max_transfer comes from the output endpoint's wMaxPacketSize via
    usb_maxpacket(). A malformed or malicious device can advertise a bulk
    OUT endpoint with a wMaxPacketSize of 1 - the USB core only clamps this
    value downwards - so ep->max_transfer becomes 1 and the count argument
    becomes -1.
    
    snd_rawmidi_transmit() passes the negative count on to
    __snd_rawmidi_transmit_peek(), where "if (count1 > count) count1 = count"
    leaves count1 negative; get_aligned_size() keeps it negative for a
    byte-stream substream, so the following memcpy(buffer, ..., count1) runs
    with a (size_t)-1 length and writes far past the transfer buffer, which
    was allocated with usb_alloc_coherent(ep->max_transfer).
    
    This is the same class of bug that was fixed for snd_usbmidi_akai_output()
    in commit 0970274613fb ("ALSA: usb-audio: fix OOB write in
    snd_usbmidi_akai_output()"); the novation output routine was left
    unguarded. Bail out when the endpoint cannot hold the two-byte header
    plus at least one payload byte.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable@vger.kernel.org
    Signed-off-by: Marouane El Moufid <eun0us@espilon.net>
    Link: https://patch.msgid.link/178749334830.543645.13722252148340572274@espilon.net
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
ASoC: nau8821: Cancel delayed work on component remove [+ + +]
Author: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Date:   Wed Dec 31 22:04:16 2025 +0200

    ASoC: nau8821: Cancel delayed work on component remove
    
    [ Upstream commit dbd3fd05cddfdeec1e49b0a66269881c09eebd17 ]
    
    Attempting to unload the driver while a jack detection work is pending
    would likely crash the kernel when it is eventually scheduled for
    execution:
    
    [ 1984.896308] BUG: unable to handle page fault for address: ffffffffc10c2a20
    [...]
    [ 1984.896388] Hardware name: Valve Jupiter/Jupiter, BIOS F7A0131 01/30/2024
    [ 1984.896396] Workqueue: events nau8821_jdet_work [snd_soc_nau8821]
    [ 1984.896414] RIP: 0010:__mutex_lock+0x9f/0x11d0
    [...]
    [ 1984.896504] Call Trace:
    [ 1984.896511]  <TASK>
    [ 1984.896524]  ? snd_soc_dapm_disable_pin+0x26/0x60 [snd_soc_core]
    [ 1984.896572]  ? snd_soc_dapm_disable_pin+0x26/0x60 [snd_soc_core]
    [ 1984.896596]  snd_soc_dapm_disable_pin+0x26/0x60 [snd_soc_core]
    [ 1984.896622]  nau8821_jdet_work+0xeb/0x1e0 [snd_soc_nau8821]
    [ 1984.896636]  process_one_work+0x211/0x590
    [ 1984.896649]  ? srso_return_thunk+0x5/0x5f
    [ 1984.896670]  worker_thread+0x1cd/0x3a0
    
    Cancel unscheduled jdet_work or wait for its execution to finish before
    the component driver gets removed.
    
    Fixes: aab1ad11d69f ("ASoC: nau8821: new driver")
    Fixes: ee70bacef1c6 ("ASoC: nau8821: Avoid unnecessary blocking in IRQ handler")
    Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
    Link: https://patch.msgid.link/20251231-nau8821-cleanup-v1-2-6b0b76cbbb64@collabora.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

ASoC: nau8821: Cancel pending work before suspend [+ + +]
Author: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Date:   Wed Dec 31 22:04:17 2025 +0200

    ASoC: nau8821: Cancel pending work before suspend
    
    [ Upstream commit 7786b10688ac0ebeaff655923cbb2c7d34a98995 ]
    
    A jack detection work that is unscheduled or in progress while executing
    the suspend handler could trigger a race condition.
    
    Ensure state consistency by cancelling any pending work or wait for its
    execution to complete before processing the suspend.  Since driver
    (re)enables both insert and eject interrupts on resume, there is no risk
    to miss the related jack events.  Therefore, flush_delayed_work() is not
    required here.
    
    Fixes: aab1ad11d69f ("ASoC: nau8821: new driver")
    Fixes: ee70bacef1c6 ("ASoC: nau8821: Avoid unnecessary blocking in IRQ handler")
    Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
    Link: https://patch.msgid.link/20251231-nau8821-cleanup-v1-3-6b0b76cbbb64@collabora.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
batman-adv: reject unrepresentable multicast TVLV offsets [+ + +]
Author: Kyle Zeng <kylebot@openai.com>
Date:   Mon Aug 17 08:49:54 2026 +0000

    batman-adv: reject unrepresentable multicast TVLV offsets
    
    commit f12c2de4f542e3220e17e0606f492110064f04cb upstream.
    
    The network and transport header fields in struct sk_buff are 16-bit
    offsets from skb->head, and U16_MAX is reserved as the unset transport
    header value. batadv_tvlv_call_handler() sets both fields from a received
    multicast TVLV without checking whether the TVLV end is representable.
    
    If the end offset exceeds the field's range, skb_set_transport_header()
    truncates it so that the transport header precedes the network header.
    The negative difference is then returned by skb_network_header_len() as
    a large u32. batadv_mcast_forw_packet() consequently accepts an oversized
    multicast tracker and accesses memory beyond the skb data.
    
    Add skb_set_transport_header_careful(), an offset-aware counterpart to
    skb_reset_transport_header_careful(), which validates the final
    head-relative offset before assigning it. Use the new helper in
    batadv_tvlv_call_handler() and reject unrepresentable TVLVs before
    setting the network header.
    
    Fixes: 07afe1ba288c ("batman-adv: mcast: implement multicast packet reception and forwarding")
    Cc: stable@vger.kernel.org
    Signed-off-by: Kyle Zeng <kylebot@openai.com>
    Co-developed-by: David Lee <david.lee@trailofbits.com>
    Signed-off-by: David Lee <david.lee@trailofbits.com>
    Acked-by: Sven Eckelmann <sven@narfation.org>
    Link: https://patch.msgid.link/20260817084955.944189-1-david.lee@trailofbits.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
Bluetooth: hci_sync: Fix accept list UAF during suspend [+ + +]
Author: Chengfeng Ye <nicoyip.dev@gmail.com>
Date:   Wed Aug 26 13:47:55 2026 -0400

    Bluetooth: hci_sync: Fix accept list UAF during suspend
    
    [ Upstream commit f57b399c4fa1501b2d5451f52d861ece86bcf3db ]
    
    hci_update_event_filter_sync() walks hdev->accept_list while sending a
    synchronous HCI command for each remote-wakeup device.  The suspend path
    holds hdev->req_lock, but accept-list updates are serialized by hdev->lock.
    Consequently, remove_device() can free the current list entry during the
    controller wait.
    
    The following interleaving causes the use-after-free:
    
      hci_update_event_filter_sync()    remove_device()
      fetch accept-list entry
      hci_set_event_filter_sync()
        wait for controller response    hci_dev_lock()
                                        list_del()
                                        kfree()
                                        hci_dev_unlock()
      read the freed list.next
    
    KASAN reported:
    
      BUG: KASAN: slab-use-after-free in hci_suspend_sync+0x835/0x910
      Read of size 8 at addr ffff88810bec8440 by task kworker/0:1/10
      Workqueue: events vhci_suspend_work
      Call Trace:
       hci_suspend_sync+0x835/0x910
       hci_suspend_dev+0x182/0x450
       process_one_work+0x661/0x1090
       worker_thread+0x45b/0xd10
    
      Allocated by task 86:
       hci_bdaddr_list_add_with_flags+0x1a8/0x400
       add_device+0x381/0x820
       hci_sock_sendmsg+0x1033/0x1ea0
    
      Freed by task 91:
       kfree+0x131/0x3c0
       remove_device+0x429/0xb70
       hci_sock_sendmsg+0x1033/0x1ea0
    
    Snapshot the remote-wakeup addresses under hdev->lock.  Release the lock
    before sending HCI commands.  Clear the controller event filter before
    building the snapshot, and skip allocation and the second list traversal
    when there are no matching entries.  This preserves the original filter
    and scan-state updates without retaining an accept-list node across a
    controller wait.
    
    Fixes: 182ee45da083 ("Bluetooth: hci_sync: Rework hci_suspend_notifier")
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/linux-bluetooth/20260730092331.2069741-1-nicoyip.dev@gmail.com/
    Signed-off-by: Chengfeng Ye <nicoyip.dev@gmail.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bluetooth: hci_sync: Use bt_dev_err() to log error message in hci_update_event_filter_sync() [+ + +]
Author: Zijun Hu <zijun.hu@oss.qualcomm.com>
Date:   Wed Aug 26 13:47:54 2026 -0400

    Bluetooth: hci_sync: Use bt_dev_err() to log error message in hci_update_event_filter_sync()
    
    [ Upstream commit da0186f19a7433d3d5607b0f61e9a3de17d1f721 ]
    
    Use bt_dev_err() instead of bt_dev_dbg() to log error message in
    hci_update_event_filter_sync().
    
    Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Stable-dep-of: f57b399c4fa1 ("Bluetooth: hci_sync: Fix accept list UAF during suspend")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
bpf: Fix use-after-free in offloaded map/prog info fill [+ + +]
Author: Jiayuan Chen <jiayuan.chen@linux.dev>
Date:   Thu Apr 9 10:37:32 2026 +0800

    bpf: Fix use-after-free in offloaded map/prog info fill
    
    [ Upstream commit a0c584fc18056709c8e047a82a6045d6c209f4ce ]
    
    When querying info for an offloaded BPF map or program,
    bpf_map_offload_info_fill_ns() and bpf_prog_offload_info_fill_ns()
    obtain the network namespace with get_net(dev_net(offmap->netdev)).
    However, the associated netdev's netns may be racing with teardown
    during netns destruction. If the netns refcount has already reached 0,
    get_net() performs a refcount_t increment on 0, triggering:
    
      refcount_t: addition on 0; use-after-free.
    
    Although rtnl_lock and bpf_devs_lock ensure the netdev pointer remains
    valid, they cannot prevent the netns refcount from reaching zero.
    
    Fix this by using maybe_get_net() instead of get_net(). maybe_get_net()
    uses refcount_inc_not_zero() and returns NULL if the refcount is already
    zero, which causes ns_get_path_cb() to fail and the caller to return
    -ENOENT -- the correct behavior when the netns is being destroyed.
    
    Fixes: 675fc275a3a2d ("bpf: offload: report device information for offloaded programs")
    Fixes: 52775b33bb507 ("bpf: offload: report device information about offloaded maps")
    Reported-by: Yinhao Hu <dddddd@hust.edu.cn>
    Reported-by: Kaiyan Mei <M202472210@hust.edu.cn>
    Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
    Closes: https://lore.kernel.org/bpf/f0aa3678-79c9-47ae-9e8c-02a3d1df160a@hust.edu.cn/
    Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
    Acked-by: Daniel Borkmann <daniel@iogearbox.net>
    Link: https://lore.kernel.org/r/20260409023733.168050-1-jiayuan.chen@linux.dev
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
can: j1939: add missing calls in NETDEV_UNREGISTER notification handler [+ + +]
Author: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Date:   Sat Sep 27 21:11:16 2025 +0900

    can: j1939: add missing calls in NETDEV_UNREGISTER notification handler
    
    [ Upstream commit 93a27b5891b8194a8c083c9a80d2141d4bf47ba8 ]
    
    Currently NETDEV_UNREGISTER event handler is not calling
    j1939_cancel_active_session() and j1939_sk_queue_drop_all().
    This will result in these calls being skipped when j1939_sk_release() is
    called. And I guess that the reason syzbot is still reporting
    
      unregister_netdevice: waiting for vcan0 to become free. Usage count = 2
    
    is caused by lack of these calls.
    
    Calling j1939_cancel_active_session(priv, sk) from j1939_sk_release() can
    be covered by calling j1939_cancel_active_session(priv, NULL) from
    j1939_netdev_notify().
    
    Calling j1939_sk_queue_drop_all() from j1939_sk_release() can be covered
    by calling j1939_sk_netdev_event_netdown() from j1939_netdev_notify().
    
    Therefore, we can reuse j1939_cancel_active_session(priv, NULL) and
    j1939_sk_netdev_event_netdown(priv) for NETDEV_UNREGISTER event handler.
    
    Fixes: 7fcbe5b2c6a4 ("can: j1939: implement NETDEV_UNREGISTER notification handler")
    Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>
    Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
    Link: https://patch.msgid.link/3ad3c7f8-5a74-4b07-a193-cb0725823558@I-love.SAKURA.ne.jp
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

can: j1939: implement NETDEV_UNREGISTER notification handler [+ + +]
Author: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Date:   Mon Aug 25 23:07:24 2025 +0900

    can: j1939: implement NETDEV_UNREGISTER notification handler
    
    [ Upstream commit 7fcbe5b2c6a4b5407bf2241fdb71e0a390f6ab9a ]
    
    syzbot is reporting
    
      unregister_netdevice: waiting for vcan0 to become free. Usage count = 2
    
    problem, for j1939 protocol did not have NETDEV_UNREGISTER notification
    handler for undoing changes made by j1939_sk_bind().
    
    Commit 25fe97cb7620 ("can: j1939: move j1939_priv_put() into sk_destruct
    callback") expects that a call to j1939_priv_put() can be unconditionally
    delayed until j1939_sk_sock_destruct() is called. But we need to call
    j1939_priv_put() against an extra ref held by j1939_sk_bind() call
    (as a part of undoing changes made by j1939_sk_bind()) as soon as
    NETDEV_UNREGISTER notification fires (i.e. before j1939_sk_sock_destruct()
    is called via j1939_sk_release()). Otherwise, the extra ref on "struct
    j1939_priv" held by j1939_sk_bind() call prevents "struct net_device" from
    dropping the usage count to 1; making it impossible for
    unregister_netdevice() to continue.
    
    Reported-by: syzbot <syzbot+881d65229ca4f9ae8c84@syzkaller.appspotmail.com>
    Closes: https://syzkaller.appspot.com/bug?extid=881d65229ca4f9ae8c84
    Tested-by: syzbot <syzbot+881d65229ca4f9ae8c84@syzkaller.appspotmail.com>
    Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol")
    Fixes: 25fe97cb7620 ("can: j1939: move j1939_priv_put() into sk_destruct callback")
    Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>
    Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
    Link: https://patch.msgid.link/ac9db9a4-6c30-416e-8b94-96e6559d55b2@I-love.SAKURA.ne.jp
    [mkl: remove space in front of label]
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

can: j1939: make j1939_sk_bind() fail if device is no longer registered [+ + +]
Author: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Date:   Tue Nov 25 22:43:12 2025 +0900

    can: j1939: make j1939_sk_bind() fail if device is no longer registered
    
    [ Upstream commit 46cea215dc9444ec32a76b1b6a9cb809e17b64d5 ]
    
    There is a theoretical race window in j1939_sk_netdev_event_unregister()
    where two j1939_sk_bind() calls jump in between read_unlock_bh() and
    lock_sock().
    
    The assumption jsk->priv == priv can fail if the first j1939_sk_bind()
    call once made jsk->priv == NULL due to failed j1939_local_ecu_get() call
    and the second j1939_sk_bind() call again made jsk->priv != NULL due to
    successful j1939_local_ecu_get() call.
    
    Since the socket lock is held by both j1939_sk_netdev_event_unregister()
    and j1939_sk_bind(), checking ndev->reg_state with the socket lock held can
    reliably make the second j1939_sk_bind() call fail (and close this race
    window).
    
    Fixes: 7fcbe5b2c6a4 ("can: j1939: implement NETDEV_UNREGISTER notification handler")
    Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
    Link: https://patch.msgid.link/5732921e-247e-4957-a364-da74bd7031d7@I-love.SAKURA.ne.jp
    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
crypto: atmel-tdes - use scatterlist length before DMA mapping [+ + +]
Author: Thorsten Blum <thorsten.blum@linux.dev>
Date:   Thu Jun 11 12:36:35 2026 +0200

    crypto: atmel-tdes - use scatterlist length before DMA mapping
    
    commit ba199bdaa80b09a7dd92f28751de7f3dbb06c510 upstream.
    
    Using sg_dma_len() is only valid after mapping the scatterlist with
    dma_map_sg(). However, atmel_tdes_crypt_start() uses it before mapping
    to compare input/output lengths and to compute the transfer count.
    
    Use the original scatterlist lengths before DMA mapping to avoid reading
    stale or uninitialized DMA lengths when CONFIG_NEED_SG_DMA_LENGTH=y.
    
    Drop the output scatterlist length in the fast path since it is equal to
    ->in_sg->length and does not change the transfer count.
    
    Fixes: 13802005d8f2 ("crypto: atmel - add Atmel DES/TDES driver")
    Fixes: 1f858040c2f7 ("crypto: atmel-tdes - add support for latest release of the IP (0x700)")
    Cc: stable@vger.kernel.org
    Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: mxs-dcp - fix source scatterlist length access [+ + +]
Author: Thorsten Blum <thorsten.blum@linux.dev>
Date:   Sun Jun 21 21:26:16 2026 +0200

    crypto: mxs-dcp - fix source scatterlist length access
    
    commit c5bcb084a9871e5b62afb5f48b60adfa13b5d9f8 upstream.
    
    mxs_dcp_aes_block_crypt() uses sg_dma_len() without mapping the source
    scatterlist with dma_map_sg() first. Therefore, sg_dma_len() is invalid
    and could return zero or a stale DMA length, causing encryption and
    decryption to process the wrong number of bytes when
    CONFIG_NEED_SG_DMA_LENGTH=y.
    
    Use the original scatterlist length instead.
    
    Fixes: 15b59e7c3733 ("crypto: mxs - Add Freescale MXS DCP driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: qce - fix CCM AAD buffer underallocation [+ + +]
Author: Md Sadre Alam <md.alam@oss.qualcomm.com>
Date:   Fri Aug 7 12:24:54 2026 +0530

    crypto: qce - fix CCM AAD buffer underallocation
    
    commit 7f2345f47dd189625f657cd72437179ab4170ee1 upstream.
    
    The AAD buffer allocated in qce_aead_ccm_prepare_buf_assoclen()
    can be smaller than the length later programmed into the DMA
    scatterlist.
    
    The allocation size is currently calculated as:
    
      ALIGN(assoclen, 16) + MAX_CCM_ADATA_HEADER_LEN
    
    while the DMA length is set to:
    
      ALIGN(assoclen + adata_header_len, 16)
    
    Since ALIGN() does not distribute over addition, the allocation
    can be smaller than the DMA length. For example, when
    assoclen = 32 and adata_header_len = 2:
    
      allocation = ALIGN(32, 16) + 6 = 38
      DMA length = ALIGN(32 + 2, 16) = 48
    
    As a result, the QCE hardware can read beyond the allocated
    buffer while computing the CBC-MAC over the associated data.
    The extra bytes are folded into the authentication tag,
    resulting in an incorrect tag and causing CCM self-test
    failures such as:
    
      alg: aead: ccm-aes-qce encryption test failed (wrong result)
      on test vector 8
    
    Fix the allocation by adding the maximum possible AAD header
    length before alignment:
    
      ALIGN(assoclen + MAX_CCM_ADATA_HEADER_LEN, 16)
    
    This guarantees that the allocated buffer is large enough
    for the fully padded AAD data for all supported header sizes.
    
    Cc: stable@vger.kernel.org
    Fixes: 9363efb4181c ("crypto: qce - Add support for AEAD algorithms")
    Signed-off-by: Md Sadre Alam <md.alam@oss.qualcomm.com>
    Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: qce - Remove unsafe/deprecated algorithms [+ + +]
Author: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Date:   Mon Jun 22 15:18:09 2026 +0200

    crypto: qce - Remove unsafe/deprecated algorithms
    
    commit 7e28b0a5c4b7d075b98ce6d8f5290a9d3deb5b92 upstream.
    
    Remove algorithms that are either unsafe or deprecated and have no
    in-kernel users that cannot be served by the ARM CE implementations.
    
    AES-ECB reveals plaintext patterns (identical plaintext blocks produce
    identical ciphertext blocks) and should not be exposed as a hardware-
    accelerated primitive. DES, Triple DES and HMAC-SHA1 have been
    deprecated for years.
    
    Remove sha1, ecb(aes), ecb(des), cbc(des), ecb(des3_ede), cbc(des3_ede),
    hmac(sha1) and all AEAD variants built on these primitives as well as
    authenc(hmac(sha256),cbc(des)). Also clean up the - now dead - code,
    flags and constants.
    
    Cc: stable@vger.kernel.org
    Acked-by: Eric Biggers <ebiggers@kernel.org>
    Tested-by: Kuldeep Singh <kuldeep.singh@oss.qualcomm.com>
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: qcom-rng - Allow zero as a random number [+ + +]
Author: Eric Biggers <ebiggers@kernel.org>
Date:   Mon Jun 8 17:58:46 2026 +0000

    crypto: qcom-rng - Allow zero as a random number
    
    commit 4ef04bdc0c9f98836d1638be516f6bf1bad55f69 upstream.
    
    Zero is a valid random number and needs to be allowed.  Otherwise the
    output is distinguishable from random.
    
    Fixes: f29cd5bb64c2 ("crypto: qcom-rng - Add hw_random interface support")
    Cc: stable@vger.kernel.org
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Signed-off-by: Eric Biggers <ebiggers@kernel.org>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: qcom-rng - Enable clock in hwrng case [+ + +]
Author: Eric Biggers <ebiggers@kernel.org>
Date:   Mon Jun 8 17:58:45 2026 +0000

    crypto: qcom-rng - Enable clock in hwrng case
    
    commit 0fd97bbda2842d7dcccee599ac2c0e9554bdddbc upstream.
    
    Fix qcom-rng.c to enable the clock before accessing the hardware.
    
    Fixes: f29cd5bb64c2 ("crypto: qcom-rng - Add hw_random interface support")
    Cc: stable@vger.kernel.org
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
    Signed-off-by: Eric Biggers <ebiggers@kernel.org>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

crypto: qcom-rng - Remove crypto_rng interface [+ + +]
Author: Eric Biggers <ebiggers@kernel.org>
Date:   Mon Jun 8 17:58:47 2026 +0000

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

 
exfat: fix double free in delayed_free [+ + +]
Author: Namjae Jeon <linkinjeon@kernel.org>
Date:   Tue Apr 1 13:50:39 2025 +0900

    exfat: fix double free in delayed_free
    
    [ Upstream commit 1f3d9724e16d62c7d42c67d6613b8512f2887c22 ]
    
    The double free could happen in the following path.
    
    exfat_create_upcase_table()
            exfat_create_upcase_table() : return error
            exfat_free_upcase_table() : free ->vol_utbl
            exfat_load_default_upcase_table : return error
         exfat_kill_sb()
               delayed_free()
                      exfat_free_upcase_table() <--------- double free
    This patch set ->vol_util as NULL after freeing it.
    
    Reported-by: Jianzhou Zhao <xnxc22xnxc22@qq.com>
    Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ext4: don't enable DAX on new encrypted files [+ + +]
Author: Eric Biggers <ebiggers@kernel.org>
Date:   Wed Aug 26 20:28:15 2026 -0700

    ext4: don't enable DAX on new encrypted files
    
    commit da32af420d6d466e247c43ac0b829edeac7ae0ad upstream.
    
    Currently, when a new encrypted regular file is created, the call to
    ext4_set_inode_flags(inode, init=true) in __ext4_new_inode() is made
    before EXT4_INODE_ENCRYPT is set.  As a result, it can set S_DAX if the
    filesystem is mounted with "-o dax=always".
    
    EXT4_INODE_ENCRYPT then actually gets set a bit later in
    __ext4_new_inode(), when it calls fscrypt_set_context() which calls
    ext4_set_context().  ext4_set_context() sets EXT4_INODE_ENCRYPT and
    calls ext4_set_inode_flags(inode, init=false) to set S_ENCRYPTED too.
    
    This was intended to clear S_DAX as well.  However, this was broken by
    commit 043546e46dc7 ("fs/ext4: Only change S_DAX on inode load").  This
    causes data written to the file to bypass encryption, also causing
    xfstests failures such as generic/548 (when "-o dax=always" is used).
    
    Fix this by simplifying the flow by making __ext4_new_inode() set
    EXT4_INODE_ENCRYPT earlier.  This makes it take effect in
    ext4_set_inode_flags(inode, init=true), making S_DAX never be set.
    
    Similarly, make EXT4_STATE_MAY_INLINE_DATA never be set in the first
    place on new encrypted inodes.  Then it doesn't need to be cleared.
    
    As a result of these simplifications, ext4_set_context() no longer needs
    to change inode flags or state when 'handle != NULL'.  Remove that too.
    
    Reported-by: Disha Goel <disgoel@linux.ibm.com>
    Reported-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
    Closes: https://lore.kernel.org/r/20260723085648.1500357-1-ojaswin@linux.ibm.com
    Fixes: 043546e46dc7 ("fs/ext4: Only change S_DAX on inode load")
    Cc: stable@vger.kernel.org
    Signed-off-by: Eric Biggers <ebiggers@kernel.org>
    Tested-by: Disha Goel <disgoel@linux.ibm.com>
    Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Link: https://patch.msgid.link/20260730175212.36923-1-ebiggers@kernel.org
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
fpga: dfl: fme: add error handling [+ + +]
Author: Griffin Kroah-Hartman <griffin@kroah.com>
Date:   Mon Jul 6 16:58:21 2026 +0200

    fpga: dfl: fme: add error handling
    
    commit b5ba63e247075087ab8a6a087622c762dc4172e9 upstream.
    
    Add error handling to devm_kasprint in fme_perf_pmu_register().
    
    Assisted-by: gkh_clanker_2000
    Fixes: 724142f8c42a ("fpga: dfl: fme: add performance reporting support")
    Cc: stable@kernel.org
    Cc: Xu Yilun <yilun.xu@intel.com>
    Cc: Tom Rix <trix@redhat.com>
    Cc: Moritz Fischer <mdf@kernel.org>
    Signed-off-by: Griffin Kroah-Hartman <griffin@kroah.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    [ Yilun: Fix stable tag, add Fixes tag ]
    Reviewed-by: Xu Yilun <yilun.xu@intel.com>
    Link: https://lore.kernel.org/r/2026070620-unwired-clay-f6cc@gregkh
    Signed-off-by: Xu Yilun <yilun.xu@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
fuse: fix invalidate lock leak on open O_TRUNC DAX failure [+ + +]
Author: Baokun Li <libaokun@linux.alibaba.com>
Date:   Mon Aug 17 23:18:01 2026 +0800

    fuse: fix invalidate lock leak on open O_TRUNC DAX failure
    
    commit a927f1867e61b78f39f9da0bbba3c98c2ca151fe upstream.
    
    fuse_open() takes filemap_invalidate_lock() for a DAX truncate
    (dax_truncate = true) and releases it before the out_inode_unlock
    label.  But when fuse_dax_break_layouts() fails, the goto
    out_inode_unlock skips the unlock and leaks the rwsem, so any later
    fault or truncate on the file stalls on the stale lock.
    
    fuse_dax_break_layouts() can fail with -ERESTARTSYS when a signal
    interrupts the wait for busy DAX pages to drain:
    
      open("file", O_RDWR | O_TRUNC)
      └─ fuse_open()
         ├─ filemap_invalidate_lock()        # dax_truncate
         └─ fuse_dax_break_layouts()
            └─ dax_break_layout()
               └─ wait_page_idle()           # TASK_INTERRUPTIBLE
                  └─ fuse_wait_dax_page()    # unlock, schedule, re-lock
                     └─ signal → -ERESTARTSYS
         goto out_inode_unlock               # <- lock leaked
    
    Fix this by moving filemap_invalidate_unlock() below the label so
    that all error paths release the lock, and rename the label to
    out_unlock as it now covers more than just the inode lock.
    
    Fixes: 2fdbb8dd0155 ("fuse: fix deadlock between atomic O_TRUNC and page invalidation")
    Cc: stable@vger.kernel.org # v6.0+
    Signed-off-by: Baokun Li <libaokun@linux.alibaba.com>
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

fuse: fix invalidate lock leak on setattr writeback failure [+ + +]
Author: Baokun Li <libaokun@linux.alibaba.com>
Date:   Mon Aug 17 23:18:00 2026 +0800

    fuse: fix invalidate lock leak on setattr writeback failure
    
    commit 9afeca0d569c9fc89d758fe7a9339d1e8afb1546 upstream.
    
    fuse_do_setattr() takes filemap_invalidate_lock() for a DAX truncate
    (fault_blocked = true) and releases it at the out:/error: labels.  But
    when a writeback flush is also needed, a write_inode_now() failure
    returns directly and leaks the lock, so any later fault or truncate on
    the file stalls on the stale rwsem.
    
    For example, truncate(2) on a setuid file reaches fuse_do_setattr()
    with both ATTR_SIZE and ATTR_MODE set:
    
      truncate(2)
      └─ do_truncate()
         ├─ dentry_needs_remove_privs()         # S_ISUID
         └─ notify_change()                     # KILL_SUID -> ATTR_MODE
            └─ fuse_setattr()                   # no killpriv:
               │                                #   ia_valid |= ATTR_MODE
               └─ fuse_do_setattr()
                  ├─ filemap_invalidate_lock()  # IS_DAX && is_truncate
                  └─ write_inode_now()          # is_wb && ATTR_MODE
                     └─ if (err)                # e.g. daemon -> -EIO
                        return err              # <- lock leaked
    
    Fix this by adding an unlock label that releases the lock before
    returning the error, and use it for the fuse_dax_break_layouts()
    failure path as well.
    
    Fixes: 6ae330cad6ef ("virtiofs: serialize truncate/punch_hole and dax fault path")
    Cc: stable@vger.kernel.org # v5.10+
    Signed-off-by: Baokun Li <libaokun@linux.alibaba.com>
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
gtp: serialize PDP context updates [+ + +]
Author: Qing Ming <a0yami@mailbox.org>
Date:   Tue Aug 18 23:00:00 2026 +0800

    gtp: serialize PDP context updates
    
    commit 498386b6d402737db1e2eeed4c385acbf0ef9e34 upstream.
    
    PDP contexts can be deleted through GTP_CMD_DELPDP or while the GTP
    network device is being unregistered. The latter is serialized by RTNL,
    but the generic-netlink delete path only holds RCU.
    
    Running both paths concurrently can therefore make both paths delete the
    same PDP context. The issue was found through static analysis and
    reproduced on a KASAN-enabled kernel by a simple two-thread program
    racing GTP_CMD_DELPDP against RTM_DELLINK:
    
      Oops: general protection fault, probably for non-canonical address
      KASAN: maybe wild-memory-access in range
             [0xdead000000000120-0xdead000000000127]
      RIP: gtp_genl_del_pdp+0x1c1/0x420 [gtp]
      RBP: dead000000000122
    
    The second deletion dereferenced the poisoned hlist pprev pointer.
    
    Serialize gtp_pdp_add(), gtp_genl_del_pdp(), and gtp_dellink() with a
    shared mutex. Keep the mutex held until the final use of a PDP context in
    the NEWPDP path, and keep the RCU read-side section around the complete
    PDP context use in the DELPDP path.
    
    Fixes: 459aa660eb1d ("gtp: add initial driver for datapath of GPRS Tunneling Protocol (GTP-U)")
    Cc: stable@vger.kernel.org
    Signed-off-by: Qing Ming <a0yami@mailbox.org>
    Link: https://patch.msgid.link/20260818150000.7670-1-a0yami@mailbox.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
HID: asus: fix missing hid_is_usb() check [+ + +]
Author: Jann Horn <jannh@google.com>
Date:   Wed Aug 26 10:01:54 2026 -0400

    HID: asus: fix missing hid_is_usb() check
    
    [ Upstream commit 02bf61dfb44f17ec187d1da1a82495951bbd12df ]
    
    to_usb_interface() can only be used on a hid_device whose parent is really
    USB; uhid can create devices that identify as being on BUS_USB, but don't
    actually have a USB parent.
    Fix the use of to_usb_interface() without a hid_is_usb() check.
    
    I have verified that it is currently possible to trigger a kernel splat due
    to this bug in an ASAN build, and that this commit fixes the issue.
    
    Fixes: 00e005c952f7 ("hid-asus: check ROG Ally MCU version and warn")
    Cc: stable@vger.kernel.org
    Signed-off-by: Jann Horn <jannh@google.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

HID: asus: simplify RGB init sequence [+ + +]
Author: Antheas Kapenekakis <lkml@antheas.dev>
Date:   Wed Aug 26 10:01:53 2026 -0400

    HID: asus: simplify RGB init sequence
    
    [ Upstream commit 56d1b33e644cca1bedffbc73d28778ed4ae30f64 ]
    
    Currently, RGB initialization forks depending on whether a device is
    NKEY. However, in reality both initialization forks are the same, other
    than the NKEY initialization initializing the LED_REPORT_ID1,
    LED_REPORT_ID2 endpoints, and the non-NKEY initialization having a
    functionality check which is skipped for the NKEY path.
    
    Therefore, merge the if blocks, gate the ID1/ID2 initializations
    behind the NKEY quirk instead, and introduce the functionality check
    for NKEY devices (it is supported by them).
    
    There should be no functional change with this patch.
    
    Acked-by: Benjamin Tissoires <bentiss@kernel.org>
    Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
    Link: https://patch.msgid.link/20260122075044.5070-2-lkml@antheas.dev
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Stable-dep-of: 02bf61dfb44f ("HID: asus: fix missing hid_is_usb() check")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

HID: ft260: fix stack-use-after-return write in I2C read race [+ + +]
Author: Raman Varabets <kernel-linux-20260610-80b7ab08@raman.v1.sg>
Date:   Wed Aug 26 11:24:52 2026 -0400

    HID: ft260: fix stack-use-after-return write in I2C read race
    
    [ Upstream commit bf3e39df3a397fd82967a31d17c4e02c7feab221 ]
    
    ft260_i2c_read() points dev->read_buf at a caller-supplied buffer
    (often an on-stack variable), arms a completion and waits up to five
    seconds for the device to return the data. The HID input callback
    ft260_raw_event() runs in the input/IRQ path, independent of the
    dev->lock mutex held by the read path, and copies the device-supplied
    payload into dev->read_buf after a plain NULL check.
    
    These two paths share read_buf, read_idx and read_len with no
    serialization. If the device delays its response until the read
    times out, ft260_i2c_read() resets the controller, clears read_buf
    and returns, unwinding the stack frame the buffer lived in. A
    response that arrives at that moment lets ft260_raw_event() pass the
    NULL check and then memcpy() the device-controlled payload into the
    now-freed stack location, a bounded but attacker-influenced
    stack-use-after-return write triggerable by malicious or
    malfunctioning hardware.
    
    Add a dedicated spinlock that serializes every access to read_buf,
    read_idx and read_len. ft260_raw_event() now holds it across the
    NULL check, the memcpy and the index update, while the read path
    takes it when arming and when clearing the buffer, so the teardown
    can no longer slip between the check and the copy.
    
    Fixes: 6a82582d9fa4 ("HID: ft260: add usb hid to i2c host bridge driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Raman Varabets <kernel-linux-20260610-80b7ab08@raman.v1.sg>
    Reviewed-by: Michael Zaidman <michael.zaidman@gmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

HID: ft260: validate i2c input report length [+ + +]
Author: Michael Zaidman <michael.zaidman@gmail.com>
Date:   Wed Aug 26 11:24:51 2026 -0400

    HID: ft260: validate i2c input report length
    
    [ Upstream commit 80c4bbb2b38513e9c3d84805fa61a0ee16d79c45 ]
    
    Add two checks to ft260_raw_event() to prevent out-of-bounds reads
    from malicious or malfunctioning devices:
    
    First, reject reports shorter than the 2-byte header (report ID +
    length fields). Without this, even accessing xfer->length on a
    1-byte report is an OOB read.
    
    Second, validate xfer->length against the actual data capacity of
    the received HID report. Each I2C data report ID (0xD0 through
    0xDE) defines a different report size in the HID descriptor, so the
    available payload varies per report. A corrupted length field could
    cause memcpy to read beyond the report buffer.
    
    Reported-by: Sebastián Josué Alba Vives <sebasjosue84@gmail.com>
    Signed-off-by: Michael Zaidman <michael.zaidman@gmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Stable-dep-of: bf3e39df3a39 ("HID: ft260: fix stack-use-after-return write in I2C read race")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

HID: magicmouse: prevent unbounded recursion in magicmouse_raw_event() [+ + +]
Author: Jose Villaseñor Montfort <pepemontfort@gmail.com>
Date:   Tue Jul 14 23:35:26 2026 -0600

    HID: magicmouse: prevent unbounded recursion in magicmouse_raw_event()
    
    commit db8d634128d2ba88d79c0b601e983ebe14bb0519 upstream.
    
    magicmouse_raw_event() handles DOUBLE_REPORT_ID (0xf7) packets, which pack
    two touch reports into one, by splitting the packet and calling itself on
    each half. The only guard against runaway recursion is a "size < 1" check,
    which stops zero-sized calls but does not bound the recursion depth.
    
    A malicious HID device that matches this driver can send a report starting
    with DOUBLE_REPORT_ID and filled with the sequence [0xf7, 0x00]. Each level
    consumes two bytes and recurses on the remainder, so an incoming report of
    up to HID_MAX_BUFFER_SIZE (16 KiB) drives roughly 8000 nested calls. That
    easily exhausts the 16 KiB kernel stack, leading to a stack overflow: a
    panic with CONFIG_VMAP_STACK, or memory corruption without it.
    
    A double report only ever wraps two normal reports; it is never
    legitimately nested. Refuse to re-enter the DOUBLE_REPORT_ID case from a
    recursive call so the recursion depth is bounded to two, while all valid
    packets keep being parsed exactly as before.
    
    Fixes: a462230e16ac ("HID: magicmouse: enable Magic Trackpad support")
    Link: https://lore.kernel.org/linux-input/20260706181347.700DB1F00A3F@smtp.kernel.org/
    Cc: stable@vger.kernel.org
    Signed-off-by: Jose Villaseñor Montfort <pepemontfort@gmail.com>
    Reviewed-by: Alec Hall <signshop.alec@gmail.com>
    Tested-by: Alec Hall <signshop.alec@gmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

HID: pidff: clang-format pass [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Wed Aug 26 09:47:14 2026 -0400

    HID: pidff: clang-format pass
    
    [ Upstream commit ae42428fb4e3d2eed344f0d6fcfa778bc8b8f80a ]
    
    Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Stable-dep-of: 67bb1074e3d2 ("HID: pidff: fix OOB write when hid->inputs is empty")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

HID: pidff: fix OOB write when hid->inputs is empty [+ + +]
Author: Baul Lee <baul.lee@xbow.com>
Date:   Wed Aug 26 09:47:15 2026 -0400

    HID: pidff: fix OOB write when hid->inputs is empty
    
    [ Upstream commit 67bb1074e3d2d12fa059a9cc707e89398a4e4704 ]
    
    hid_pidff_init_with_quirks() derives its input_dev from
    
            list_entry(hid->inputs.next, struct hid_input, list)
    
    without first checking that hid->inputs is non-empty.  The list member
    of struct hid_input is at offset 0, so on an empty list list_entry()
    yields &hid->inputs itself and the following hidinput->input load reads
    an unrelated member of struct hid_device.  dev is then a type-confused
    pointer, and force-feedback init writes through it: each
    set_bit(FF_*, dev->ffbit) stores 8 bytes at dev + 192, past the end of
    the object dev actually aliases, and input_ff_create() adds further
    writes of a heap pointer and two function pointers.
    
    Until hid-universal-pidff the only caller was hid_pidff_init() from
    usbhid, which runs under HID_CLAIMED_INPUT and therefore always has at
    least one hid_input.  universal_pidff_probe() starts the device with
    HID_CONNECT_DEFAULT & ~HID_CONNECT_FF and then calls
    hid_pidff_init_with_quirks() directly whenever the descriptor carries a
    PID usage page, bypassing that gate.  A report descriptor whose only
    application collection is on HID_UP_PID leaves hid->inputs empty while
    hid_connect() still succeeds through the hidraw claim, so probe reaches
    the unguarded list_entry().
    
    The write happens in the USB probe path, on the hotplug workqueue, so
    plugging in a malicious device is enough to trigger it; no attacker
    software and no logged-in user are required.  KASAN reports an 8-byte
    out-of-bounds write in hid_pidff_init_with_quirks() reached from
    universal_pidff_probe().
    
    Check for an empty list before deriving dev and return -ENODEV, as the
    other HID force-feedback drivers already do.  universal_pidff_probe()
    propagates the error and unwinds.
    
    Discovered by XBOW, triaged by Baul Lee <baul.lee@xbow.com>
    
    Fixes: f06bf8d94fff ("HID: Add hid-universal-pidff driver and supported device ids")
    Reported-by: Federico Kirschbaum <federico.kirschbaum@xbow.com>
    Reported-by: Baul Lee <baul.lee@xbow.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Baul Lee <baul.lee@xbow.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

HID: pidff: Rework pidff_set_time() to fix warnings [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Wed Aug 26 09:47:12 2026 -0400

    HID: pidff: Rework pidff_set_time() to fix warnings
    
    [ Upstream commit bed72bd240ce77623845853397b89a08f6dc5770 ]
    
    Fixes blank line warning from checkpatch.pl script
    
    Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Stable-dep-of: 67bb1074e3d2 ("HID: pidff: fix OOB write when hid->inputs is empty")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

HID: pidff: Use ARRAY_SIZE macro instead of sizeof [+ + +]
Author: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Date:   Wed Aug 26 09:47:13 2026 -0400

    HID: pidff: Use ARRAY_SIZE macro instead of sizeof
    
    [ Upstream commit 8de2cef6d0de8cdddee8d653a18791525af26fad ]
    
    Could lead to issues when arrays won't be 8 bit fields
    
    Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
    Reviewed-by: Oleg Makarenko <oleg@makarenk.ooo>
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    Stable-dep-of: 67bb1074e3d2 ("HID: pidff: fix OOB write when hid->inputs is empty")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

HID: uclogic: fix use-after-free of inrange_timer on remove [+ + +]
Author: Ibrahim Hashimov <security@auditcode.ai>
Date:   Wed Aug 26 11:33:13 2026 -0400

    HID: uclogic: fix use-after-free of inrange_timer on remove
    
    [ Upstream commit 506fd50a9027340f0e9dcc587d10ccb03312dba6 ]
    
    uclogic_remove() cancels the pen in-range timer and then stops the
    device:
    
            timer_delete_sync(&drvdata->inrange_timer);
            hid_hw_stop(hdev);
    
    timer_delete_sync() only guarantees the timer is idle at that instant.
    uclogic_raw_event_pen() keeps delivering pen reports until hid_hw_stop()
    stops the transport several lines later, and every report with
    pen->inrange == UCLOGIC_PARAMS_PEN_INRANGE_NONE re-arms the timer:
    
            mod_timer(&drvdata->inrange_timer, jiffies + msecs_to_jiffies(100));
    
    A report landing between the timer_delete_sync() call and the transport
    teardown in hid_hw_stop() re-arms inrange_timer after it was cancelled.
    uclogic_remove() then returns and the devm drvdata is freed, while
    hid_hw_stop() has already freed the input device drvdata->pen_input
    points at, so when the timer fires ~100 ms later
    uclogic_inrange_timeout() dereferences freed memory -- a use-after-free
    in timer-softirq context.
    
    Swapping the two calls is not a fix: stopping the device first frees
    drvdata->pen_input via hidinput_disconnect() while the timer may still
    be pending, so a timer already armed before removal fires on the freed
    input device in the window before timer_delete_sync() runs.
    
    Use timer_shutdown_sync() before hid_hw_stop() instead. It cancels the
    timer, waits for a running callback while pen_input is still valid, and
    prevents any further re-arming -- a later mod_timer() from an in-flight
    report is silently ignored -- so the timer is provably dead before
    hid_hw_stop() frees the inputs. This is the ordering the timer core
    documents for this "timer re-armed from another path" teardown case.
    
    Fixes: 01309e29eb95 ("HID: uclogic: Support in-range reporting emulation")
    Cc: stable@vger.kernel.org
    Signed-off-by: Ibrahim Hashimov <security@auditcode.ai>
    Assisted-by: AuditCode-AI:2026.07
    Signed-off-by: Jiri Kosina <jkosina@suse.com>
    [ changed timer_delete_sync() to del_timer_sync() in the removed line to match the pre-rename API on this branch ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

HID: uhid: convert to hid_safe_input_report() [+ + +]
Author: Carlos Llamas <cmllamas@google.com>
Date:   Thu Aug 27 22:04:27 2026 +0000

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

 
ibmvnic: Use kernel helpers for hex dumps [+ + +]
Author: Nick Child <nnac123@linux.ibm.com>
Date:   Thu Mar 20 16:29:51 2025 -0500

    ibmvnic: Use kernel helpers for hex dumps
    
    [ Upstream commit d93a6caab5d7d9b5ce034d75b1e1e993338e3852 ]
    
    Previously, when the driver was printing hex dumps, the buffer was cast
    to an 8 byte long and printed using string formatters. If the buffer
    size was not a multiple of 8 then a read buffer overflow was possible.
    
    Therefore, create a new ibmvnic function that loops over a buffer and
    calls hex_dump_to_buffer instead.
    
    This patch address KASAN reports like the one below:
      ibmvnic 30000003 env3: Login Buffer:
      ibmvnic 30000003 env3: 01000000af000000
      <...>
      ibmvnic 30000003 env3: 2e6d62692e736261
      ibmvnic 30000003 env3: 65050003006d6f63
      ==================================================================
      BUG: KASAN: slab-out-of-bounds in ibmvnic_login+0xacc/0xffc [ibmvnic]
      Read of size 8 at addr c0000001331a9aa8 by task ip/17681
      <...>
      Allocated by task 17681:
      <...>
      ibmvnic_login+0x2f0/0xffc [ibmvnic]
      ibmvnic_open+0x148/0x308 [ibmvnic]
      __dev_open+0x1ac/0x304
      <...>
      The buggy address is located 168 bytes inside of
                    allocated 175-byte region [c0000001331a9a00, c0000001331a9aaf)
      <...>
      =================================================================
      ibmvnic 30000003 env3: 000000000033766e
    
    Fixes: 032c5e82847a ("Driver for IBM System i/p VNIC protocol")
    Signed-off-by: Nick Child <nnac123@linux.ibm.com>
    Reviewed-by: Dave Marquardt <davemarq@linux.ibm.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20250320212951.11142-1-nnac123@linux.ibm.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
io_uring/io-wq: fix worker accounting when canceling creation callbacks [+ + +]
Author: Vishnu Razdan <vrazdan@openai.com>
Date:   Tue Aug 25 09:52:03 2026 -0700

    io_uring/io-wq: fix worker accounting when canceling creation callbacks
    
    commit 297b5ccea4acacaa47c150f043bce695202afbf1 upstream.
    
    create_worker_cb() reserves an io-wq worker slot only after its
    task-work callback runs. If the callback is canceled before then,
    io_worker_cancel_cb() still decrements acct->nr_workers. When an
    existing worker retires with its creation callback pending, that
    worker has already decremented the same account's worker count.
    
    The resulting undercount permits worker creation beyond the account's
    configured limit. On an AST2600 OpenBMC system, an unchanged sensor
    daemon reached 4,291 threads with the original kernel. With an
    equivalent downstream fix, 25 passive samples under its normal
    workload showed 6-9 threads.
    
    Decrement nr_workers only when the canceled callback is not
    create_worker_cb(). Continuation callbacks still release their reserved
    slot, and both callback types retain the existing running-count,
    reference-count, and create-state cleanup.
    
    [ Backport: retain the existing wq->lock protecting worker accounting. ]
    
    Fixes: 1d5f5ea7cb7d ("io-wq: remove worker to owner tw dependency")
    Cc: stable@vger.kernel.org
    Assisted-by: Codex:gpt-5.6-sol
    Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de>
    Link: https://patch.msgid.link/20260811-vrazdan-io-wq-b4-submit-v1-1-719ced16c921@openai.com
    Signed-off-by: Vishnu Razdan <vrazdan@openai.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ipv6: seg6: clear IPv4 control block on IPIP decapsulation [+ + +]
Author: Kyle Zeng <kylebot@openai.com>
Date:   Mon Aug 17 08:58:38 2026 +0000

    ipv6: seg6: clear IPv4 control block on IPIP decapsulation
    
    commit 44930446dde45a7a90fe1446fa38eb0e2c561646 upstream.
    
    End.DX4 and End.DT4 decapsulate an IPv4 packet through
    decap_and_validate() and send it directly to IPv4 routing. The inner
    packet therefore bypasses ip_rcv_core(), which normally clears IPCB
    before IPv4 interprets skb->cb.
    
    The skb instead retains IP6CB data from the outer packet. IP6CB and
    IPCB use the same skb->cb storage, so IP6CB(skb)->lastopt overlaps
    IPCB(skb)->opt.optlen and srr, while IP6CB(skb)->nhoff overlaps rr and
    ts.
    
    The sender can make the stale optlen byte nonzero with a valid outer
    extension-header chain. The reproducers put an eight-byte Destination
    Options header immediately after the 40-byte IPv6 header and before the
    Segment Routing Header. ipv6_destopt_rcv() records the sender-controlled
    Destination Options offset in both lastopt and nhoff, setting them to
    40. On the reproduced little-endian x86-64 kernel, IPv4 therefore sees
    optlen = 40 and rr = 40.
    
    Both tcp_v4_save_options() and __ip_options_echo() skip option copying
    when optlen is zero. Here optlen is 40, so the TCP SYN path allocates
    room for 40 bytes of option data and calls __ip_options_echo(). The
    stale rr value makes that function read inner packet byte 41 as the
    Record Route option length. The reproducers set that sender-controlled
    byte to 255, so __ip_options_echo() copies 255 bytes into the 40-byte
    option-data area.
    
    Separate End.DX4 and End.DT4 reproducers on the unpatched v7.2-rc5
    kernel both produced:
    
      BUG: KASAN: slab-out-of-bounds in __ip_options_echo()
      Write of size 255
    
    The relevant End.DX4 call path is:
    
      __ip_options_echo
      tcp_v4_route_req
      tcp_conn_request
      tcp_v4_conn_request
      tcp_rcv_state_process
      tcp_v4_do_rcv
      tcp_v4_rcv
      ip_protocol_deliver_rcu
      ip_local_deliver_finish
      ip_local_deliver
      input_action_end_dx4_finish
      input_action_end_dx4
    
    The relevant End.DT4 call path is:
    
      __ip_options_echo
      tcp_v4_route_req
      tcp_conn_request
      tcp_v4_conn_request
      tcp_rcv_state_process
      tcp_v4_do_rcv
      tcp_v4_rcv
      ip_protocol_deliver_rcu
      ip_local_deliver_finish
      ip_local_deliver
      input_action_end_dt4
    
    tcp_v4_save_options() is inlined into the tcp_v4_route_req() path, so
    it does not appear as a separate frame.
    
    When decap_and_validate() handles IPPROTO_IPIP, save the ingress
    interface from IP6CB, clear IPCB, and restore the saved value. Doing
    this in the common decapsulation path covers End.DX4, End.DT4, and
    End.DT46's IPv4 arm.
    
    Use IP6CB(skb)->iif rather than skb->skb_iif. These actions run after
    l3mdev processing, which can replace skb_iif with the L3 master;
    IP6CB iif still records the receiving interface set at IPv6 ingress.
    
    Fixes: 891ef8dd2a8d ("ipv6: sr: implement additional seg6local actions")
    Cc: stable@vger.kernel.org
    Suggested-by: Andrea Mayer <andrea.mayer@uniroma2.it>
    Signed-off-by: Kyle Zeng <kylebot@openai.com>
    Co-developed-by: David Lee <david.lee@trailofbits.com>
    Signed-off-by: David Lee <david.lee@trailofbits.com>
    Reviewed-by: Andrea Mayer <andrea.mayer@uniroma2.it>
    Link: https://patch.msgid.link/20260817085839.946321-1-david.lee@trailofbits.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
jfs: add check read-only before truncation in jfs_truncate_nolock() [+ + +]
Author: Vasiliy Kovalev <kovalev@altlinux.org>
Date:   Tue Dec 24 17:49:14 2024 +0300

    jfs: add check read-only before truncation in jfs_truncate_nolock()
    
    [ Upstream commit b5799dd77054c1ec49b0088b006c9908e256843b ]
    
    Added a check for "read-only" mode in the `jfs_truncate_nolock`
    function to avoid errors related to writing to a read-only
    filesystem.
    
    Call stack:
    
    block_write_begin() {
      jfs_write_failed() {
        jfs_truncate() {
          jfs_truncate_nolock() {
            txEnd() {
              ...
              log = JFS_SBI(tblk->sb)->log;
              // (log == NULL)
    
    If the `isReadOnly(ip)` condition is triggered in
    `jfs_truncate_nolock`, the function execution will stop, and no
    further data modification will occur. Instead, the `xtTruncate`
    function will be called with the "COMMIT_WMAP" flag, preventing
    modifications in "read-only" mode.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: syzbot+4e89b5368baba8324e07@syzkaller.appspotmail.com
    Link: https://syzkaller.appspot.com/bug?extid=4e89b5368baba8324e07
    Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
    Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

jfs: add check read-only before txBeginAnon() call [+ + +]
Author: Vasiliy Kovalev <kovalev@altlinux.org>
Date:   Tue Dec 24 17:49:13 2024 +0300

    jfs: add check read-only before txBeginAnon() call
    
    [ Upstream commit 0176e69743ecc02961f2ae1ea42439cd2bf9ed58 ]
    
    Added a read-only check before calling `txBeginAnon` in `extAlloc`
    and `extRecord`. This prevents modification attempts on a read-only
    mounted filesystem, avoiding potential errors or crashes.
    
    Call trace:
     txBeginAnon+0xac/0x154
     extAlloc+0xe8/0xdec fs/jfs/jfs_extent.c:78
     jfs_get_block+0x340/0xb98 fs/jfs/inode.c:248
     __block_write_begin_int+0x580/0x166c fs/buffer.c:2128
     __block_write_begin fs/buffer.c:2177 [inline]
     block_write_begin+0x98/0x11c fs/buffer.c:2236
     jfs_write_begin+0x44/0x88 fs/jfs/inode.c:299
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: syzbot+4e89b5368baba8324e07@syzkaller.appspotmail.com
    Link: https://syzkaller.appspot.com/bug?extid=4e89b5368baba8324e07
    Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
    Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

jfs: Fix null-ptr-deref in jfs_ioc_trim [+ + +]
Author: Dylan Wolff <wolffd@comp.nus.edu.sg>
Date:   Wed Mar 12 16:02:00 2025 +0800

    jfs: Fix null-ptr-deref in jfs_ioc_trim
    
    [ Upstream commit a4685408ff6c3e2af366ad9a7274f45ff3f394ee ]
    
    [ Syzkaller Report ]
    
    Oops: general protection fault, probably for non-canonical address
    0xdffffc0000000087: 0000 [#1
    KASAN: null-ptr-deref in range [0x0000000000000438-0x000000000000043f]
    CPU: 2 UID: 0 PID: 10614 Comm: syz-executor.0 Not tainted
    6.13.0-rc6-gfbfd64d25c7a-dirty #1
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
    Sched_ext: serialise (enabled+all), task: runnable_at=-30ms
    RIP: 0010:jfs_ioc_trim+0x34b/0x8f0
    Code: e7 e8 59 a4 87 fe 4d 8b 24 24 4d 8d bc 24 38 04 00 00 48 8d 93
    90 82 fe ff 4c 89 ff 31 f6
    RSP: 0018:ffffc900055f7cd0 EFLAGS: 00010206
    RAX: 0000000000000087 RBX: 00005866a9e67ff8 RCX: 000000000000000a
    RDX: 0000000000000001 RSI: 0000000000000004 RDI: 0000000000000001
    RBP: dffffc0000000000 R08: ffff88807c180003 R09: 1ffff1100f830000
    R10: dffffc0000000000 R11: ffffed100f830001 R12: 0000000000000000
    R13: 0000000000000000 R14: 0000000000000001 R15: 0000000000000438
    FS:  00007fe520225640(0000) GS:ffff8880b7e80000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00005593c91b2c88 CR3: 000000014927c000 CR4: 00000000000006f0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
    <TASK>
    ? __die_body+0x61/0xb0
    ? die_addr+0xb1/0xe0
    ? exc_general_protection+0x333/0x510
    ? asm_exc_general_protection+0x26/0x30
    ? jfs_ioc_trim+0x34b/0x8f0
    jfs_ioctl+0x3c8/0x4f0
    ? __pfx_jfs_ioctl+0x10/0x10
    ? __pfx_jfs_ioctl+0x10/0x10
    __se_sys_ioctl+0x269/0x350
    ? __pfx___se_sys_ioctl+0x10/0x10
    ? do_syscall_64+0xfb/0x210
    do_syscall_64+0xee/0x210
    ? syscall_exit_to_user_mode+0x1e0/0x330
    entry_SYSCALL_64_after_hwframe+0x77/0x7f
    RIP: 0033:0x7fe51f4903ad
    Code: c3 e8 a7 2b 00 00 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 89 f8 48
    89 f7 48 89 d6 48 89 ca 4d
    RSP: 002b:00007fe5202250c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
    RAX: ffffffffffffffda RBX: 00007fe51f5cbf80 RCX: 00007fe51f4903ad
    RDX: 0000000020000680 RSI: 00000000c0185879 RDI: 0000000000000005
    RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000246 R12: 00007fe520225640
    R13: 000000000000000e R14: 00007fe51f44fca0 R15: 00007fe52021d000
    </TASK>
    Modules linked in:
    ---[ end trace 0000000000000000 ]---
    RIP: 0010:jfs_ioc_trim+0x34b/0x8f0
    Code: e7 e8 59 a4 87 fe 4d 8b 24 24 4d 8d bc 24 38 04 00 00 48 8d 93
    90 82 fe ff 4c 89 ff 31 f6
    RSP: 0018:ffffc900055f7cd0 EFLAGS: 00010206
    RAX: 0000000000000087 RBX: 00005866a9e67ff8 RCX: 000000000000000a
    RDX: 0000000000000001 RSI: 0000000000000004 RDI: 0000000000000001
    RBP: dffffc0000000000 R08: ffff88807c180003 R09: 1ffff1100f830000
    R10: dffffc0000000000 R11: ffffed100f830001 R12: 0000000000000000
    R13: 0000000000000000 R14: 0000000000000001 R15: 0000000000000438
    FS:  00007fe520225640(0000) GS:ffff8880b7e80000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00005593c91b2c88 CR3: 000000014927c000 CR4: 00000000000006f0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Kernel panic - not syncing: Fatal exception
    
    [ Analysis ]
    
    We believe that we have found a concurrency bug in the `fs/jfs` module
    that results in a null pointer dereference. There is a closely related
    issue which has been fixed:
    
    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d6c1b3599b2feb5c7291f5ac3a36e5fa7cedb234
    
    ... but, unfortunately, the accepted patch appears to still be
    susceptible to a null pointer dereference under some interleavings.
    
    To trigger the bug, we think that `JFS_SBI(ipbmap->i_sb)->bmap` is set
    to NULL in `dbFreeBits` and then dereferenced in `jfs_ioc_trim`. This
    bug manifests quite rarely under normal circumstances, but is
    triggereable from a syz-program.
    
    Reported-and-tested-by: Dylan J. Wolff<wolffd@comp.nus.edu.sg>
    Reported-and-tested-by: Jiacheng Xu <stitch@zju.edu.cn>
    Signed-off-by: Dylan J. Wolff<wolffd@comp.nus.edu.sg>
    Signed-off-by: Jiacheng Xu <stitch@zju.edu.cn>
    Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ksmbd: harden file lifetime during session teardown [+ + +]
Author: DaeMyung Kang <charsyam@gmail.com>
Date:   Tue Apr 28 23:08:55 2026 +0900

    ksmbd: harden file lifetime during session teardown
    
    commit a42896bebfcc287ed1e61d820a888e33b1eb80ce upstream.
    
    __close_file_table_ids() is the per-session teardown that closes every
    fp belonging to a session (or to one tree connect on that session) by
    walking the session's volatile-id idr.  The current loop has three
    related problems on busy or racing workloads:
    
      * Sleeping under ft->lock.  The session-teardown skip callback,
        session_fd_check(), already sleeps in ksmbd_vfs_copy_durable_owner()
        -> kstrdup(GFP_KERNEL) and down_write(&fp->f_ci->m_lock) (a
        rw_semaphore).  Running the callback inside write_lock(&ft->lock)
        trips CONFIG_DEBUG_ATOMIC_SLEEP / CONFIG_PROVE_LOCKING on a
        durable-fd workload.
    
      * Refcount accounting blind to f_state.  The unconditional
        atomic_dec_and_test(&fp->refcount) does not distinguish
        FP_INITED (idr-owned reference still intact) from FP_CLOSED (an
        earlier ksmbd_close_fd() already consumed the idr-owned reference
        while leaving fp in the idr because a holder kept refcount
        non-zero).  When the latter races with teardown the same path
        over-decrements into a holder reference and ksmbd_fd_put() later
        UAFs that holder.
    
      * FP_NEW window.  Between __open_id() publishing fp into the
        session idr and ksmbd_update_fstate(..., FP_INITED) committing the
        transition at the end of smb2_open(), an fp is in FP_NEW and an
        intervening teardown that takes a transient reference and
        unpublishes the volatile id leaves the original idr-owned
        reference orphaned -- the opener is unaware that fp has been
        unpublished, returns success to the client, and the fp leaks at
        refcount = 1.
    
    Refactor __close_file_table_ids() to take a transient reference on fp
    and unpublish fp from the session idr *under ft->lock* before calling
    skip() outside the lock.  A transient ref protects lifetime but not
    concurrent field mutation, so the idr_remove() is what keeps
    __ksmbd_lookup_fd() through this session's idr from granting a new
    ksmbd_fp_get() reference to an fp whose fp->conn / fp->tcon /
    fp->volatile_id / op->conn / lock_list links are about to be rewritten
    by session_fd_check().  Durable reconnect is unaffected because it
    reaches fp through the global durable table (ksmbd_lookup_durable_fd
    -> global_ft).
    
    Decide n_to_drop together with any FP_INITED -> FP_CLOSED transition
    under ft->lock so teardown and ksmbd_close_fd() never both consume the
    idr-owned reference.  See ksmbd_mark_fp_closed() for the per-state
    accounting.  For the FP_NEW path to be safe, the opener has to learn
    that fp was unpublished: ksmbd_update_fstate() now returns -ENOENT
    when an FP_NEW -> FP_INITED transition finds f_state already advanced
    or the volatile id cleared (both committed by teardown under
    ft->lock); smb2_open() propagates that as STATUS_OBJECT_NAME_INVALID
    and drops the original reference via ksmbd_fd_put().
    
    The list removal cannot be left for a deferred final putter because
    fp->volatile_id has already been cleared and __ksmbd_remove_fd() will
    intentionally skip both idr_remove() and list_del_init().  Move the
    m_fp_list unlink in __ksmbd_remove_fd() above the volatile-id check so
    that an FP_NEW fp that happened to be added to m_fp_list (smb2_open()
    adds fp->node before ksmbd_update_fstate() runs) is still cleaned up
    on the deferred putter path; list_del_init() on an empty node is a
    no-op and remains safe for fps that were never added.
    
    Add a defensive guard in session_fd_check() that refuses non-FP_INITED
    fps so that even if a teardown reaches an FP_NEW fp it falls into the
    close branch (where the n_to_drop = 1 accounting keeps the opener's
    reference alive) instead of the durable-preserve branch (which mutates
    fp->conn / fp->tcon).
    
    Validation on a debug kernel additionally built with CONFIG_DEBUG_LIST
    and CONFIG_DEBUG_OBJECTS_WORK used a same-session two-tcon workload
    (open/write storm on one tcon, 50 tree disconnects on the other) and
    reported no list-corruption, work_struct ODEBUG, sleep-in-atomic,
    lockdep or kmemleak reports.  Reverting only the
    __close_file_table_ids() hunk while keeping a forced-is_reconnectable()
    harness produced the expected sleep-in-atomic at vfs_cache.c:1095,
    confirming the ft->lock-out-of-sleepable-skip discipline.
    
    KASAN-enabled direct SMB2 coverage with durable handles enabled
    exercised ksmbd_close_tree_conn_fds(), ksmbd_close_session_fds(),
    the FP_NEW failure path, tree_conn_fd_check(), and a non-zero
    session_fd_check() durable-preserve return.  This produced no KASAN,
    DEBUG_LIST, ODEBUG, or WARNING reports.
    
    Fixes: f44158485826 ("cifsd: add file operations")
    Signed-off-by: DaeMyung Kang <charsyam@gmail.com>
    Acked-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
KVM: arm64: Prevent access to vCPU events before init [+ + +]
Author: Oliver Upton <oupton@kernel.org>
Date:   Tue Sep 30 01:52:37 2025 -0700

    KVM: arm64: Prevent access to vCPU events before init
    
    [ Upstream commit 0aa1b76fe1429629215a7c79820e4b96233ac4a3 ]
    
    Another day, another syzkaller bug. KVM erroneously allows userspace to
    pend vCPU events for a vCPU that hasn't been initialized yet, leading to
    KVM interpreting a bunch of uninitialized garbage for routing /
    injecting the exception.
    
    In one case the injection code and the hyp disagree on whether the vCPU
    has a 32bit EL1 and put the vCPU into an illegal mode for AArch64,
    tripping the BUG() in exception_target_el() during the next injection:
    
      kernel BUG at arch/arm64/kvm/inject_fault.c:40!
      Internal error: Oops - BUG: 00000000f2000800 [#1]  SMP
      CPU: 3 UID: 0 PID: 318 Comm: repro Not tainted 6.17.0-rc4-00104-g10fd0285305d #6 PREEMPT
      Hardware name: linux,dummy-virt (DT)
      pstate: 21402009 (nzCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--)
      pc : exception_target_el+0x88/0x8c
      lr : pend_serror_exception+0x18/0x13c
      sp : ffff800082f03a10
      x29: ffff800082f03a10 x28: ffff0000cb132280 x27: 0000000000000000
      x26: 0000000000000000 x25: ffff0000c2a99c20 x24: 0000000000000000
      x23: 0000000000008000 x22: 0000000000000002 x21: 0000000000000004
      x20: 0000000000008000 x19: ffff0000c2a99c20 x18: 0000000000000000
      x17: 0000000000000000 x16: 0000000000000000 x15: 00000000200000c0
      x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000
      x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000
      x8 : ffff800082f03af8 x7 : 0000000000000000 x6 : 0000000000000000
      x5 : ffff800080f621f0 x4 : 0000000000000000 x3 : 0000000000000000
      x2 : 000000000040009b x1 : 0000000000000003 x0 : ffff0000c2a99c20
      Call trace:
       exception_target_el+0x88/0x8c (P)
       kvm_inject_serror_esr+0x40/0x3b4
       __kvm_arm_vcpu_set_events+0xf0/0x100
       kvm_arch_vcpu_ioctl+0x180/0x9d4
       kvm_vcpu_ioctl+0x60c/0x9f4
       __arm64_sys_ioctl+0xac/0x104
       invoke_syscall+0x48/0x110
       el0_svc_common.constprop.0+0x40/0xe0
       do_el0_svc+0x1c/0x28
       el0_svc+0x34/0xf0
       el0t_64_sync_handler+0xa0/0xe4
       el0t_64_sync+0x198/0x19c
      Code: f946bc01 b4fffe61 9101e020 17fffff2 (d4210000)
    
    Reject the ioctls outright as no sane VMM would call these before
    KVM_ARM_VCPU_INIT anyway. Even if it did the exception would've been
    thrown away by the eventual reset of the vCPU's state.
    
    Cc: stable@vger.kernel.org # 6.17
    Fixes: b7b27facc7b5 ("arm/arm64: KVM: Add KVM_GET/SET_VCPU_EVENTS")
    Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

KVM: s390: vsie: zero stale crypto bits [+ + +]
Author: Christian Borntraeger <borntraeger@linux.ibm.com>
Date:   Tue Aug 11 17:37:36 2026 +0200

    KVM: s390: vsie: zero stale crypto bits
    
    commit 34d5b5b646c91cfb9338d7a12c955a70ffb8c66b upstream.
    
    When shadowing crypto access bits from a format0 apcb (crycb 0 or 1),
    the bits 64..255 are unchanged from whatever is in the vsie page in the
    crycb and thus in the apcb. This gives a nested guest potential access
    to a device no longer available. Zero out the remaining bits.
    
    Fixes: 6b79de4b056e ("KVM: s390: vsie: allow guest FORMAT-1 CRYCB on host FORMAT-2")
    Cc: stable@vger.kernel.org
    Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
    Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
    Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
    Message-ID: <20260811153738.206885-3-borntraeger@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

KVM: x86/mmu: Check write tracking in all address spaces [+ + +]
Author: Jinu Kim <kimjw04271234@gmail.com>
Date:   Tue Jul 21 19:35:11 2026 +0900

    KVM: x86/mmu: Check write tracking in all address spaces
    
    [ Upstream commit 0f38453cdb2e17566ccb7c0f3dabd5bd21caca26 ]
    
    kvm_gfn_is_write_tracked() checks only the supplied memslot, but page
    tracking is per-address-space and shadow pages are shared across all
    address spaces.  With SMM, a GFN can therefore be write-tracked in one
    address space and appear untracked through the other.
    
    Check the supplied slot first, then the slot for the other address space.
    This ensures all callers honor write tracking regardless of the active
    address space.  In particular, it prevents mmu_try_to_unsync_pages() from
    marking an upper-level shadow page unsync and eventually triggering the
    BUG in pte_list_remove().
    
    Fixes: 699023e23965 ("KVM: x86: add SMM to the MMU role, support SMRAM address space")
    Assisted-by: Codex:GPT-5
    Signed-off-by: Jinu Kim <kimjw04271234@gmail.com>
    Message-ID: <20260721103512.2136240-2-kimjw04271234@gmail.com>
    [invert direction of the conditional. - Paolo]
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
Linux: Linux 6.12.108 [+ + +]
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Wed Sep 2 14:31:02 2026 +0200

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

 
media: platform: exynos4-is: Add hardware sync wait to fimc_is_hw_change_mode() [+ + +]
Author: Wentao Liang <vulab@iscas.ac.cn>
Date:   Tue Apr 22 10:13:45 2025 +0800

    media: platform: exynos4-is: Add hardware sync wait to fimc_is_hw_change_mode()
    
    [ Upstream commit bd9f6ce7d512fa21249415c16af801a4ed5d97b6 ]
    
    In fimc_is_hw_change_mode(), the function changes camera modes without
    waiting for hardware completion, risking corrupted data or system hangs
    if subsequent operations proceed before the hardware is ready.
    
    Add fimc_is_hw_wait_intmsr0_intmsd0() after mode configuration, ensuring
    hardware state synchronization and stable interrupt handling.
    
    Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
mISDN: hfcpci: Fix warning when deleting uninitialized timer [+ + +]
Author: Vladimir Riabchun <ferr.lambarginio@gmail.com>
Date:   Fri Aug 22 20:11:36 2025 +0200

    mISDN: hfcpci: Fix warning when deleting uninitialized timer
    
    [ Upstream commit 97766512a9951b9fd6fc97f1b93211642bb0b220 ]
    
    With CONFIG_DEBUG_OBJECTS_TIMERS unloading hfcpci module leads
    to the following splat:
    
    [  250.215892] ODEBUG: assert_init not available (active state 0) object: ffffffffc01a3dc0 object type: timer_list hint: 0x0
    [  250.217520] WARNING: CPU: 0 PID: 233 at lib/debugobjects.c:612 debug_print_object+0x1b6/0x2c0
    [  250.218775] Modules linked in: hfcpci(-) mISDN_core
    [  250.219537] CPU: 0 UID: 0 PID: 233 Comm: rmmod Not tainted 6.17.0-rc2-g6f713187ac98 #2 PREEMPT(voluntary)
    [  250.220940] Hardware name: QEMU Ubuntu 24.04 PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
    [  250.222377] RIP: 0010:debug_print_object+0x1b6/0x2c0
    [  250.223131] Code: fc ff df 48 89 fa 48 c1 ea 03 80 3c 02 00 75 4f 41 56 48 8b 14 dd a0 4e 01 9f 48 89 ee 48 c7 c7 20 46 01 9f e8 cb 84d
    [  250.225805] RSP: 0018:ffff888015ea7c08 EFLAGS: 00010286
    [  250.226608] RAX: 0000000000000000 RBX: 0000000000000005 RCX: ffffffff9be93a95
    [  250.227708] RDX: 1ffff1100d945138 RSI: 0000000000000008 RDI: ffff88806ca289c0
    [  250.228993] RBP: ffffffff9f014a00 R08: 0000000000000001 R09: ffffed1002bd4f39
    [  250.230043] R10: ffff888015ea79cf R11: 0000000000000001 R12: 0000000000000001
    [  250.231185] R13: ffffffff9eea0520 R14: 0000000000000000 R15: ffff888015ea7cc8
    [  250.232454] FS:  00007f3208f01540(0000) GS:ffff8880caf5a000(0000) knlGS:0000000000000000
    [  250.233851] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [  250.234856] CR2: 00007f32090a7421 CR3: 0000000004d63000 CR4: 00000000000006f0
    [  250.236117] Call Trace:
    [  250.236599]  <TASK>
    [  250.236967]  ? trace_irq_enable.constprop.0+0xd4/0x130
    [  250.237920]  debug_object_assert_init+0x1f6/0x310
    [  250.238762]  ? __pfx_debug_object_assert_init+0x10/0x10
    [  250.239658]  ? __lock_acquire+0xdea/0x1c70
    [  250.240369]  __try_to_del_timer_sync+0x69/0x140
    [  250.241172]  ? __pfx___try_to_del_timer_sync+0x10/0x10
    [  250.242058]  ? __timer_delete_sync+0xc6/0x120
    [  250.242842]  ? lock_acquire+0x30/0x80
    [  250.243474]  ? __timer_delete_sync+0xc6/0x120
    [  250.244262]  __timer_delete_sync+0x98/0x120
    [  250.245015]  HFC_cleanup+0x10/0x20 [hfcpci]
    [  250.245704]  __do_sys_delete_module+0x348/0x510
    [  250.246461]  ? __pfx___do_sys_delete_module+0x10/0x10
    [  250.247338]  do_syscall_64+0xc1/0x360
    [  250.247924]  entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
    Fix this by initializing hfc_tl timer with DEFINE_TIMER macro.
    Also, use mod_timer instead of manual timeout update.
    
    Fixes: 87c5fa1bb426 ("mISDN: Add different different timer settings for hfc-pci")
    Fixes: 175302f6b79e ("mISDN: hfcpci: Fix use-after-free bug in hfcpci_softirq")
    Signed-off-by: Vladimir Riabchun <ferr.lambarginio@gmail.com>
    Link: https://patch.msgid.link/aKiy2D_LiWpQ5kXq@vova-pc
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
mm/swap: reject swapon() on filesystem-level encrypted files [+ + +]
Author: Eric Biggers <ebiggers@kernel.org>
Date:   Mon Aug 3 11:04:26 2026 -0700

    mm/swap: reject swapon() on filesystem-level encrypted files
    
    commit c310a8932a3107c9bc8f01d473e9d085f8aa9c98 upstream.
    
    ext4 and f2fs don't prevent filesystem-level encrypted files from being
    set up directly as swap files.  In this case, encryption is bypassed.
    
    No one should be doing this, vs.  the methods of encrypted swap that
    actually do work (such as swapping to a dm-crypt device, or swapping to a
    loopback device on top of a filesystem-level encrypted file).
    
    Nevertheless, to prevent user error, make swapon() explicitly reject this
    case.  Document this behavior in fscrypt.rst as well.
    
    Link: https://lore.kernel.org/20260803180426.3123-1-ebiggers@kernel.org
    Fixes: 9bd8212f981e ("ext4 crypto: add encryption policy and password salt support")
    Fixes: f424f664f0e8 ("f2fs crypto: add encryption policy and password salt support")
    Signed-off-by: Eric Biggers <ebiggers@kernel.org>
    Reviewed-by: Baoquan He <baoquan.he@linux.dev>
    Reviewed-by: Muhammad Usama Anjum <usama.anjum@arm.com>
    Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
    Cc: Barry Song <baohua@kernel.org>
    Cc: Chris Li <chrisl@kernel.org>
    Cc: Kairui Song <kasong@tencent.com>
    Cc: Kemeng Shi <shikemeng@huaweicloud.com>
    Cc: Nhat Pham <nphamcs@gmail.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
net/tcp-ao: fix use-after-free of current_key on reconnect to another peer [+ + +]
Author: Hyunwoo Kim <imv4bel@gmail.com>
Date:   Mon Aug 17 06:28:42 2026 +0900

    net/tcp-ao: fix use-after-free of current_key on reconnect to another peer
    
    commit da4471557f279d0f56605158a625bb6e49ef7d41 upstream.
    
    tcp_inbound_ao_hash() is called before bh_lock_sock_nested() is taken,
    with only rcu_read_lock() held. On the fast path for established
    sockets, if the rnext_keyid sent by the peer differs from
    current_key->sndid, the key the peer asked for is looked up and stored
    in current_key. The lookup is inside the RCU read side, but current_key
    outlives it.
    
    When the socket is disconnected and connect() is called again for
    another peer, tcp_ao_connect_init() unlinks every key that does not
    match the new peer and frees it with call_rcu(). If current_key points
    at such a key, it is cleared to NULL.
    
    The fast path reads sk_state only once on entry, so a softirq that got
    into it while the socket was still established can update current_key
    after that loop has already run. The update is inside the RCU read side,
    so it comes before the call_rcu() callback, and once the callback frees
    the key, current_key is left pointing at freed memory.
    
    The next transmission picks that pointer up in tcp_get_current_key().
    tcp_ao_transmit_skb() then reads the traffic key from the freed object,
    which is the use-after-free.
    
    Wait for one grace period before unlinking, and only if a key is going
    to be removed. By the time tcp_connect() runs the socket is already in
    TCP_SYN_SENT, and TCP_AO_ESTABLISHED does not contain TCPF_SYN_SENT, so
    a softirq entering after the wait cannot reach the fast path, and the
    ones already in it have finished. The existing NULL handling in the loop
    is then enough.
    
    Fixes: 0a3a809089eb ("net/tcp: Verify inbound TCP-AO signed segments")
    Cc: stable@vger.kernel.org
    Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Acked-by: Paolo Abeni <pabeni@redhat.com>
    Link: https://patch.msgid.link/aoIriv3pHDgII2YR@v4bel
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
net/tcp: fix TCP-AO key deletion in VRFs [+ + +]
Author: Rastislav Szabo <rastislav.szabo@isovalent.com>
Date:   Sat Aug 22 22:11:18 2026 +0200

    net/tcp: fix TCP-AO key deletion in VRFs
    
    commit 94ad9e114a1c7b16ea418c1456ac3835e038ab3f upstream.
    
    TCP-AO keys with TCP_AO_KEYF_IFINDEX store the VRF L3 interface index in
    l3index. tcp_ao_del_cmd() validates the supplied ifindex, but does not
    assign it to its local l3index before matching keys.
    
    As a result, deleting a key scoped to a non-default VRF always fails with
    ENOENT because it is matched against l3index 0.
    
    Fixes: 248411b8cb89 ("net/tcp: Wire up l3index to TCP-AO")
    Cc: stable@vger.kernel.org
    Signed-off-by: Rastislav Szabo <rastislav.szabo@isovalent.com>
    Reviewed-by: David Ahern <dsahern@kernel.org>
    Acked-by: Dmitry Safonov <0x7f454c46@gmail.com>
    Link: https://patch.msgid.link/20260822201119.272269-1-rastislav.szabo@isovalent.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
net: bridge: mcast: fix use-after-free of a master VLAN's multicast context [+ + +]
Author: Norbert Szetei <norbert@doyensec.com>
Date:   Wed Aug 26 11:12:27 2026 +0200

    net: bridge: mcast: fix use-after-free of a master VLAN's multicast context
    
    commit 50e5c6605cc9c2dd57bd2d1b3459674d19738983 upstream.
    
    br_multicast_toggle_one_vlan() clears BR_VLFLAG_MCAST_ENABLED under
    br->multicast_lock before stopping a VLAN's multicast context.  That is
    the teardown handshake: lockless readers gate on the flag through
    br_multicast_ctx_should_use() -> br_multicast_ctx_vlan_disabled(), so
    once it is cleared under the lock no reader can arm the context again.
    
    For a master VLAN the handshake never runs.  __vlan_del() clears
    BRIDGE_VLAN_INFO_BRENTRY before calling br_vlan_put_master(), so
    br_multicast_toggle_one_vlan(masterv, false) returns early on
    !br_vlan_is_brentry(vlan): the flag stays set and br->multicast_lock is
    never taken.  br_vlan_put_master() then drains the context in
    br_multicast_ctx_deinit() and frees the VLAN through call_rcu(), while a
    reader still inside rcu_read_lock() sees the context as enabled and
    re-arms it.  The port and port-VLAN branch of the function has no
    br_vlan_is_brentry() test and flips the flag under br->multicast_lock,
    so it is not affected.
    
    The reader is the bridge transmit path.  For a master VLAN
    br_multicast_rcv() selects brmctx = &vlan->br_mcast_ctx with
    pmctx = NULL, so IGMP sent to the bridge device re-arms the context's
    timers after br_multicast_ctx_deinit() has already stopped them.
    
      BUG: KASAN: slab-use-after-free in detach_if_pending+0x412/0x4a0
      Write of size 8 at addr ffff88810ac39918 by task brmc/601
       __mod_timer+0x51a/0xc50
       br_multicast_host_join+0x25b/0x390
       __br_multicast_add_group+0x468/0x530
       br_ip4_multicast_add_group+0x1a0/0x260
       br_multicast_rcv+0x2cda/0x61e0
       br_dev_xmit+0x6c4/0x1540
      Allocated by task 610:
       br_vlan_add+0x111/0xb40
       br_vlan_info+0x370/0x3e0
      Freed by task 0:
       kfree+0x1a7/0x4f0
       rcu_core+0x7dc/0x10a0
    
    Only test br_vlan_is_brentry() when enabling, like the
    br_multicast_ctx_vlan_global_disabled() test next to it.  Disabling then
    always clears BR_VLFLAG_MCAST_ENABLED under br->multicast_lock before
    br_multicast_ctx_deinit() drains the context.
    
    Fixes: 7b54aaaf53cb ("net: bridge: multicast: add vlan state initialization and control")
    Cc: stable@vger.kernel.org
    Signed-off-by: Norbert Szetei <norbert@doyensec.com>
    Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
    Link: https://patch.msgid.link/D400F6C7-543A-4B79-9E5B-D1D8974DE5C9@doyensec.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
netfilter: nf_tables: don't queue packet path object notifications [+ + +]
Author: Fourie Zhang <littleddfu@gmail.com>
Date:   Mon Aug 10 19:35:01 2026 +0800

    netfilter: nf_tables: don't queue packet path object notifications
    
    commit 7904b94768e983bcb2be34a8d6d1f3450f5b838b upstream.
    
    All file:line references below are against v7.2-rc4 (ac5b0e5651b1). The
    trace was captured on 7.2.0-rc6-kasan72rc6 (075b74841bd0), where the same
    lines apply.
    
    nft_obj_notify() is exported and reached from the packet path. Its only
    in-tree caller is nft_quota_obj_eval() (net/netfilter/nft_quota.c:68),
    which notifies with GFP_ATOMIC while evaluating a rule for a transiting
    packet, holding no mutex.
    
    Since commit 67cc570edaa0 ("netfilter: nf_tables: coalesce multiple
    notifications into one skbuff") that notification is no longer sent
    immediately. __nft_obj_notify() queues it onto nft_net->notify_list via
    nft_notify_enqueue() (net/netfilter/nf_tables_api.c:1211), which is a bare
    list_add_tail(). notify_list has no lock of its own
    (include/net/netfilter/nf_tables.h:1951), it is serialised by commit_mutex:
    the six other enqueue sites all run inside a netlink transaction, and the
    drain in nft_commit_notify() (net/netfilter/nf_tables_api.c:10746) does
    list_del() + kfree_skb() from nf_tables_commit() with commit_mutex held.
    
    Sending packets through a chain that references a depleted quota object
    therefore races an unlocked list_add_tail() against list_del() +
    kfree_skb() on another CPU. The WRITE_ONCE(prev->next, new) in __list_add()
    then stores through an sk_buff that has already been freed:
    
      BUG: KASAN: slab-use-after-free in __nft_obj_notify+0x2c5/0x2d0
      Write of size 8 at addr ff110001047183c0 by task poc/76
      CPU: 0 UID: 1000 PID: 76 Comm: poc Tainted: G  W  7.2.0-rc6-kasan72rc6 #4
      Call Trace:
       <IRQ>
       __nft_obj_notify (include/linux/list.h:164 include/linux/list.h:191
                         net/netfilter/nf_tables_api.c:1211
                         net/netfilter/nf_tables_api.c:8743)
       nft_quota_obj_eval (net/netfilter/nft_quota.c:68)
       nft_do_chain_inet
       nf_hook_slow
       __ip_local_out
       ip_push_pending_frames
       udp_send_skb
       udp_sendmsg
       __x64_sys_sendto
    
      Allocated by task 77:
       __alloc_skb (net/core/skbuff.c:704)
       __nft_obj_notify (include/net/netlink.h:1055
                         net/netfilter/nf_tables_api.c:8731)
       nft_quota_obj_eval (net/netfilter/nft_quota.c:68)
       nft_do_chain
    
      Freed by task 79:
       nf_tables_commit (include/linux/skbuff.h:1332
                         net/netfilter/nf_tables_api.c:10759
                         net/netfilter/nf_tables_api.c:11185)
       nfnetlink_rcv_batch (net/netfilter/nfnetlink.c:574)
       netlink_unicast
       netlink_sendmsg
    
      The buggy address belongs to the cache skbuff_head_cache of size 232
    
    Queueing from the packet path is wrong even leaving the race aside:
    notify_list is only drained by nft_commit_notify() from nf_tables_commit()
    (:11185), so a notification enqueued outside a transaction is not sent
    until some later netlink batch commits, if one ever does.
    
    The gfp argument that nft_obj_notify() still takes is a leftover of the
    pre-67cc570edaa0 behaviour, where this path called nfnetlink_send()
    directly. Restore that: split the message construction out into
    nft_obj_notify_alloc() and let each caller decide what to do with the skb.
    nft_obj_notify(), the exported one reached from the packet path, sends it
    straight away; nf_tables_obj_notify(), which runs under commit_mutex, keeps
    queueing it, so transaction notifications are still coalesced.
    
    Fixes: 67cc570edaa0 ("netfilter: nf_tables: coalesce multiple notifications into one skbuff")
    Cc: stable@kernel.org
    Reported-by: TencentOS Corvus AI <corvus@tencent.com>
    Assisted-by: tencentos-corvus-ai:kimi-k3
    Signed-off-by: Fourie Zhang <fouriezhang@tencent.com>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
nfc: nci: add data_len bound checks to activation parameter extractors [+ + +]
Author: Bryam Vargas <hexlabsecurity@proton.me>
Date:   Wed Aug 26 06:57:34 2026 -0400

    nfc: nci: add data_len bound checks to activation parameter extractors
    
    [ Upstream commit 0428fa2c22e2ba0cff766d3b80d461e149102045 ]
    
    nci_extract_activation_params_iso_dep() and
    nci_extract_activation_params_nfc_dep() read an inner length byte from
    the NCI RF_INTF_ACTIVATED_NTF payload and use it to memcpy() into fixed
    kernel buffers, but neither function receives the caller-validated
    activation_params_len.  A crafted NCI notification with
    activation_params_len=1 and an inner length byte of up to 20 (NFC-A) or
    50 (NFC-B) causes memcpy() to read that many bytes past the one valid
    byte in the activation params region -- a slab out-of-bounds read of
    kernel memory adjacent to the NCI skb.
    
    The sibling nci_extract_rf_params_*() family was given equivalent
    protection by commit 571dcbeb8e63 ("net: nfc: nci: Fix parameter
    validation for packet data"), but the two activation parameter
    extractors were not updated at that time.
    
    Add a data_len parameter to both functions, guard against an empty
    region before consuming the inner length byte, decrement the remaining
    count after consuming it, and clamp the copy length to what is actually
    available.  Update both call sites to pass ntf.activation_params_len,
    which is already validated against the skb at ntf.c:801.
    
    Fixes: e8c0dacd9836 ("NFC: Update names and structs to NCI spec 1.0 d18")
    Cc: stable@vger.kernel.org
    Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>
    Link: https://patch.msgid.link/20260612-b4-disp-6d52d8b0-v3-1-e26221f8826d@proton.me
    Signed-off-by: David Heidelberg <david@ixit.cz>
    [ Replaced `NFC_ATS_MAXSIZE` with the literal `20` since that macro doesn't exist in this tree. ]
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
nilfs2: correct return value kernel-doc descriptions for ioctl functions [+ + +]
Author: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Date:   Tue Aug 25 18:05:26 2026 -0400

    nilfs2: correct return value kernel-doc descriptions for ioctl functions
    
    [ Upstream commit 17c46a45cdb94c500f4e93b176cdd61931b03020 ]
    
    Patch series "nilfs2: fix kernel-doc comments for function return values",
    v2.
    
    This series fixes the inadequacies in the return value descriptions in
    nilfs2's kernel-doc comments (mainly incorrect formatting), as well as the
    lack of return value descriptions themselves, and fixes most of the
    remaining warnings that are output when the kernel-doc script is run with
    the "-Wall" option.
    
    This patch (of 7):
    
    In the kernel-doc comments for functions, there are many cases where the
    format of the return value description is inaccurate, such as "Return
    Value: ...", which causes many warnings to be output when the kernel-doc
    script is executed with the "-Wall" option.
    
    This fixes such incorrectly formatted return value descriptions for ioctl
    functions.
    
    Link: https://lkml.kernel.org/r/20250110010530.21872-1-konishi.ryusuke@gmail.com
    Link: https://lkml.kernel.org/r/20250110010530.21872-2-konishi.ryusuke@gmail.com
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
    Cc: "Brian G ." <gissf1@gmail.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Stable-dep-of: a1735eae5544 ("nilfs2: reject invalid block index in GC ioctl")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

nilfs2: reject invalid block index in GC ioctl [+ + +]
Author: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Date:   Tue Aug 25 18:05:27 2026 -0400

    nilfs2: reject invalid block index in GC ioctl
    
    [ Upstream commit a1735eae55448bc79c2da6593455791e886f6ed8 ]
    
    Syzbot reported list corruption caused by a double list_add_tail() call on
    bh->b_assoc_buffers within nilfs_lookup_dirty_data_buffers().
    
    Analysis revealed that the root cause was the insertion of a page/folio
    with a page index of ULONG_MAX into the page cache via the GC ioctl.
    filemap_get_folios_tag(), called by nilfs_lookup_dirty_data_buffers(),
    repeatedly detects a dirty folio with a page index of ULONG_MAX due to
    index wrap-around, leading to duplicate processing of dirty buffers.
    
    As a preparatory step, the GC ioctl loads the page/folio of the block to
    be moved during GC and inserts it into the page cache based on information
    in the nilfs_vdesc structure passed as an argument.  Normally, this does
    not cause issues because the user-space GC library configures the
    nilfs_vdesc structure properly.  However, since there is no range check on
    the parameters determining the page index, a request with artificially
    crafted parameters -- such as those generated by Syzbot -- can result in a
    page/folio being inserted with a page index of ULONG_MAX, triggering the
    above problem.
    
    This resolves the issue by checking the ranges of 'vd_offset' and
    'vd_vblocknr' in the nilfs_vdesc structure that determine the page index,
    thereby preventing the invalid page/folio insertions.
    
    Reported-by: syzbot+c37bed40868932d790e9@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=c37bed40868932d790e9
    Fixes: 7942b919f732 ("nilfs2: ioctl operations")
    Cc: wuyankun <wuyankun@uniontech.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
    Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
nvme-tcp: fix usage of page_frag_cache [+ + +]
Author: Dmitry Bogdanov <d.bogdanov@yadro.com>
Date:   Thu Aug 27 15:20:15 2026 -0700

    nvme-tcp: fix usage of page_frag_cache
    
    commit 36ac05f7cfd59d90c597071304b14e98090d5dd1 upstream.
    
    nvme uses page_frag_cache to preallocate PDU for each preallocated request
    of block device. Block devices are created in parallel threads,
    consequently page_frag_cache is used in not thread-safe manner.
    That leads to incorrect refcounting of backstore pages and premature free.
    
    That can be catched by !sendpage_ok inside network stack:
    
    WARNING: CPU: 7 PID: 467 at ../net/core/skbuff.c:6931 skb_splice_from_iter+0xfa/0x310.
            tcp_sendmsg_locked+0x782/0xce0
            tcp_sendmsg+0x27/0x40
            sock_sendmsg+0x8b/0xa0
            nvme_tcp_try_send_cmd_pdu+0x149/0x2a0
    Then random panic may occur.
    
    Fix that by serializing the usage of page_frag_cache.
    
    Fixes: 4e893ca81170 ("nvme_core: scan namespaces asynchronously")
    Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
    Signed-off-by: Daniel Wagner <wagi@kernel.org>
    Signed-off-by: Keith Busch <kbusch@kernel.org>
    [carlos.bilbao: adjust context in nvme_tcp_free_queue; branch predates
    19bdb70c77d3 ("nvme-tcp: lockdep: use dynamic lockdep keys per socket
    instance")]
    Signed-off-by: Carlos Bilbao (Lambda) <carlos.bilbao@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
perf: Reject exited events as group leaders [+ + +]
Author: Kyle Zeng <kylebot@openai.com>
Date:   Thu Aug 6 13:56:55 2026 -0700

    perf: Reject exited events as group leaders
    
    [ Upstream commit fa091f46c3833fb22384f10eade2b4e1e1d0b278 ]
    
    perf_event_remove_on_exec() sets remove-on-exec events to the EXIT state
    and detaches their group relationships.  The event's file descriptor can
    remain open, however, and perf_event_open() currently accepts that event
    as a group leader because its early validation rejects only REVOKED and
    DEAD events.
    
    A new sibling can consequently be linked to the detached leader.  When
    the leader is closed, perf_group_detach() observes that its
    PERF_ATTACH_GROUP bit is already clear and skips the new sibling.  The
    sibling then retains a group_leader pointer to the freed event.
    
    Reject group leaders in the EXIT state.  Perform the check while holding
    the shared context mutex so that an exec in the target task cannot detach
    the leader between validation and group attachment.
    
    [peterz: make the earlier test fully consistent]
    Fixes: 037a3c43edfb ("perf/core: Detach event groups during remove_on_exec")
    Assisted-by: Codex:gpt-5.6-sol
    Signed-off-by: Kyle Zeng <kylebot@openai.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Link: https://patch.msgid.link/20260806205655.75722-1-kylebot@openai.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
powerpc/hv-gpci: fix preempt count leak in sysfs show paths [+ + +]
Author: Aboorva Devarajan <aboorvad@linux.ibm.com>
Date:   Fri May 8 09:42:56 2026 +0530

    powerpc/hv-gpci: fix preempt count leak in sysfs show paths
    
    [ Upstream commit dbc30a57bd8e026995e9fa8e8c31cffd18542c01 ]
    
    Four sysfs show() callbacks in hv-gpci take get_cpu_var(hv_gpci_reqb)
    (which calls preempt_disable()) but only call the matching put_cpu_var()
    on the error path under the 'out:' label. Every successful read leaks
    one preempt_disable():
    
      processor_bus_topology_show()
      processor_config_show()
      affinity_domain_via_virtual_processor_show()
      affinity_domain_via_domain_show()
    
    (affinity_domain_via_partition_show() was already correct.)
    
    On a CONFIG_PREEMPT=y kernel, repeated reads raise preempt_count and
    eventually return to userspace with preemption still disabled. The
    next user-mode page fault then hits faulthandler_disabled() == 1,
    gets forced to SIGSEGV, and the resulting coredump trips
    'BUG: scheduling while atomic' in call_usermodehelper_exec ->
    wait_for_completion_state -> schedule:
    
      BUG: scheduling while atomic: <task>/<pid>/0x00000004
      ...
      __schedule_bug+0x6c/0x90
      __schedule+0x58c/0x13a0
      schedule+0x48/0x1a0
      schedule_timeout+0x104/0x170
      wait_for_completion_state+0x16c/0x330
      call_usermodehelper_exec+0x254/0x2d0
      vfs_coredump+0x1050/0x2590
      get_signal+0xb9c/0xc80
      do_notify_resume+0xf8/0x470
    
    Add an out_success label that calls put_cpu_var() before returning
    the byte count, mirroring affinity_domain_via_partition_show().
    
    Fixes: 71f1c39647d8 ("powerpc/hv_gpci: Add sysfs file inside hv_gpci device to show processor bus topology information")
    Fixes: 1a160c2a13c6 ("powerpc/hv_gpci: Add sysfs file inside hv_gpci device to show processor config information")
    Fixes: 71a7ccb478fc ("powerpc/hv_gpci: Add sysfs file inside hv_gpci device to show affinity domain via virtual processor information")
    Fixes: a69a57cac1ec ("powerpc/hv_gpci: Add sysfs file inside hv_gpci device to show affinity domain via domain information")
    Signed-off-by: Aboorva Devarajan <aboorvad@linux.ibm.com>
    Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
    Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
    Link: https://patch.msgid.link/20260508041256.3447113-1-aboorvad@linux.ibm.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
RDMA/rxe: Fix OOB in free_rd_atomic_resources() [+ + +]
Author: Peiyang He <peiyang_he@smail.nju.edu.cn>
Date:   Thu Jul 30 10:28:27 2026 +0800

    RDMA/rxe: Fix OOB in free_rd_atomic_resources()
    
    [ Upstream commit de329533792a373186d79dca1ca120f8fa0afd05 ]
    
    free_rd_atomic_resources() iterates using qp->attr.max_dest_rd_atomic.
    Updating max_dest_rd_atomic before freeing the old array can make the
    free path walk past the old allocation and trigger a slab out-of-bounds
    write catched by KASAN:
    ==================================================================
    BUG: KASAN: slab-out-of-bounds in free_rd_atomic_resource drivers/infiniband/sw/rxe/rxe_qp.c:180 [inline]
    BUG: KASAN: slab-out-of-bounds in free_rd_atomic_resources drivers/infiniband/sw/rxe/rxe_qp.c:171 [inline]
    BUG: KASAN: slab-out-of-bounds in free_rd_atomic_resources drivers/infiniband/sw/rxe/rxe_qp.c:163 [inline]
    BUG: KASAN: slab-out-of-bounds in rxe_qp_from_attr+0x1e88/0x2150 drivers/infiniband/sw/rxe/rxe_qp.c:712
    Write of size 4 at addr ffff88802b8dddb8 by task syz.3.451/11063
    
    CPU: 0 UID: 0 PID: 11063 Comm: syz.3.451 Not tainted 7.1.0 #2 PREEMPT(full)
    Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
    Call Trace:
     <TASK>
     __dump_stack lib/dump_stack.c:94 [inline]
     dump_stack_lvl+0x10e/0x1f0 lib/dump_stack.c:120
     print_address_description mm/kasan/report.c:378 [inline]
     print_report+0xf7/0x600 mm/kasan/report.c:482
     kasan_report+0xe4/0x120 mm/kasan/report.c:595
     free_rd_atomic_resource drivers/infiniband/sw/rxe/rxe_qp.c:180 [inline]
     free_rd_atomic_resources drivers/infiniband/sw/rxe/rxe_qp.c:171 [inline]
     free_rd_atomic_resources drivers/infiniband/sw/rxe/rxe_qp.c:163 [inline]
     rxe_qp_from_attr+0x1e88/0x2150 drivers/infiniband/sw/rxe/rxe_qp.c:712
     rxe_modify_qp+0x1e2/0x530 drivers/infiniband/sw/rxe/rxe_verbs.c:623
     ib_security_modify_qp+0x223/0xfa0 drivers/infiniband/core/security.c:625
     _ib_modify_qp+0x333/0xec0 drivers/infiniband/core/verbs.c:1915
     modify_qp+0x13ca/0x1940 drivers/infiniband/core/uverbs_cmd.c:1932
     ib_uverbs_modify_qp+0xcb/0x120 drivers/infiniband/core/uverbs_cmd.c:1958
     ib_uverbs_write+0xb86/0x1030 drivers/infiniband/core/uverbs_main.c:680
     vfs_write+0x2aa/0x1070 fs/read_write.c:686
     ksys_write+0x1f8/0x250 fs/read_write.c:740
     do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
     do_syscall_64+0x116/0x800 arch/x86/entry/syscall_64.c:94
     entry_SYSCALL_64_after_hwframe+0x77/0x7f
    RIP: 0033:0x7fefc75a70cd
    Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
    RSP: 002b:00007fefc8495018 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
    RAX: ffffffffffffffda RBX: 00007fefc7835fa0 RCX: 00007fefc75a70cd
    RDX: 0000000000000078 RSI: 0000200000000240 RDI: 0000000000000007
    RBP: 00007fefc764f10f R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
    R13: 00007fefc7836038 R14: 00007fefc7835fa0 R15: 00007ffcf0586aa0
     </TASK>
    
    Allocated by task 11063:
     kasan_save_stack+0x33/0x60 mm/kasan/common.c:57
     kasan_save_track+0x14/0x30 mm/kasan/common.c:78
     poison_kmalloc_redzone mm/kasan/common.c:398 [inline]
     __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:415
     kasan_kmalloc include/linux/kasan.h:263 [inline]
     __do_kmalloc_node mm/slub.c:5296 [inline]
     __kmalloc_noprof+0x32a/0x850 mm/slub.c:5308
     kmalloc_noprof include/linux/slab.h:954 [inline]
     kzalloc_noprof include/linux/slab.h:1188 [inline]
     alloc_rd_atomic_resources drivers/infiniband/sw/rxe/rxe_qp.c:155 [inline]
     rxe_qp_from_attr+0x3f8/0x2150 drivers/infiniband/sw/rxe/rxe_qp.c:714
     rxe_modify_qp+0x1e2/0x530 drivers/infiniband/sw/rxe/rxe_verbs.c:623
     ib_security_modify_qp+0x223/0xfa0 drivers/infiniband/core/security.c:625
     _ib_modify_qp+0x333/0xec0 drivers/infiniband/core/verbs.c:1915
     modify_qp+0x13ca/0x1940 drivers/infiniband/core/uverbs_cmd.c:1932
     ib_uverbs_modify_qp+0xcb/0x120 drivers/infiniband/core/uverbs_cmd.c:1958
     ib_uverbs_write+0xb86/0x1030 drivers/infiniband/core/uverbs_main.c:680
     vfs_write+0x2aa/0x1070 fs/read_write.c:686
     ksys_write+0x1f8/0x250 fs/read_write.c:740
     do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
     do_syscall_64+0x116/0x800 arch/x86/entry/syscall_64.c:94
     entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
    The buggy address belongs to the object at ffff88802b8ddd80
     which belongs to the cache kmalloc-64 of size 64
    The buggy address is located 0 bytes to the right of
     allocated 56-byte region [ffff88802b8ddd80, ffff88802b8dddb8)
    
    The buggy address belongs to the physical page:
    page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2b8dd
    flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
    page_type: f5(slab)
    raw: 00fff00000000000 ffff888015c418c0 dead000000000100 dead000000000122
    raw: 0000000000000000 0000000800200020 00000000f5000000 0000000000000000
    page dumped because: kasan: bad access detected
    page_owner tracks the page as allocated
    page last allocated via order 0, migratetype Unmovable, gfp_mask 0xd2c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 4651, tgid 4651 ((udev-worker)), ts 123427165316, free_ts 123425874255
     set_page_owner include/linux/page_owner.h:32 [inline]
     post_alloc_hook+0xfc/0x120 mm/page_alloc.c:1853
     prep_new_page mm/page_alloc.c:1861 [inline]
     get_page_from_freelist+0x75b/0x3220 mm/page_alloc.c:3941
     __alloc_frozen_pages_noprof+0x27e/0x2b00 mm/page_alloc.c:5221
     alloc_slab_page mm/slub.c:3278 [inline]
     allocate_slab mm/slub.c:3467 [inline]
     new_slab+0xa6/0x670 mm/slub.c:3525
     refill_objects+0x278/0x420 mm/slub.c:7272
     refill_sheaf mm/slub.c:2816 [inline]
     __pcs_replace_empty_main+0x2ed/0x640 mm/slub.c:4652
     alloc_from_pcs mm/slub.c:4750 [inline]
     slab_alloc_node mm/slub.c:4884 [inline]
     __do_kmalloc_node mm/slub.c:5295 [inline]
     __kmalloc_noprof+0x68d/0x850 mm/slub.c:5308
     kmalloc_noprof include/linux/slab.h:954 [inline]
     kzalloc_noprof include/linux/slab.h:1188 [inline]
     tomoyo_encode2+0x100/0x3e0 security/tomoyo/realpath.c:45
     tomoyo_encode+0x29/0x50 security/tomoyo/realpath.c:80
     tomoyo_realpath_from_path+0x18c/0x690 security/tomoyo/realpath.c:283
     tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
     tomoyo_check_open_permission+0x2ab/0x3c0 security/tomoyo/file.c:776
     tomoyo_file_open+0x6b/0x90 security/tomoyo/tomoyo.c:334
     security_file_open+0x7a/0x1b0 security/security.c:2739
     do_dentry_open+0x57e/0x1690 fs/open.c:924
     vfs_open+0x82/0x3f0 fs/open.c:1079
     do_open fs/namei.c:4699 [inline]
     path_openat+0x218a/0x3190 fs/namei.c:4858
    page last free pid 1 tgid 1 stack trace:
     reset_page_owner include/linux/page_owner.h:25 [inline]
     __free_pages_prepare mm/page_alloc.c:1397 [inline]
     __free_frozen_pages+0x763/0xfc0 mm/page_alloc.c:2938
     selinux_genfs_get_sid security/selinux/hooks.c:1364 [inline]
     inode_doinit_with_dentry+0x903/0x1320 security/selinux/hooks.c:1563
     selinux_d_instantiate+0x26/0x30 security/selinux/hooks.c:6658
     security_d_instantiate+0x123/0x190 security/security.c:3704
     d_splice_alias_ops+0x92/0x850 fs/dcache.c:3141
     kernfs_iop_lookup+0x23f/0x2d0 fs/kernfs/dir.c:1289
     lookup_open.isra.0+0x659/0x1080 fs/namei.c:4484
     open_last_lookups fs/namei.c:4611 [inline]
     path_openat+0x17dd/0x3190 fs/namei.c:4855
     do_file_open+0x20c/0x430 fs/namei.c:4887
     do_sys_openat2+0x101/0x1d0 fs/open.c:1364
     do_sys_open fs/open.c:1370 [inline]
     __do_sys_openat fs/open.c:1386 [inline]
     __se_sys_openat fs/open.c:1381 [inline]
     __x64_sys_openat+0x141/0x200 fs/open.c:1381
     do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
     do_syscall_64+0x116/0x800 arch/x86/entry/syscall_64.c:94
     entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
    Memory state around the buggy address:
     ffff88802b8ddc80: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc
     ffff88802b8ddd00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
    >ffff88802b8ddd80: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc
                                            ^
     ffff88802b8dde00: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
     ffff88802b8dde80: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
    
    Fix the OOB by moving the assignment after free_rd_atomic_resources()
    so the old array is freed using the old bound. This matches the original
    ordering in commit 8700e3e7c485 ("Soft RoCE driver").
    
    Closes: https://lore.kernel.org/all/365C68B4923F8214+30195a67-0b90-4b92-ab96-2ce41517793c@smail.nju.edu.cn/
    Fixes: b6bbee0d2438 ("IB/rxe: Properly honor max IRD value for rd/atomic.")
    Cc: stable@vger.kernel.org
    Signed-off-by: Peiyang He <peiyang_he@smail.nju.edu.cn>
    Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev>
    Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

RDMA/rxe: Fix responder UAF on IB_QP_MAX_DEST_RD_ATOMIC modify_qp [+ + +]
Author: Ibrahim Hashimov <security@auditcode.ai>
Date:   Sun Jul 12 14:17:20 2026 +0200

    RDMA/rxe: Fix responder UAF on IB_QP_MAX_DEST_RD_ATOMIC modify_qp
    
    [ Upstream commit 6f7014237405e7f032b5c53a82d9eccf6161c291 ]
    
    rxe_qp_from_attr() handles IB_QP_MAX_DEST_RD_ATOMIC outside the
    IB_QP_STATE path, so it holds no state_lock and runs while the responder
    task rxe_receiver() (recv_task on rxe_wq) is live. A modify_qp() setting
    only that attribute calls free_rd_atomic_resources() then
    alloc_rd_atomic_resources(), swapping qp->resp.resources[] while
    rxe_prepare_res()/find_resource() walk it; free_rd_atomic_resources()
    also leaves the cached pointer qp->resp.res dangling. A local
    unprivileged user can race the free/realloc into a use-after-free in
    rxe_receiver() (local DoS).
    
    Drain recv_task around the swap with rxe_disable_task()/rxe_enable_task(),
    as rxe_qp_reset() already does when tearing this array down, re-enabling
    only after alloc_rd_atomic_resources() succeeds so the responder never
    resumes against a NULL qp->resp.resources on the ENOMEM path. Also clear
    qp->resp.res in free_rd_atomic_resources(), like the rxe_resp.c
    completion paths.
    
    Reproduced under KASAN; the slab-use-after-free in rxe_receiver() is gone.
    
    Fixes: 8700e3e7c485 ("Soft RoCE driver")
    Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev>
    Signed-off-by: Ibrahim Hashimov <security@auditcode.ai>
    Link: https://patch.msgid.link/20260712121720.78001-1-security@auditcode.ai
    Assisted-by: AuditCode-AI:2026.07
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
 
Revert "PM: sleep: Use complete() in device_pm_sleep_init()" [+ + +]
Author: Sasha Levin <sashal@kernel.org>
Date:   Sat Aug 29 20:58:34 2026 -0400

    Revert "PM: sleep: Use complete() in device_pm_sleep_init()"
    
    This reverts commit 171ef40fce41b13f5115d988c45997e94113c7ab.
    
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
ring buffer: Propagate __rb_map_vma return value to caller [+ + +]
Author: Ankit Khushwaha <ankitkhushwaha.linux@gmail.com>
Date:   Wed Oct 8 22:55:16 2025 +0530

    ring buffer: Propagate __rb_map_vma return value to caller
    
    [ Upstream commit de4cbd704731778a2dc833ce5a24b38e5d672c05 ]
    
    The return value from `__rb_map_vma()`, which rejects writable or
    executable mappings (VM_WRITE, VM_EXEC, or !VM_MAYSHARE), was being
    ignored. As a result the caller of `__rb_map_vma` always returned 0
    even when the mapping had actually failed, allowing it to proceed
    with an invalid VMA.
    
    Cc: stable@vger.kernel.org
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Link: https://lore.kernel.org/20251008172516.20697-1-ankitkhushwaha.linux@gmail.com
    Fixes: 117c39200d9d7 ("ring-buffer: Introducing ring-buffer mapping functions")
    Reported-by: syzbot+ddc001b92c083dbf2b97@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?id=194151be8eaebd826005329b2e123aecae714bdb
    Signed-off-by: Ankit Khushwaha <ankitkhushwaha.linux@gmail.com>
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
riscv: Fix register corruption from uninitialized cregs on error [+ + +]
Author: Michael Neuling <mikey@neuling.org>
Date:   Fri May 1 06:23:20 2026 +0000

    riscv: Fix register corruption from uninitialized cregs on error
    
    [ Upstream commit 6ebcbb53fc9bc30843054ed99fd60b8e542628f4 ]
    
    compat_riscv_gpr_set() calls cregs_to_regs() unconditionally, even when
    user_regset_copyin() fails. Since cregs is an uninitialized stack
    variable, a copyin failure causes uninitialized stack data to be written
    into the target task's pt_regs, corrupting its register state and
    potentially leaking kernel stack contents.
    
    compat_restore_sigcontext() has the same issue: it calls cregs_to_regs()
    even when __copy_from_user() fails, leading to the same corruption of
    the signal-returning task's register state on error.
    
    Only call cregs_to_regs() when the user copy succeeds.
    
    Fixes: 4608c159594f ("riscv: compat: ptrace: Add compat_arch_ptrace implement")
    Fixes: 7383ee05314b ("riscv: compat: signal: Add rt_frame implementation")
    Signed-off-by: Michael Neuling <mikey@neuling.org>
    Assisted-by: Cursor:claude-4.6-opus-high-thinking
    Link: https://patch.msgid.link/20260501062320.2339562-1-mikey@neuling.org
    Signed-off-by: Paul Walmsley <pjw@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
selinux: avoid unnecessary indirection in struct level_datum [+ + +]
Author: Christian Göttsche <cgzones@googlemail.com>
Date:   Fri Aug 28 03:13:14 2026 +0800

    selinux: avoid unnecessary indirection in struct level_datum
    
    [ Upstream commit 749153636643aaa793f14e84e864fdaf5ed0620d ]
    
    Store the owned member of type struct mls_level directly in the parent
    struct instead of an extra heap allocation.
    
    Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    (cherry picked from commit 749153636643aaa793f14e84e864fdaf5ed0620d)
    Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

selinux: make more use of str_read() when loading the policy [+ + +]
Author: Christian Göttsche <cgzones@googlemail.com>
Date:   Fri Aug 28 03:13:16 2026 +0800

    selinux: make more use of str_read() when loading the policy
    
    [ Upstream commit 01c2253a0fbdccb58cd79d4ff9ab39964bfb4474 ]
    
    Simplify the call sites, and enable future string validation in a single
    place.
    
    Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
    [PM: subject tweak]
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    (cherry picked from commit 01c2253a0fbdccb58cd79d4ff9ab39964bfb4474)
    Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

selinux: more strict policy parsing [+ + +]
Author: Christian Göttsche <cgzones@googlemail.com>
Date:   Fri Aug 28 03:13:20 2026 +0800

    selinux: more strict policy parsing
    
    [ Upstream commit 18fa21f10d008a0fc22565109c7d38f304295912 ]
    
    Be more strict during parsing of policies and reject invalid values.
    
    Add some error messages in the case of policy parse failures, to
    enhance debugging, either on a malformed policy or a too strict check.
    
    Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
    Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
    [PM: fixed checkpatch.pl warnings, style problems]
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    (cherry picked from commit 18fa21f10d008a0fc22565109c7d38f304295912)
    [WG: drop the AVTAB_XPERMS_NLMSG case, netlink xperm support
     (d1d991efaf34 "selinux: Add netlink xperm support") is not present
     in this tree]
    Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

selinux: reject a permission value exceeding the class permission count [+ + +]
Author: Bryam Vargas <hexlabsecurity@proton.me>
Date:   Fri Aug 28 03:13:22 2026 +0800

    selinux: reject a permission value exceeding the class permission count
    
    [ Upstream commit d14b5d0e97fccd27974fedc03b903408872907fd ]
    
    perm_read() bounds a permission value by SEL_VEC_MAX but never by the
    nprim of the owning class or common, which is taken verbatim from the
    policy image.  security_get_permissions() then writes perms[value - 1]
    into an nprim-sized kcalloc() array, so a class declaring fewer
    permissions than its largest permission value drives an out-of-bounds
    heap write.  The top-level symbol tables are validated this way; the
    nested per-class permission table is not.
    
    Reject a permission whose value exceeds nprim, which is already set when
    perm_read() runs.  Well-formed policies are unaffected.
    
    Cc: stable@vger.kernel.org
    Fixes: 55fcf09b3fe4 ("selinux: add support for querying object classes and permissions from the running policy")
    Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>
    Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
    [PM: tweak comment for line length]
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    (cherry picked from commit d14b5d0e97fccd27974fedc03b903408872907fd)
    Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

selinux: require a class's permission values to cover its permission count [+ + +]
Author: Bryam Vargas <hexlabsecurity@proton.me>
Date:   Fri Aug 28 03:13:24 2026 +0800

    selinux: require a class's permission values to cover its permission count
    
    [ Upstream commit b98a8ac50775540f3804397ed08f61ef9910bcab ]
    
    security_get_permissions() sizes an array by the class's permissions.nprim
    and fills it at value - 1, from the inherited common's permission table and
    then the class's own. A value no permission defines leaves a NULL that
    sel_make_perm_files() passes to d_alloc_name(), an oops inside
    sel_write_load() that strands selinux_state.policy_mutex and leaves every
    later load in uninterruptible sleep; two permissions sharing a value
    overwrite the first kstrdup(). Bounding each value by nprim catches
    neither, and neither would a count: the symbol table is keyed on the
    permission name, so duplicates pass.
    
    Track the values each permission table claims and require them to cover
    exactly what its count declares, rejecting a count no value can reach.
    Conforming policies are unaffected.
    
    Cc: stable@vger.kernel.org
    Fixes: 55fcf09b3fe4 ("selinux: add support for querying object classes and permissions from the running policy")
    Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>
    Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    (cherry picked from commit b98a8ac50775540f3804397ed08f61ef9910bcab)
    Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

selinux: switch two allocations to use kzalloc_objs() [+ + +]
Author: Stephen Smalley <stephen.smalley.work@gmail.com>
Date:   Wed Apr 29 15:18:40 2026 -0400

    selinux: switch two allocations to use kzalloc_objs()
    
    [ Upstream commit cf6a513f1937581eb012a217b29817e025a1a0ef ]
    
    These were the only two allocations in the policy loading logic
    that were not already using kzalloc_objs() for the policy
    data structures. Fix these to be consistent with the rest and
    to protect against ill-formed policy.
    
    Signed-off-by: Stephen Smalley <stephen.smalley.work@gmail.com>
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

selinux: use known type instead of void pointer [+ + +]
Author: Christian Göttsche <cgzones@googlemail.com>
Date:   Fri Aug 28 03:13:12 2026 +0800

    selinux: use known type instead of void pointer
    
    [ Upstream commit f07586160fd5492f8d48e7667e7a5d8797aa5090 ]
    
    Improve type safety and readability by using the known type.
    
    Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    (cherry picked from commit f07586160fd5492f8d48e7667e7a5d8797aa5090)
    Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

selinux: use u16 for security classes [+ + +]
Author: Christian Göttsche <cgzones@googlemail.com>
Date:   Fri Aug 28 03:13:18 2026 +0800

    selinux: use u16 for security classes
    
    [ Upstream commit fa79a596848fe38c55ccab8832ac35dac07fb00c ]
    
    Security class identifiers are limited to 2^16, thus use the appropriate
    type u16 consistently.
    
    Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
    Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
    Signed-off-by: Paul Moore <paul@paul-moore.com>
    (cherry picked from commit fa79a596848fe38c55ccab8832ac35dac07fb00c)
    Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
smc: Fix use-after-free in __pnet_find_base_ndev(). [+ + +]
Author: Kuniyuki Iwashima <kuniyu@google.com>
Date:   Tue Sep 16 21:47:19 2025 +0000

    smc: Fix use-after-free in __pnet_find_base_ndev().
    
    [ Upstream commit 3d3466878afd8d43ec0ca2facfbc7f03e40d0f79 ]
    
    syzbot reported use-after-free of net_device in __pnet_find_base_ndev(),
    which was called during connect(). [0]
    
    smc_pnet_find_ism_resource() fetches sk_dst_get(sk)->dev and passes
    down to pnet_find_base_ndev(), where RTNL is held.  Then, UAF happened
    at __pnet_find_base_ndev() when the dev is first used.
    
    This means dev had already been freed before acquiring RTNL in
    pnet_find_base_ndev().
    
    While dev is going away, dst->dev could be swapped with blackhole_netdev,
    and the dev's refcnt by dst will be released.
    
    We must hold dev's refcnt before calling smc_pnet_find_ism_resource().
    
    Also, smc_pnet_find_roce_resource() has the same problem.
    
    Let's use __sk_dst_get() and dst_dev_rcu() in the two functions.
    
    [0]:
    BUG: KASAN: use-after-free in __pnet_find_base_ndev+0x1b1/0x1c0 net/smc/smc_pnet.c:926
    Read of size 1 at addr ffff888036bac33a by task syz.0.3632/18609
    
    CPU: 1 UID: 0 PID: 18609 Comm: syz.0.3632 Not tainted syzkaller #0 PREEMPT(full)
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025
    Call Trace:
     <TASK>
     dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
     print_address_description mm/kasan/report.c:378 [inline]
     print_report+0xca/0x240 mm/kasan/report.c:482
     kasan_report+0x118/0x150 mm/kasan/report.c:595
     __pnet_find_base_ndev+0x1b1/0x1c0 net/smc/smc_pnet.c:926
     pnet_find_base_ndev net/smc/smc_pnet.c:946 [inline]
     smc_pnet_find_ism_by_pnetid net/smc/smc_pnet.c:1103 [inline]
     smc_pnet_find_ism_resource+0xef/0x390 net/smc/smc_pnet.c:1154
     smc_find_ism_device net/smc/af_smc.c:1030 [inline]
     smc_find_proposal_devices net/smc/af_smc.c:1115 [inline]
     __smc_connect+0x372/0x1890 net/smc/af_smc.c:1545
     smc_connect+0x877/0xd90 net/smc/af_smc.c:1715
     __sys_connect_file net/socket.c:2086 [inline]
     __sys_connect+0x313/0x440 net/socket.c:2105
     __do_sys_connect net/socket.c:2111 [inline]
     __se_sys_connect net/socket.c:2108 [inline]
     __x64_sys_connect+0x7a/0x90 net/socket.c:2108
     do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
     do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
     entry_SYSCALL_64_after_hwframe+0x77/0x7f
    RIP: 0033:0x7f47cbf8eba9
    Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
    RSP: 002b:00007f47ccdb1038 EFLAGS: 00000246 ORIG_RAX: 000000000000002a
    RAX: ffffffffffffffda RBX: 00007f47cc1d5fa0 RCX: 00007f47cbf8eba9
    RDX: 0000000000000010 RSI: 0000200000000280 RDI: 000000000000000b
    RBP: 00007f47cc011e19 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
    R13: 00007f47cc1d6038 R14: 00007f47cc1d5fa0 R15: 00007ffc512f8aa8
     </TASK>
    
    The buggy address belongs to the physical page:
    page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888036bacd00 pfn:0x36bac
    flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
    raw: 00fff00000000000 ffffea0001243d08 ffff8880b863fdc0 0000000000000000
    raw: ffff888036bacd00 0000000000000000 00000000ffffffff 0000000000000000
    page dumped because: kasan: bad access detected
    page_owner tracks the page as freed
    page last allocated via order 2, migratetype Unmovable, gfp_mask 0x446dc0(GFP_KERNEL_ACCOUNT|__GFP_ZERO|__GFP_NOWARN|__GFP_RETRY_MAYFAIL|__GFP_COMP), pid 16741, tgid 16741 (syz-executor), ts 343313197788, free_ts 380670750466
     set_page_owner include/linux/page_owner.h:32 [inline]
     post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1851
     prep_new_page mm/page_alloc.c:1859 [inline]
     get_page_from_freelist+0x21e4/0x22c0 mm/page_alloc.c:3858
     __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:5148
     alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2416
     ___kmalloc_large_node+0x5f/0x1b0 mm/slub.c:4317
     __kmalloc_large_node_noprof+0x18/0x90 mm/slub.c:4348
     __do_kmalloc_node mm/slub.c:4364 [inline]
     __kvmalloc_node_noprof+0x6d/0x5f0 mm/slub.c:5067
     alloc_netdev_mqs+0xa3/0x11b0 net/core/dev.c:11812
     tun_set_iff+0x532/0xef0 drivers/net/tun.c:2775
     __tun_chr_ioctl+0x788/0x1df0 drivers/net/tun.c:3085
     vfs_ioctl fs/ioctl.c:51 [inline]
     __do_sys_ioctl fs/ioctl.c:598 [inline]
     __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:584
     do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
     do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
     entry_SYSCALL_64_after_hwframe+0x77/0x7f
    page last free pid 18610 tgid 18608 stack trace:
     reset_page_owner include/linux/page_owner.h:25 [inline]
     free_pages_prepare mm/page_alloc.c:1395 [inline]
     __free_frozen_pages+0xbc4/0xd30 mm/page_alloc.c:2895
     free_large_kmalloc+0x13a/0x1f0 mm/slub.c:4820
     device_release+0x99/0x1c0 drivers/base/core.c:-1
     kobject_cleanup lib/kobject.c:689 [inline]
     kobject_release lib/kobject.c:720 [inline]
     kref_put include/linux/kref.h:65 [inline]
     kobject_put+0x22b/0x480 lib/kobject.c:737
     netdev_run_todo+0xd2e/0xea0 net/core/dev.c:11513
     rtnl_unlock net/core/rtnetlink.c:157 [inline]
     rtnl_net_unlock include/linux/rtnetlink.h:135 [inline]
     rtnl_dellink+0x537/0x710 net/core/rtnetlink.c:3563
     rtnetlink_rcv_msg+0x7cc/0xb70 net/core/rtnetlink.c:6946
     netlink_rcv_skb+0x208/0x470 net/netlink/af_netlink.c:2552
     netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
     netlink_unicast+0x82f/0x9e0 net/netlink/af_netlink.c:1346
     netlink_sendmsg+0x805/0xb30 net/netlink/af_netlink.c:1896
     sock_sendmsg_nosec net/socket.c:714 [inline]
     __sock_sendmsg+0x219/0x270 net/socket.c:729
     ____sys_sendmsg+0x505/0x830 net/socket.c:2614
     ___sys_sendmsg+0x21f/0x2a0 net/socket.c:2668
     __sys_sendmsg net/socket.c:2700 [inline]
     __do_sys_sendmsg net/socket.c:2705 [inline]
     __se_sys_sendmsg net/socket.c:2703 [inline]
     __x64_sys_sendmsg+0x19b/0x260 net/socket.c:2703
     do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
     do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
     entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
    Memory state around the buggy address:
     ffff888036bac200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
     ffff888036bac280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    >ffff888036bac300: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                            ^
     ffff888036bac380: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
     ffff888036bac400: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    
    Fixes: 0afff91c6f5e ("net/smc: add pnetid support")
    Fixes: 1619f770589a ("net/smc: add pnetid support for SMC-D and ISM")
    Reported-by: syzbot+ea28e9d85be2f327b6c6@syzkaller.appspotmail.com
    Closes: https://lore.kernel.org/netdev/68c237c7.050a0220.3c6139.0036.GAE@google.com/
    Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Link: https://patch.msgid.link/20250916214758.650211-2-kuniyu@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

smc: Use __sk_dst_get() and dst_dev_rcu() in in smc_clc_prfx_set(). [+ + +]
Author: Kuniyuki Iwashima <kuniyu@google.com>
Date:   Tue Sep 16 21:47:20 2025 +0000

    smc: Use __sk_dst_get() and dst_dev_rcu() in in smc_clc_prfx_set().
    
    [ Upstream commit 935d783e5de9b64587f3adb25641dd8385e64ddb ]
    
    smc_clc_prfx_set() is called during connect() and not under RCU
    nor RTNL.
    
    Using sk_dst_get(sk)->dev could trigger UAF.
    
    Let's use __sk_dst_get() and dev_dst_rcu() under rcu_read_lock()
    after kernel_getsockname().
    
    Note that the returned value of smc_clc_prfx_set() is not used
    in the caller.
    
    While at it, we change the 1st arg of smc_clc_prfx_set[46]_rcu()
    not to touch dst there.
    
    Fixes: a046d57da19f ("smc: CLC handshake (incl. preparation steps)")
    Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Link: https://patch.msgid.link/20250916214758.650211-3-kuniyu@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

smc: Use __sk_dst_get() and dst_dev_rcu() in smc_clc_prfx_match(). [+ + +]
Author: Kuniyuki Iwashima <kuniyu@google.com>
Date:   Tue Sep 16 21:47:21 2025 +0000

    smc: Use __sk_dst_get() and dst_dev_rcu() in smc_clc_prfx_match().
    
    [ Upstream commit 235f81045c008169cc4e1955b4a64e118eebe61b ]
    
    smc_clc_prfx_match() is called from smc_listen_work() and
    not under RCU nor RTNL.
    
    Using sk_dst_get(sk)->dev could trigger UAF.
    
    Let's use __sk_dst_get() and dst_dev_rcu().
    
    Note that the returned value of smc_clc_prfx_match() is not
    used in the caller.
    
    Fixes: a046d57da19f ("smc: CLC handshake (incl. preparation steps)")
    Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Link: https://patch.msgid.link/20250916214758.650211-4-kuniyu@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

smc: Use __sk_dst_get() and dst_dev_rcu() in smc_vlan_by_tcpsk(). [+ + +]
Author: Kuniyuki Iwashima <kuniyu@google.com>
Date:   Tue Sep 16 21:47:22 2025 +0000

    smc: Use __sk_dst_get() and dst_dev_rcu() in smc_vlan_by_tcpsk().
    
    [ Upstream commit 0b0e4d51c6554e5ecc3f8cc73c2eaf12da21249a ]
    
    smc_vlan_by_tcpsk() fetches sk_dst_get(sk)->dev before RTNL and
    passes it to netdev_walk_all_lower_dev(), which is illegal.
    
    Also, smc_vlan_by_tcpsk_walk() does not require RTNL at all.
    
    Let's use __sk_dst_get(), dst_dev_rcu(), and
    netdev_walk_all_lower_dev_rcu().
    
    Note that the returned value of smc_vlan_by_tcpsk() is not used
    in the caller.
    
    Fixes: 0cfdd8f92cac ("smc: connection and link group creation")
    Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Link: https://patch.msgid.link/20250916214758.650211-5-kuniyu@google.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
tcp: fix AO info use-after-free in tcp_ao_connect_init() [+ + +]
Author: Qing Ming <a0yami@mailbox.org>
Date:   Tue Aug 25 15:20:33 2026 +0800

    tcp: fix AO info use-after-free in tcp_ao_connect_init()
    
    commit ea30dc5267e367b8a5e1e06cc074f813bcbf18b2 upstream.
    
    tcp_v4_connect() adds a SYN-SENT socket to the ehash before calling
    tcp_connect().  If TCP-AO is configured, tcp_connect() first verifies that
    a key matches the peer and the bound device's current L3 master.
    tcp_ao_connect_init() later resolves the L3 master again and removes keys
    which do not match it.
    
    The socket lock does not stabilize the bound device's VRF membership.
    Detaching the device from its VRF between the initial validation and the
    L3-master calculation in tcp_ao_connect_init() can therefore make the
    validation succeed while initialization observes the default L3 domain and
    removes the only key.  The subsequent AO lookup then fails, so the no-key
    path clears tp->ao_info and frees it directly.
    
    The receive path can find the socket in the ehash and load tp->ao_info
    under RCU before acquiring the socket lock.  A reader which loaded the old
    pointer can thus continue into tcp_inbound_ao_hash() after the direct free.
    
    The issue was found during a static audit of TCP-AO object lifetime.  An
    unprivileged reproducer in self-created user and network namespaces raced
    connect() with detaching a veth from its VRF while sending TCP-AO segments.
    It triggered the same KASAN report on two fresh boots:
    
      BUG: KASAN: slab-use-after-free in tcp_inbound_ao_hash+0x585/0x19f0
      Write of size 8 at addr ffff88800bf88128 by task tcp_ao_vrf_race/232
    
      Call Trace:
       tcp_inbound_ao_hash+0x585/0x19f0
       tcp_inbound_hash+0x677/0xa80
       tcp_v4_rcv+0x1c3e/0x3ab0
    
      Allocated by task 235:
       tcp_ao_alloc_info+0x43/0xf0
       tcp_ao_add_cmd+0xdf7/0x13b0
       do_tcp_setsockopt+0x168c/0x2640
    
      Freed by task 235:
       kfree+0x1b8/0x550
       tcp_connect+0x252/0x4f00
       tcp_v4_connect+0x1114/0x1720
    
    The bad address is 40 bytes inside the freed 128-byte object, matching the
    tcp_ao_info counters.key_not_found field.  The two runs used 1000 attempts
    each, reached the no-key path 366 and 411 times, and produced one and two
    KASAN reports respectively.  With this change, the same reproducer reached
    the no-key path 366 times in 1000 attempts without a KASAN report or oops.
    
    Use tcp_ao_destroy_sock() for the no-key path.  It unpublishes the AO info,
    updates the socket memory and static-key accounting, and defers the free
    until after an RCU grace period.
    
    Also drop the WARN_ON_ONCE() and its stale comment.  The VRF detach race
    makes the no-key state reachable during normal operation, so it is a
    handled condition rather than an impossible assertion.  On panic_on_warn
    kernels the WARN would turn this handled race into a kernel panic.
    
    Fixes: 248411b8cb89 ("net/tcp: Wire up l3index to TCP-AO")
    Cc: stable@vger.kernel.org
    Assisted-by: Codex:gpt-5
    Signed-off-by: Qing Ming <a0yami@mailbox.org>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Link: https://patch.msgid.link/20260825072033.6921-1-a0yami@mailbox.org
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
tls: device: fix out-of-bounds write in tls_append_frag() [+ + +]
Author: Jiayuan Chen <jiayuan.chen@linux.dev>
Date:   Sun Aug 23 16:47:56 2026 +0800

    tls: device: fix out-of-bounds write in tls_append_frag()
    
    commit b17cf742eaad70ae29ac558cefb3aa9bbeea03d4 upstream.
    
    Found with syzkaller and a local syzbot instance running on top of a
    netdevsim TLS offload emulation; tls_device.c is otherwise only reachable
    on a machine with a NIC that implements the offload.
    
    tls_push_data() only checks whether the open record still has room for
    another frag at the bottom of its loop, and the MSG_MORE early break
    skips that check.  The record survives to the next syscall with the frag
    count it already had, and tls_append_frag() does not check either, so
    with TLS_TX_ZEROCOPY_RO every splice(SPLICE_F_MORE) of a byte or two adds
    a non-coalescing pipe page and num_frags walks off the end of
    tls_record_info.frags[MAX_SKB_FRAGS].  Once the record is pushed,
    tls_push_record() runs the same index over sg_tx_data[MAX_SKB_FRAGS] and
    the sg_set_page() writes land on the destruct_work that follows it, which
    the workqueue then calls.
    
    The byte limit is fine because copy drops to 0 and the loop falls through
    to the same check; the frag count has no such feedback.
    
    Push the record rather than keep a full one open, which is what a plain
    TCP socket does - tcp_sendmsg_locked() uses tcp_mark_push() and
    new_segment in both the copy and the MSG_SPLICE_PAGES paths, and tls_sw
    already sets full_record when the sk_msg ring fills up, MSG_MORE or not.
    
      BUG: KASAN: slab-out-of-bounds in tls_append_frag ( net/tls/tls_device.c:269)
      Write of size 8 at addr ffff8881104d1530 by task tls_oob/450
    
      CPU: 2 UID: 0 PID: 450 Comm: tls_oob Not tainted 7.2.0-rc7+ #329 PREEMPT
      Call Trace:
       <TASK>
       dump_stack_lvl (lib/dump_stack.c:94 lib/dump_stack.c:120)
       print_report (mm/kasan/report.c:378 mm/kasan/report.c:482)
       kasan_report (mm/kasan/report.c:595)
       tls_append_frag (net/tls/tls_device.c:269)
       tls_push_data (net/tls/tls_device.c:518)
       tls_device_sendmsg (net/tls/tls_device.c:583)
       inet_sendmsg (net/ipv4/af_inet.c:865)
       sock_sendmsg (net/socket.c:775 net/socket.c:790 net/socket.c:813)
       splice_to_socket (fs/splice.c:884)
       do_splice (fs/splice.c:936 fs/splice.c:1349)
       __do_splice (fs/splice.c:1431)
       __x64_sys_splice (fs/splice.c:1634 fs/splice.c:1616)
       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)
       </TASK>
    
    and, once the record is pushed:
    
      UBSAN: array-index-out-of-bounds in net/tls/tls_device.c:300:24
      index 18 is out of range for type 'skb_frag_t [17]'
      UBSAN: array-index-out-of-bounds in net/tls/tls_device.c:301:41
      index 18 is out of range for type 'scatterlist [17]'
      UBSAN: array-index-out-of-bounds in net/tls/tls_device.c:302:39
      index 18 is out of range for type 'scatterlist [17]'
      UBSAN: array-index-out-of-bounds in net/tls/tls_device.c:307:38
      index 26 is out of range for type 'scatterlist [17]'
    
      kernel tried to execute NX-protected page - exploit attempt? (uid: 0)
      BUG: unable to handle page fault for address: ffffea000411a680
      #PF: supervisor instruction fetch in kernel mode
      #PF: error_code(0x0011) - permissions violation
      Oops: Oops: 0011 [#1] SMP KASAN PTI
      Workqueue: ktls_device_destruct 0xffffea000411a680
      RIP: 0010:0xffffea000411a680
      Call Trace:
       <TASK>
       worker_thread (kernel/workqueue.c:3405 kernel/workqueue.c:3486)
       kthread (kernel/kthread.c:436)
       ret_from_fork (arch/x86/kernel/process.c:158)
       ret_from_fork_asm (arch/x86/entry/entry_64.S:245)
       </TASK>
    
    Fixes: e8f69799810c ("net/tls: Add generic NIC offload infrastructure")
    Cc: stable@vger.kernel.org
    Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
    Link: https://patch.msgid.link/20260823084758.20936-1-jiayuan.chen@linux.dev
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
USB: c67x00: fix use-after-free in c67x00_add_iso_urb() [+ + +]
Author: Shuangpeng Bai <shuangpeng.kernel@gmail.com>
Date:   Wed Aug 5 21:35:02 2026 -0400

    USB: c67x00: fix use-after-free in c67x00_add_iso_urb()
    
    commit b1e24de475bf2d66fffc9103f3444b783527d55a upstream.
    
    When TD creation fails for the last packet of an isochronous URB,
    c67x00_add_iso_urb() gives the URB back before updating the endpoint
    scheduling state.
    
    c67x00_giveback_urb() frees the URB private data, and the completion
    callback may release the final URB reference. The following accesses to
    urbp->ep_data, urb->interval, and urbp->cnt can therefore use freed
    memory.
    
    Update next_frame and cnt before giving back the failed final packet,
    making the giveback the last operation that uses the URB and its private
    data.
    
    Fixes: e9b29ffc519b ("USB: add Cypress c67x00 OTG controller HCD driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Shuangpeng Bai <shuangpeng.kernel@gmail.com>
    Link: https://patch.msgid.link/20260806013502.322067-1-shuangpeng.kernel@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
usb: core: Add lock to usb_wakeup_notification() [+ + +]
Author: Griffin Kroah-Hartman <griffin@kroah.com>
Date:   Mon Jul 13 17:43:53 2026 +0200

    usb: core: Add lock to usb_wakeup_notification()
    
    commit e263e18a9e7b1ff3e7301f0801c6ff87c31adfb6 upstream.
    
    Add a spin lock to usb_wakeup notification to prevent a race condition
    with dereferencing freed memory. This could be hit by the xHCI driver as
    it calls this function from an IRQ and could race with the
    hub_disconnect() function, which properly grabs this lock to protect the
    state of the device.
    
    Assisted-by: gkh_clanker_t1000
    Signed-off-by: Griffin Kroah-Hartman <griffin@kroah.com>
    Link: https://patch.msgid.link/20260713-usb_core_patches_1-v1-3-7721c2b33f53@kroah.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: core: Strengthen error handling in hub_hub_status() [+ + +]
Author: Griffin Kroah-Hartman <griffin@kroah.com>
Date:   Wed Jul 22 10:17:39 2026 +0200

    usb: core: Strengthen error handling in hub_hub_status()
    
    commit a29496745aa335d97f617385809583241e118610 upstream.
    
    Add additional error handling after the call to get_hub_status() in
    hub_hub_status().
    
    get_hub_status() uses usb_control_msg() which does not verify that the
    message is the correct length, substituting it for
    usb_control_msg_recv() would also solve this issue but increase memory
    allocations.
    
    Instead, error handling is copied from the method used in
    hub_ext_port_status(), which shares the same flow of logic as
    hub_hub_status().
    
    Assisted-by: gkh_clanker_t1000
    Signed-off-by: Griffin Kroah-Hartman <griffin@kroah.com>
    Link: https://patch.msgid.link/20260722-usb_core_patches_2-v3-1-87622252bfdd@kroah.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: gadget: f_tcm: keep port count until LUN teardown completes [+ + +]
Author: Shuangpeng Bai <shuangpeng.kernel@gmail.com>
Date:   Fri Aug 7 02:07:33 2026 -0400

    usb: gadget: f_tcm: keep port count until LUN teardown completes
    
    commit c39d0916da47d94909391876c9e5bd429ea7b1b9 upstream.
    
    tcm_usbg_drop_nexus() permits session removal once tpg_port_count
    reaches zero. However, usbg_port_unlink() currently decrements that
    count from the fabric_pre_unlink() callback, before core_dev_del_lun()
    waits for active se_lun references to drain.
    
    If removal of the last LUN races a nexus removal, the latter can observe
    a zero port count and call target_remove_session(). This frees
    sess_cmd_map while an in-flight struct usbg_cmd, including its work item,
    can still be accessed.
    
    Overlapping the last-LUN unlink with nexus removal reproduces this
    lifetime violation as a DEBUG_OBJECTS "free active" warning for
    usbg_cmd_work, followed by a target-core BUG/Oops.
    
    The generic target-core unlink path has no callback after
    core_dev_del_lun() completes. Add an optional fabric_post_unlink()
    callback and use it for the f_tcm port count. The count now remains
    nonzero until core_dev_del_lun() has finished draining active LUN
    references, preventing nexus removal from freeing the session during
    command completion.
    
    Fixes: c52661d60f63 ("usb-gadget: Initial merge of target module for UASP + BOT")
    Cc: stable@vger.kernel.org
    Signed-off-by: Shuangpeng Bai <shuangpeng.kernel@gmail.com>
    Link: https://patch.msgid.link/20260807060733.3186624-1-shuangpeng.kernel@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
USB: serial: option: fix slab OOB read in interrupt URB callback [+ + +]
Author: Jiale Yao <yaojiale02@163.com>
Date:   Sun Jul 26 00:27:51 2026 +0800

    USB: serial: option: fix slab OOB read in interrupt URB callback
    
    commit 885d802f544ca7bfa8f3984d94233cce715bb6b3 upstream.
    
    The interrupt URB buffer is allocated in setup_port_interrupt_in() based
    on the endpoint's wMaxPacketSize:
    
        buffer_size = usb_endpoint_maxp(epd);
        port->interrupt_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
    
    When a USB device declares wMaxPacketSize = 8 on its interrupt IN
    endpoint, the buffer is allocated from kmalloc-8 cache (exactly
    8 bytes).
    
    If the device sends a short packet (actual_length < wMaxPacketSize),
    the URB completes with status == 0 and the callback proceeds to read:
    
        data[sizeof(struct usb_ctrlrequest)]
    
    which evaluates to data[8], accessing 1 byte beyond the allocated 8-byte
    buffer. This results in a slab out-of-bounds read.
    
    Fix this by adding the missing bounds check: first verify that the
    actual length is large enough to contain the struct usb_ctrlrequest
    header before accessing req_pkt->bRequestType and req_pkt->bRequest,
    and then verify that there is an additional byte for the modem signal
    state before reading data[sizeof(struct usb_ctrlrequest)] inside the
    conditional.  Use sizeof(*req_pkt) instead of sizeof(struct
    usb_ctrlrequest) for consistency.
    
    Assisted-by: Claude:deepseek-v4-pro
    Signed-off-by: Jiale Yao <yaojiale02@163.com>
    Fixes: 58cfe9113e48 ("[PATCH] USB: add Option Card driver")
    Cc: stable@vger.kernel.org      # v2.6.12
    [ johan: use dev_err(); split signals declaration and initialisation ]
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: spcp8x5: drop broken carrier detect support [+ + +]
Author: Johan Hovold <johan@kernel.org>
Date:   Thu Aug 6 15:52:48 2026 +0200

    USB: serial: spcp8x5: drop broken carrier detect support
    
    commit d37186bd95a07e334447f47274a38a311dad2172 upstream.
    
    The driver does not support modem status notifications and instead used
    to fetch the modem status once at open() and subsequently operate on and
    report stale state.
    
    As part of fixing this, a call to fetch the status was added to
    carrier_raised(), which does not work as that callback must not sleep
    (e.g. unlike tiocmget()).
    
    Drop the broken carrier detect support.
    
    Fixes: e1ed212d8593 ("USB: spcp8x5: add proper modem-status support")
    Cc: stable@vger.kernel.org      # 3.10
    Reported-by: syzbot+3b514b87202742f22c44@syzkaller.appspotmail.com
    Link: https://lore.kernel.org/all/6a73cea2.01d0871a.3a0d52.000d.GAE@google.com
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
usb: usbfs: fix use-after-free of usb_device in usbdev_release() [+ + +]
Author: Miguel Peñaranda <mig.penaranda07@gmail.com>
Date:   Mon Aug 10 14:12:09 2026 +0200

    usb: usbfs: fix use-after-free of usb_device in usbdev_release()
    
    commit 0dd68b5d01d022fc9c5e71c82a82b0a94d3d0671 upstream.
    
    usbdev_release() drops its reference to the struct usb_device before
    draining the list of completed async URBs, but that drain path reads back
    through the same object: free_async() calls dec_usb_memory_use_count()
    for any URB whose buffer came from the usbfs mmap() region, and its first
    statement is bus_to_hcd(ps->dev->bus).
    
    After a disconnect the usbfs reference can be the last one, in which case
    usb_put_dev() frees the device and the subsequent loop reads offset 80 of
    freed memory and uses the result as a struct usb_hcd *, which
    hcd_buffer_free_pages() then dereferences.
    
    This is reachable by an unprivileged process that has read/write access to
    a /dev/bus/usb node: mmap() the fd, submit one URB with a buffer inside the
    mapping, wait for the device to be unplugged, then munmap() and close().
    It reproduces on every attempt rather than being a race, because a live
    MAP_SHARED vma holds a reference on the struct file, so usbdev_release()
    cannot run until the last vma is gone and the freeing branch of
    dec_usb_memory_use_count() is always taken.
    
      BUG: KASAN: slab-use-after-free in dec_usb_memory_use_count+0x3ae/0x410
      Read of size 8 at addr ffff8880122ee050 by task poc/769
      CPU: 1 UID: 1000 PID: 769 Comm: poc Tainted: G    B    6.12.94 #3
    
      Call Trace:
       dec_usb_memory_use_count+0x3ae/0x410
       free_async+0x2aa/0x4f0
       usbdev_release+0x375/0x460
       __fput+0x3ea/0xb50
       __x64_sys_close+0x86/0x100
    
      Allocated by task 11:
       usb_alloc_dev+0x55/0xd90
       hub_event+0x2524/0x43d0
    
      Freed by task 769:
       kfree+0x121/0x360
       device_release+0xd2/0x280
       usb_put_dev+0x23/0x30
       usbdev_release+0x2d8/0x460
    
    Release the device reference after the drain loop instead. Nothing between
    the two points requires it to have been dropped.
    
    Fixes: f7d34b445abc ("USB: Add support for usbfs zerocopy.")
    Cc: stable@vger.kernel.org
    Assisted-by: Claude:claude-opus-5
    Signed-off-by: Miguel Peñaranda <mig.penaranda07@gmail.com>
    Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
    Link: https://patch.msgid.link/20260810121209.795089-1-mig.penaranda07@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: usbtest: disable dynamic ID support [+ + +]
Author: Aleksandr Nogikh <nogikh@google.com>
Date:   Thu Aug 6 15:26:51 2026 +0000

    usb: usbtest: disable dynamic ID support
    
    commit 00e2071f6d5621a5ddea311a5e6b143ae6e474af upstream.
    
    The usbtest driver relies on the driver_info field of struct usb_device_id
    to point to a valid struct usbtest_info descriptor. This structure contains
    essential test configurations, such as endpoint addresses and test modes,
    which are required during probe.
    
    When a user dynamically adds a new device ID via the sysfs new_id
    interface without specifying a reference device, the USB core initializes
    driver_info to 0 (NULL). When a matching device is subsequently probed,
    usbtest_probe() unconditionally casts driver_info to a struct usbtest_info
    pointer and dereferences it, leading to a NULL pointer dereference crash:
    
      Oops: general protection fault, probably for non-canonical address
      0xdffffc0000000001: 0000 [#1] SMP KASAN NOPTI
      KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
      RIP: 0010:usbtest_probe+0x3b9/0x1280 drivers/usb/misc/usbtest.c:2822
    
    Because usbtest strictly requires pre-defined usbtest_info descriptors
    to function, dynamic ID binding via sysfs is fundamentally unsupported
    for this driver.
    
    Fix this by setting .no_dynamic_id = 1 on usbtest_driver. This instructs
    the USB core to skip creating the new_id and remove_id sysfs interfaces
    for usbtest, preventing invalid dynamic ID entries from being created.
    
    Cc: stable@vger.kernel.org
    Reported-by: syzbot+7e1e5911f9eac50bedc7@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=7e1e5911f9eac50bedc7
    Signed-off-by: Aleksandr Nogikh <nogikh@google.com>
    Tested-by: syzbot@syzkaller.appspotmail.com
    Link: https://patch.msgid.link/20260806152651.2370795-1-nogikh@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

usb: xhci: Handle USB3 port events when there is one roothub [+ + +]
Author: Semih Baskan <strst.gs@gmail.com>
Date:   Thu Aug 6 17:21:12 2026 +0300

    usb: xhci: Handle USB3 port events when there is one roothub
    
    commit 3e91ec3e7d80a327fb558207613c80415d3bf756 upstream.
    
    handle_port_status() drops every USB3 port event when xhci->shared_hcd is
    NULL. The check dates from a time when xhci-plat always created a shared
    hcd, so a NULL one could only mean the hcd had been removed.
    
    Since commit 4736ebd7fcaf ("usb: host: xhci-plat: omit shared hcd if
    either root hub has no ports") that is no longer true. A controller whose
    USB2 root hub has no ports gets a single roothub, the USB3 rhub is served
    by the main hcd, and shared_hcd stays NULL for the lifetime of the device.
    Every SuperSpeed port event is then thrown away as bogus behind a debug
    message, so devices never enumerate even though the port sees the device
    and its change bits stay set:
    
      0x006a1203 Powered Connected Enabled Link:U0 PortSpeed:4
      Change: CSC WRC PRC PLC
    
    Broadcom Northstar is such a controller. USB3 works there up to 5.15 and
    stops working from 5.19 onwards.
    
    Ask xhci_get_usb3_hcd() instead. It returns the shared hcd when there is
    one, the main hcd when the USB2 root hub has no ports, and NULL once the
    shared hcd is gone, which keeps the original meaning of the check.
    
    Tested on an Asus RT-N18U (BCM47081), which has a single roothub. Before
    the change nothing enumerates on the USB3 port; after it SuperSpeed
    devices enumerate normally over repeated connect and disconnect cycles,
    the change bits shown above clear, and USB2 is unaffected on both ports.
    
    Fixes: 4736ebd7fcaf ("usb: host: xhci-plat: omit shared hcd if either root hub has no ports")
    Cc: stable@vger.kernel.org
    Signed-off-by: Semih Baskan <strst.gs@gmail.com>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://patch.msgid.link/20260806142113.2436238-17-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
veth: fix OOB txq access in veth_poll() with asymmetric queue counts [+ + +]
Author: Jesper Dangaard Brouer <hawk@kernel.org>
Date:   Tue May 5 15:21:53 2026 +0200

    veth: fix OOB txq access in veth_poll() with asymmetric queue counts
    
    [ Upstream commit 08f566e8f83bb70f04ad5aba5be352c490a01c8a ]
    
    XDP redirect into a veth device (via bpf_redirect()) calls
    veth_xdp_xmit(), which enqueues frames into the peer's ptr_ring using
      smp_processor_id() % peer->real_num_rx_queues
    as the ring index.  With an asymmetric veth pair where the peer has
    fewer TX queues than RX queues, that index can exceed
    peer->real_num_tx_queues.
    
    veth_poll() then resolves peer_txq for the ring via:
    
      peer_txq = peer_dev ? netdev_get_tx_queue(peer_dev, queue_idx) : NULL;
    
    where queue_idx = rq->xdp_rxq.queue_index.  When queue_idx exceeds
    peer_dev->real_num_tx_queues this is an out-of-bounds (OOB) access
    into the peer's netdev_queue array, triggering DEBUG_NET_WARN_ON_ONCE
    in netdev_get_tx_queue().
    
    The normal ndo_start_xmit path is not affected: the stack clamps
    skb->queue_mapping via netdev_cap_txqueue() before invoking
    ndo_start_xmit, so rxq in veth_xmit() never exceeds real_num_tx_queues.
    
    Fix veth_poll() by clamping: only dereference peer_txq when queue_idx is
    within bounds, otherwise set it to NULL.  The out-of-range rings are fed
    exclusively via XDP redirect (veth_xdp_xmit), never via ndo_start_xmit
    (veth_xmit), so the peer txq was never stopped and there is nothing to
    wake; NULL is the correct fallback.
    
    Reported-by: Sashiko <sashiko-bot@kernel.org>
    Closes: https://lore.kernel.org/all/20260502071828.616C3C19425@smtp.kernel.org/
    Fixes: dc82a33297fc ("veth: apply qdisc backpressure on full ptr_ring to reduce TX drops")
    Signed-off-by: Jesper Dangaard Brouer <hawk@kernel.org>
    Link: https://patch.msgid.link/20260505132159.241305-2-hawk@kernel.org
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

 
vxlan: keep the last remote linked during FDB flush [+ + +]
Author: Kyle Zeng <kylebot@openai.com>
Date:   Mon Aug 10 14:41:14 2026 +0000

    vxlan: keep the last remote linked during FDB flush
    
    commit d5d4a7b538b52db63927773a8905fcd9f78a42e2 upstream.
    
    A non-nexthop FDB entry is expected to have at least one remote while it
    remains reachable through the FDB hash table. A filtered bulk flush
    violates this invariant when every remote matches: It unlinks the last
    remote in vxlan_fdb_dst_destroy() and only afterwards tells vxlan_flush()
    to destroy the parent FDB entry.
    
    An RCU reader can find the parent during this interval.
    first_remote_rcu() then applies list_entry_rcu() to the empty list head,
    producing an invalid remote pointer that the receive learning path can
    read from and write to.
    
    When a matching remote is the sole remaining remote, leave it linked and
    ask the caller to destroy the entire FDB entry. vxlan_fdb_destroy() keeps
    the remote attached while sending the deletion notification and removing
    the parent from the lookup structures.
    
    Fixes: c499fccb71cb ("vxlan: vxlan_core: Support FDB flushing by destination VNI")
    Cc: stable@vger.kernel.org
    Signed-off-by: Kyle Zeng <kylebot@openai.com>
    Co-developed-by: David Lee <david.lee@trailofbits.com>
    Signed-off-by: David Lee <david.lee@trailofbits.com>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Link: https://patch.msgid.link/20260810144115.821654-1-david.lee@trailofbits.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
wifi: mt76: mt7925: ensure tx headroom in usb_sdio_tx_prepare_skb [+ + +]
Author: Devin Wittmayer <lucid_duck@justthetip.ca>
Date:   Tue Jul 14 19:33:48 2026 -0700

    wifi: mt76: mt7925: ensure tx headroom in usb_sdio_tx_prepare_skb
    
    commit ef3e34874d2332d0f63e72c2c35ce5c93568c125 upstream.
    
    mt7925_usb_sdio_tx_prepare_skb() pushes a TX descriptor and a USB
    header onto every skb and assumes the headroom for them is already
    there. That holds for locally generated traffic, where mac80211
    reserves hw->extra_tx_headroom, but forwarded frames are sent through
    ieee80211_8023_xmit(), which does not reserve it. Bridge a wired
    interface to an mt7925u AP and the first forwarded frame that arrives
    short panics the kernel:
    
     skbuff: skb_under_panic: len:415 put:4 tail:0x19b end:0x640 dev:wlan1
     kernel BUG at net/core/skbuff.c:212!
     Call trace:
      skb_panic+0x58/0x60 (P)
      skb_push+0x58/0x60
      mt7925_usb_sdio_tx_prepare_skb+0xf8/0x1b8 [mt7925_common]
      mt76u_tx_queue_skb+0xa0/0x1f8 [mt76_usb]
      __mt76_tx_queue_skb+0x54/0xe8 [mt76]
      mt76_txq_schedule.part.0+0x204/0x478 [mt76]
      mt76_txq_schedule_all+0x50/0x80 [mt76]
      mt792x_tx_worker+0x68/0x100 [mt792x_lib]
      __mt76_worker_fn+0x84/0x150 [mt76]
    
    Whether a given setup hits it depends on how much headroom the ingress
    netdev leaves in its rx skbs. Reproduced on a Raspberry Pi 5 bridging
    onboard ethernet to a Netgear A9000; originally reported on an MT7986
    router running OpenWrt. Nick Morrow's testing on a Pi 4 (bcmgenet),
    which leaves more headroom, helped narrow the trigger to the ingress
    path.
    
    The same bug was fixed on mt7921 by commit 98c4d0abf5c4 ("mt76:
    mt7921: don't assume adequate headroom for SDIO headers"), but mt7925
    was copied from mt7921 without the fix. Add the same guard here.
    
    Fixes: c948b5da6bbe ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips")
    Cc: stable@vger.kernel.org
    Link: https://github.com/morrownr/mt76/issues/52
    Signed-off-by: Devin Wittmayer <lucid_duck@justthetip.ca>
    Link: https://patch.msgid.link/20260715023348.59506-1-lucid_duck@justthetip.ca
    Signed-off-by: Felix Fietkau <nbd@nbd.name>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

 
xfrm: ah6: validate routing header segments_left [+ + +]
Author: Asim Viladi Oglu Manizada <manizada@pm.me>
Date:   Thu Jul 23 09:35:48 2026 +0000

    xfrm: ah6: validate routing header segments_left
    
    commit 7bad4bda74dc4713f398d3b7624ff05478e3a568 upstream.
    
    AH6 rearranges routing-header addresses before computing or verifying the
    ICV. ipv6_rearrange_rthdr() assumes that segments_left is not larger than
    the number of addresses described by the routing header's hdrlen field.
    
    That assumption does not hold for raw IPv6 HDRINCL packets. A packet with
    hdrlen equal to 2 describes one address, but can carry an arbitrary
    segments_left value. With segments_left equal to 255, the function moves
    its address pointer 4,064 bytes backwards and passes a 4,064-byte length to
    memmove(), resulting in an out-of-bounds access.
    
    Validate the invariant locally before modifying the routing header or
    performing any address-pointer arithmetic, and propagate malformed-header
    errors to the existing AH6 input and output error paths.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable@vger.kernel.org
    Assisted-by: avom-custom-harness:gpt-5.5-qwen3.6-mod-mix
    Signed-off-by: Asim Viladi Oglu Manizada <manizada@pm.me>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfrm: avoid lock inversion in nat keepalive work [+ + +]
Author: Zihan Xi <xizh2024@lzu.edu.cn>
Date:   Tue Jul 21 23:25:42 2026 +0800

    xfrm: avoid lock inversion in nat keepalive work
    
    commit 763fe700b7c58ad64fe5202c5638848244dd4127 upstream.
    
    nat_keepalive_work() walks the state table while xfrm_state_walk()
    holds net->xfrm.xfrm_state_lock. Its callback then acquires x->lock,
    which conflicts with the delete path taking the same locks in reverse
    order via xfrm_state_delete() and __xfrm_state_delete(). This creates
    an AB-BA deadlock that is reported by lockdep when a NAT keepalive
    worker races with SA deletion.
    
    Fix this by splitting the keepalive walk into two phases. First,
    collect the candidate states while the walk holds xfrm_state_lock and
    take a reference on each state. Then, after the walk completes, process
    each collected state and acquire x->lock without nesting it under
    xfrm_state_lock.
    
    Fixes: f531d13bdfe3 ("xfrm: support sending NAT keepalives in ESP in UDP states")
    Cc: stable@vger.kernel.org
    Reported-by: Vega <vega@nebusec.ai>
    Assisted-by: Codex:gpt-5.4
    Signed-off-by: Zihan Xi <xizh2024@lzu.edu.cn>
    Signed-off-by: Ren Wei <enjou1224z@gmail.com>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfrm: bound nat keepalive state collection [+ + +]
Author: Zihan Xi <zihanx@nebusec.ai>
Date:   Mon Aug 17 19:09:56 2026 +0000

    xfrm: bound nat keepalive state collection
    
    commit 4e9442ce551ebd84b52ad649df721e2dc28af95a upstream.
    
    The v1 nat keepalive fix allocates a GFP_ATOMIC object for every state
    while collecting references for phase two. This makes the worker's
    temporary memory use depend on the number of states and lets -ENOMEM abort
    the scan.
    
    Replace the allocated list with a fixed-size batch. When the batch is full,
    return a private walk status so xfrm_state_walk() leaves a cursor; drain
    the references after the walk releases xfrm_state_lock and resume from
    the cursor. This bounds temporary memory use and avoids the allocation
    failure path.
    
    The v1 fix also moved nat_keepalive_send() out of the walk callback. Keep
    the phase-two drain BH-disabled, as required by local_lock_nested_bh()
    used by the keepalive sockets.
    
    Fixes: 763fe700b7c5 ("xfrm: avoid lock inversion in nat keepalive work")
    Cc: stable@vger.kernel.org
    Cc: Eyal Birger <eyal.birger@gmail.com>
    Reported-by: Vega <vega@nebusec.ai>
    Assisted-by: Codex:gpt-5.4
    Signed-off-by: Zihan Xi <zihanx@nebusec.ai>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfrm: drop ESP-in-TCP packets with no ingress device [+ + +]
Author: Zhiling Zou <roxy520tt@gmail.com>
Date:   Sat Jul 18 15:12:50 2026 +0800

    xfrm: drop ESP-in-TCP packets with no ingress device
    
    commit e1d7c5ac1c246ce5775f604515de0a59fbf2116e upstream.
    
    ESP-in-TCP receives records through the TCP strparser. handle_esp()
    restores skb->dev from the saved skb_iif before passing the packet into
    the XFRM input path.
    
    Queued TCP data can be processed after the original ingress device has
    been removed, for example during veth or net namespace teardown. In that
    case dev_get_by_index_rcu() returns NULL. The XFRM IPv4 and IPv6 input
    paths both expect skb->dev to be valid while building the route lookup,
    so queued ESP-in-TCP data can dereference a NULL device.
    
    Drop the packet if the saved ingress device can no longer be resolved.
    Such a packet can no longer be routed through the normal XFRM receive
    path, and this preserves the existing behaviour for packets whose ingress
    device still exists.
    
    Fixes: e27cca96cd68 ("xfrm: add espintcp (RFC 8229)")
    Cc: stable@vger.kernel.org
    Reported-by: Vega <vega@nebusec.ai>
    Signed-off-by: Zhiling Zou <roxy520tt@gmail.com>
    Assisted-by: Codex:gpt-5.4
    Reviewed-by: Ren Wei <enjou1224z@gmail.com>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfrm: espintcp: fix UAF during close [+ + +]
Author: Sabrina Dubroca <sd@queasysnail.net>
Date:   Thu Jul 16 22:54:59 2026 +0200

    xfrm: espintcp: fix UAF during close
    
    commit deb232e884877bf10b4ce2580909eedec986c284 upstream.
    
    ZDI reported and analyzed a race condition during close for espintcp
    sockets:
    
        espintcp_close() frees emsg->skb via kfree_skb() without holding
        any socket lock. Concurrently, the xfrm_trans_reinject work queue
        invokes esp_output_tcp_finish() -> espintcp_push_skb() ->
        espintcp_push_msgs() -> skb_send_sock_locked(), which reads the
        same skb as a data source.
    
    Fix this by adding a synchronize_rcu() call after resetting sk_prot,
    since esp_output_tcp_finish() runs under RCU and won't use a socket
    with sk_prot == &tcp_prot.  Simply taking the socket lock in
    espintcp_close() could lead to leaks, if esp_output_tcp_finish()
    re-adds an skb in the slot we just freed. After this, the existing
    barrier() is no longer needed.
    
    Cc: stable@vger.kernel.org
    Fixes: e27cca96cd68 ("xfrm: add espintcp (RFC 8229)")
    Reported-by: zdi-disclosures@trendmicro.com
    Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
    Reviewed-by: Breno Leitao <leitao@debian.org>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xfrm: fix xfrm_state_construct() auth-trunc leak [+ + +]
Author: Zihan Xi <zihanx@nebusec.ai>
Date:   Tue Jul 28 01:30:32 2026 +0800

    xfrm: fix xfrm_state_construct() auth-trunc leak
    
    commit c12cbf56320fb633484ee0ca1fb7d68d6b64b213 upstream.
    
    attach_auth_trunc() can allocate x->aalg while leaving
    x->props.aalgo at zero when the selected auth algorithm has no
    sadb_alg_id. One real case is cmac(aes).
    
    xfrm_state_construct() then treats !x->props.aalgo as "no auth
    algorithm attached yet" and calls attach_auth(). That overwrites
    x->aalg and loses the first allocation. Any later failure or teardown
    only frees the replacement pointer.
    
    Check whether x->aalg is already attached instead of inferring that
    state from x->props.aalgo.
    
    Fixes: 4447bb33f094 ("xfrm: Store aalg in xfrm_state with a user specified truncation length")
    Cc: stable@vger.kernel.org
    Reported-by: Vega <vega@nebusec.ai>
    Assisted-by: Codex:gpt-5.4
    Signed-off-by: Zihan Xi <zihanx@nebusec.ai>
    Signed-off-by: Ren Wei <enjou1224z@gmail.com>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 
xhci: dbgtty: Fix unregister on tty_alloc_driver() failure [+ + +]
Author: Lucas De Marchi <ldemarchi@nvidia.com>
Date:   Thu Aug 6 17:21:04 2026 +0300

    xhci: dbgtty: Fix unregister on tty_alloc_driver() failure
    
    commit 25b8dfc13495a6c1cf4abacc8ef20196c7f20e5c upstream.
    
    Make sure to set dbc_tty_driver to NULL to match the check in
    dbc_tty_exit(). For that, make detached error handling path common to the
    other branch in the same function.
    
    Fixes: 4521f1613940 ("xhci: dbctty: split dbc tty driver registration and unregistration functions.")
    Cc: stable@vger.kernel.org # v5.10
    Cc: Mathias Nyman <mathias.nyman@linux.intel.com>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Lucas De Marchi <ldemarchi@nvidia.com>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://patch.msgid.link/20260806142113.2436238-9-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

xhci: dbgtty: Fix unregister on tty_register_driver() failure [+ + +]
Author: Lucas De Marchi <ldemarchi@nvidia.com>
Date:   Thu Aug 6 17:21:03 2026 +0300

    xhci: dbgtty: Fix unregister on tty_register_driver() failure
    
    commit a916fa66a43e10f63198b6ce978badffc678821a upstream.
    
    If tty_register_driver() fails, it drops the reference, but fails to set
    the global dbc_tty_driver to NULL, causing the unregister to be called
    again when module exits.
    
    On module unload dbc_tty_exit() only gates its cleanup on the driver
    pointer being non-NULL, so it operates on the already-freed driver:
    
        module_init(xhci_hcd_init)
          xhci_hcd_init()
            xhci_dbc_init()                       [return value ignored]
              dbc_tty_init()
                tty_register_driver() fails
                  tty_driver_kref_put()           -> driver freed
                  (dbc_tty_driver left dangling)
        ...
        module_exit(xhci_hcd_fini)
          xhci_hcd_fini()
            xhci_dbc_exit()
              dbc_tty_exit()
                if (dbc_tty_driver)               -> true (dangling)
                  tty_unregister_driver()         -> use-after-free
    
    Fixes: 4521f1613940 ("xhci: dbctty: split dbc tty driver registration and unregistration functions.")
    Cc: stable@vger.kernel.org # v5.10
    Cc: Mathias Nyman <mathias.nyman@linux.intel.com>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Lucas De Marchi <ldemarchi@nvidia.com>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://patch.msgid.link/20260806142113.2436238-8-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>