Changelog in Linux kernel 7.1.11

 
ALSA: dummy: Check card index validity at probe [+ + +]
Author: Takashi Iwai <[email protected]>
Date:   Thu Aug 6 12:04:31 2026 +0200

    ALSA: dummy: Check card index validity at probe
    
    commit 02442d5fe8ee365a084b055d4fa81a0c1abfc3fd upstream.
    
    snd_dummy_probe() blindly trusts that the given devptr->id value is
    within the proper card index range.  It's OK for the devices the
    driver itself creates at the module probe time, but if the device is
    bound manually via sysfs interface, this could be -1 as "none", and
    this leads to OOB access for index[] and other parameters.
    
    Add a sanity check for the card index and warn/correct it if it's a
    value out of the range.
    
    Reported-by: [email protected]
    Closes: https://lore.kernel.org/[email protected]
    Cc: <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: FCP: Use a private URB for the notification endpoint [+ + +]
Author: Geoffrey D. Bennett <[email protected]>
Date:   Mon Aug 10 03:36:01 2026 +0930

    ALSA: FCP: Use a private URB for the notification endpoint
    
    commit 918b8d231c571c50a00efe92ffc8404a537a0490 upstream.
    
    fcp_init_notify() used mixer->urb, which snd_usb_mixer_status_create()
    allocates for the optional UAC2 status interrupt endpoint and mixer.c
    kills, resubmits and frees. On a device with that endpoint,
    fcp_init_notify()'s "already set up" early return fires on the status
    URB and returns success without doing anything. No FCP notification
    URB is submitted, and cmd_done is left zeroed because it is
    initialised past that early return and nowhere else. fcp_init() then
    issues init1_opcode and wait_for_completion_timeout() would crash
    adding to the zeroed wait.head. fcp_cleanup_urb() would also kill and
    free mixer.c's status URB.
    
    Use a separate URB in fcp_data, and initialise cmd_done in
    fcp_init_private() where fcp_data is allocated. fcp_init_notify() is
    reached again after suspend via fcp_reinit(), and the URB kill path in
    fcp_notify() completes cmd_done, leaving a stale count that would
    satisfy the next command's wait before the device ACKs. Use
    reinit_completion() to clear it.
    
    Fixes: 46757a3e7d50 ("ALSA: FCP: Add Focusrite Control Protocol driver")
    Cc: [email protected]
    Assisted-by: Claude:claude-opus-5
    Signed-off-by: Geoffrey D. Bennett <[email protected]>
    Signed-off-by: Takashi Iwai <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: scarlett2: Use a private URB for the notification endpoint [+ + +]
Author: Geoffrey D. Bennett <[email protected]>
Date:   Mon Aug 10 03:36:11 2026 +0930

    ALSA: scarlett2: Use a private URB for the notification endpoint
    
    commit cd17d6ff7b7d2b1dd9bcc80ae7b4a83773f918c6 upstream.
    
    scarlett2_init_notify() used mixer->urb, which
    snd_usb_mixer_status_create() allocates for the UAC2 status interrupt
    endpoint and mixer.c manages. On a device with that endpoint, the
    "already in use" check fires on the status URB and returns 0 for
    success without doing anything. No notification URB is submitted, and
    cmd_done is left zeroed because it is initialised past that check and
    nowhere else. scarlett2_usb_init() then issues SCARLETT2_USB_INIT_1
    and wait_for_completion_timeout() would crash adding to the zeroed
    wait.head.
    
    Use a separate URB in scarlett2_data, as done for FCP, and initialise
    cmd_done in scarlett2_init_private(). mixer.c was also freeing the URB
    in snd_usb_mixer_free() and resubmitting it in
    snd_usb_mixer_activate(), so scarlett2 must now do both: add
    scarlett2_cleanup_urb(), called from private_free and private_suspend,
    and a private_resume callback to re-establish the URB after resume.
    scarlett2_init_notify() is reached from there, and the URB kill path
    in scarlett2_notify() completes cmd_done, leaving a stale count that
    would satisfy the next command's wait before the device ACKs. Use
    reinit_completion() to clear it.
    
    Also free the URB if the transfer buffer allocation fails, and both if
    usb_submit_urb() fails. Move scarlett2_init_notify() up next to
    scarlett2_cleanup_urb() so scarlett2_init_private() can reference it
    without a forward declaration.
    
    Fixes: 1b65088958ca ("ALSA: scarlett2: Implement handling of the ACK notification")
    Cc: [email protected]
    Assisted-by: Claude:claude-opus-5
    Signed-off-by: Geoffrey D. Bennett <[email protected]>
    Signed-off-by: Takashi Iwai <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
Bluetooth: hci_aml: validate firmware segment lengths [+ + +]
Author: Laxman Acharya Padhya <[email protected]>
Date:   Thu Jul 30 18:05:28 2026 +0545

    Bluetooth: hci_aml: validate firmware segment lengths
    
    commit 2bf6b9baca9372ea51b6d0f2820dc9bf29a83ef4 upstream.
    
    aml_download_firmware() reads two lengths from the firmware header and
    uses them to build pointers before checking that the header and segment
    data are present. A truncated or inconsistent firmware image can make
    the driver read past firmware->data while constructing TCI commands.
    
    Reject images shorter than the header and ensure that the ICCM and DCCM
    ranges fit within the loaded firmware before downloading either segment.
    
    Fixes: 37bac77e4649 ("Bluetooth: hci_uart: Add support for Amlogic HCI UART")
    Cc: [email protected]
    Signed-off-by: Laxman Acharya Padhya <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

Bluetooth: hci_event: fix LE list UAF on reset [+ + +]
Author: Chengfeng Ye <[email protected]>
Date:   Thu Jul 30 16:32:02 2026 +0800

    Bluetooth: hci_event: fix LE list UAF on reset
    
    commit 33af47e847fe4a28b109673affb5874015d54f5a upstream.
    
    hci_cc_reset() clears the LE accept and resolving lists without taking
    hdev->lock. Other command-complete handlers serialize updates to these
    lists with that lock, and the debugfs readers hold it while walking them.
    
    This permits the reset completion and a debugfs read to interleave as
    follows:
    
      hci_rx_work                 debugfs reader
      -----------                 --------------
                                  lock hdev->lock
                                  fetch current entry
      list_del(entry)
      kfree(entry)
                                  read entry fields
    
    The reader then dereferences a freed list entry and may follow its stale
    next pointer.
    
    KASAN reported:
    
      BUG: KASAN: slab-use-after-free in white_list_show+0x15f/0x180
      Read of size 1 at addr ffff8881015dab16 by task poc/95
    
      Call Trace:
       white_list_show+0x15f/0x180
       seq_read_iter+0x3ff/0x1190
       seq_read+0x267/0x3d0
       vfs_read+0x177/0xa20
       ksys_read+0xf7/0x1c0
    
      Allocated by task 91:
       hci_bdaddr_list_add+0x1a6/0x3a0
       hci_cc_le_add_to_accept_list+0xab/0x140
       hci_cmd_complete_evt+0x26c/0x9a0
       hci_event_packet+0x454/0xb20
       hci_rx_work+0x293/0x730
    
      Freed by task 90:
       kfree+0x131/0x3c0
       hci_bdaddr_list_clear+0xd8/0x160
       hci_cc_reset+0x28a/0x370
       hci_cmd_complete_evt+0x26c/0x9a0
       hci_event_packet+0x454/0xb20
       hci_rx_work+0x293/0x730
    
    Take hdev->lock around both list clears. This matches the existing
    mutation and traversal locking convention.
    
    Fixes: a4d5504d5c39 ("Bluetooth: Clear LE white list when resetting controller")
    Fixes: cfdb0c2d095a ("Bluetooth: Store Resolv list size")
    Cc: [email protected]
    Signed-off-by: Chengfeng Ye <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

Bluetooth: hci_event: validate LE Set CIG Parameters response [+ + +]
Author: Laxman Acharya Padhya <[email protected]>
Date:   Sat Aug 1 23:54:52 2026 +0545

    Bluetooth: hci_event: validate LE Set CIG Parameters response
    
    commit 0acd4eeb4b225b9bebbf9ef96cc10cdd79b94899 upstream.
    
    The Command Complete dispatch validates only the fixed part of the LE Set
    CIG Parameters response. After that part is pulled from the skb,
    hci_cc_le_set_cig_params() trusts num_handles and reads each entry in the
    trailing handle array.
    
    Matching num_handles against the command's num_cis does not guarantee
    that the response contains the advertised handles. A truncated response
    from a malfunctioning controller can therefore make the handler read
    beyond the skb data.
    
    Validate that the remaining skb data contains all advertised handles.
    Include this in the existing response validation so malformed responses
    also follow the established CIG failure handling.
    
    Fixes: 26afbd826ee3 ("Bluetooth: Add initial implementation of CIS connections")
    Cc: [email protected]
    Signed-off-by: Laxman Acharya Padhya <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

Bluetooth: hci_sync: Fix accept list UAF during suspend [+ + +]
Author: Chengfeng Ye <[email protected]>
Date:   Sat Aug 1 15:05:24 2026 +0800

    Bluetooth: hci_sync: Fix accept list UAF during suspend
    
    commit f57b399c4fa1501b2d5451f52d861ece86bcf3db upstream.
    
    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: [email protected]
    Link: https://lore.kernel.org/linux-bluetooth/[email protected]/
    Signed-off-by: Chengfeng Ye <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

Bluetooth: ISO: do not force BT_LISTEN after a failed BIG sync [+ + +]
Author: Ali Ahmet Memis <[email protected]>
Date:   Fri Aug 7 00:59:55 2026 +0000

    Bluetooth: ISO: do not force BT_LISTEN after a failed BIG sync
    
    commit 9838a80096ba472d5e03057136a112631aabae6e upstream.
    
    iso_sock_recvmsg() handles the deferred setup of a broadcast sink by
    dropping the socket lock, calling iso_conn_big_sync() and taking the
    lock again:
    
            release_sock(sk);
            iso_conn_big_sync(sk);
            lock_sock(sk);
    
            sk->sk_state = BT_LISTEN;
    
    The state is written unconditionally, but iso_conn_big_sync() returns
    void and has paths that do nothing at all: hci_get_route() may fail, and
    after re-acquiring the socket lock the connection may already be gone,
    in which case it bails out without ever issuing an LE BIG Create Sync.
    
    While the lock is dropped the connection can be torn down, for example
    when the controller reports HCI_EV_LE_PA_SYNC_LOST:
    
            hci_le_pa_sync_lost_evt()
              hci_disconn_cfm() -> iso_disconn_cfm() -> iso_conn_del()
                iso_chan_del()
                  iso_pi(sk)->conn = NULL
                  sk->sk_state = BT_CLOSED
                  sock_set_flag(sk, SOCK_ZAPPED)
    
    iso_conn_big_sync() then finds conn == NULL and returns, but the caller
    still overwrites the BT_CLOSED that iso_chan_del() has just set. The
    socket ends up marked BT_LISTEN with no connection, so recvmsg() reports
    success for a setup that never happened and a later accept() waits for
    BIS connections that can never arrive instead of failing.
    
    A concurrent shutdown() reaches the same write by another route:
    __iso_sock_close() takes the BT_CONNECT2 PA sync path to
    iso_sock_disconn(), which sets BT_DISCONN but leaves conn and
    conn->hcon in place, so iso_conn_big_sync() succeeds and BT_LISTEN is
    written over BT_DISCONN. Both the BT_CONNECT2 and the BT_CONNECTED case
    write the state the same way.
    
    Let iso_conn_big_sync() report whether the BIG sync was started, and
    only move the socket to BT_LISTEN when it was and when the state has not
    changed while the lock was dropped, mirroring what the BT_CONNECT case
    of the same switch already does with iso_connect_cis(). Both conditions
    are needed, the error alone does not cover the shutdown() race.
    
    This corrupts the socket state machine only, it is not a memory safety
    issue. KASAN and lockdep stayed quiet in all of the runs below.
    
    Reproduced with an emulated controller over /dev/vhci on a KASAN +
    PROVE_LOCKING kernel. A PA sync broadcast sink socket is driven to
    BT_CONNECT2 and recvmsg() on it is raced against teardown, with a debug
    delay inside the lock-dropped section to widen the window:
    
     - HCI_EV_LE_PA_SYNC_LOST injected: 64 of 64 rounds left the socket in
       BT_LISTEN with the connection gone, recvmsg() returned 0 and accept()
       on that fd returned EAGAIN, which iso_sock_accept() can only do while
       the socket is BT_LISTEN. With this patch, 0 of 64, recvmsg() returns
       an error and accept() returns EBADFD.
    
     - shutdown() instead of a controller event: 24 of 32 rounds wedged in
       BT_LISTEN, 0 of 32 with this patch. With only the error check in
       place and a short window, one round still wedged while recvmsg()
       returned 0, which is the case the state re-check covers.
    
    An unraced control round behaves the same before and after: recvmsg()
    returns 0, the socket reaches BT_LISTEN and an LE BIG Create Sync is
    issued.
    
    Fixes: 7a17308c1788 ("Bluetooth: iso: Fix circular lock in iso_conn_big_sync")
    Cc: [email protected]
    Signed-off-by: Ali Ahmet Memis <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

Bluetooth: ISO: zero the sockaddr before returning it in getname [+ + +]
Author: Ali Ahmet Memis <[email protected]>
Date:   Thu Aug 6 23:06:21 2026 +0000

    Bluetooth: ISO: zero the sockaddr before returning it in getname
    
    commit 884cf2cc957da7ac178a0e6c6c69ddfec0481cc8 upstream.
    
    iso_sock_getname() fills a struct sockaddr_iso in place and returns its
    size without clearing it first, so bytes it does not write are copied to
    user space from the kernel stack. The getsockname(2) and getpeername(2)
    paths both run through do_getsockname(), which hands getname() an
    uninitialized sockaddr_storage on the stack and copies back up to the
    number of bytes getname() returns, so the driver has to initialize every
    byte it accounts for.
    
    Two ranges are left uninitialized:
    
      - struct sockaddr_iso is 10 bytes but only 9 are written (family,
        iso_bdaddr, iso_bdaddr_type), leaking the trailing pad byte on every
        call.
    
      - for a broadcast peer (BIS_LINK or PA_LINK) the returned length grows
        by sizeof(struct sockaddr_iso_bc), but only bc_sid, bc_num_bis and
        bc_bis are filled; bc_bdaddr and bc_bdaddr_type, the first 7 bytes of
        that structure, are never written.
    
    An unprivileged process can open a BTPROTO_ISO socket and reach the pad
    leak with getsockname(); the broadcast leak needs an established BIS/PA
    connection. l2cap and rfcomm already memset their sockaddr in getname
    for the same reason; do the same here.
    
    Fixes: ccf74f2390d6 ("Bluetooth: Add BTPROTO_ISO socket type")
    Fixes: 0a766a0affb5 ("Bluetooth: ISO: Fix getpeername not returning sockaddr_iso_bc fields")
    Cc: [email protected]
    Signed-off-by: Ali Ahmet Memis <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

Bluetooth: MGMT: reject HCI_CMD_SYNC params_len above 255 [+ + +]
Author: Ali Ahmet Memis <[email protected]>
Date:   Thu Aug 6 17:39:53 2026 +0000

    Bluetooth: MGMT: reject HCI_CMD_SYNC params_len above 255
    
    commit 5d95286b6d6e8f1d304da7522bfa6860fc017e48 upstream.
    
    mgmt_hci_cmd_sync() checks that the message length agrees with params_len
    but puts no upper bound on it. params_len is __le16 while the parameter
    length in the HCI command header is a u8:
    
            struct hci_command_hdr {
                    __le16  opcode;
                    __u8    plen;
            } __packed;
    
    hci_cmd_sync_alloc() assigns one to the other:
    
            hdr->plen = plen;
    
            if (plen)
                    skb_put_data(skb, param, plen);
    
    so a params_len of 256 leaves plen at 0 while all 256 bytes are still
    appended. The frame handed to the driver then declares no parameters and
    carries 256 of them. On a length framed transport such as H:4 the
    controller takes the trailing bytes as the start of the next packet.
    
    The mgmt socket MTU is HCI_MAX_FRAME_SIZE, so params_len can reach about
    1KB this way. Commit 03f1700b9b4d ("Bluetooth: MGMT: reject malformed
    HCI_CMD_SYNC commands") only made params_len agree with the message
    length, a value that fits the message but not the header field is still
    accepted.
    
    Reject params_len that does not fit the header field.
    
    Fixes: 827af4787e74 ("Bluetooth: MGMT: Add initial implementation of MGMT_OP_HCI_CMD_SYNC")
    Cc: [email protected]
    Signed-off-by: Ali Ahmet Memis <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

Bluetooth: RFCOMM: take rfcomm_mutex for the deferred setup accept [+ + +]
Author: Ali Ahmet Memis <[email protected]>
Date:   Fri Aug 7 02:03:44 2026 +0000

    Bluetooth: RFCOMM: take rfcomm_mutex for the deferred setup accept
    
    commit 43a556b2fd43f2df6dded59c2e26560a27874c24 upstream.
    
    rfcomm_sock_recvmsg() completes a deferred setup by calling
    rfcomm_dlc_accept() without holding any RFCOMM lock:
    
            if (test_and_clear_bit(RFCOMM_DEFER_SETUP, &d->flags)) {
                    rfcomm_dlc_accept(d);
                    return 0;
            }
    
    and rfcomm_dlc_accept() dereferences the session on its first line:
    
            struct sock *sk = d->session->sock->sk;
    
    Every other path that touches d->session runs under rfcomm_mutex:
    rfcomm_dlc_open(), rfcomm_dlc_close(), rfcomm_dlc_exists(),
    rfcomm_dlc_send_rpn(), and the RFCOMM thread through
    rfcomm_process_sessions(). rfcomm_connect_ind() is even documented as
    "called under rfcomm_lock()". This call site is the only one that skips
    it.
    
    The RFCOMM_DEFER_SETUP bit looks like it serialises the accept against
    teardown, since __rfcomm_dlc_close() returns early when it wins the
    test_and_clear. But rfcomm_recv_disc() forces the state first:
    
            d->state = BT_CLOSED;
            __rfcomm_dlc_close(d, err);
    
    and the early return only covers BT_CONNECT, BT_CONFIG, BT_OPEN and
    BT_CONNECT2. With the state already BT_CLOSED that switch does not
    match, the bit is never consulted, and __rfcomm_dlc_close() falls
    through to rfcomm_dlc_unlink(), which sets d->session = NULL.
    
    So a remote DISC on a deferred dlc clears the session while leaving
    RFCOMM_DEFER_SETUP set. The next recvmsg() then passes the
    test_and_clear and dereferences a NULL session. No timing window is
    needed: once the DISC has been processed, the dereference is
    unconditional.
    
    Give rfcomm_dlc_accept() the same shape as rfcomm_dlc_open() and
    rfcomm_dlc_close(): an exported wrapper that takes rfcomm_mutex and
    re-checks the session, around a __rfcomm_dlc_accept() that the two
    in-core callers, which already hold the mutex, keep using.
    
    Reproduced on a KASAN + PROVE_LOCKING kernel with a BR/EDR peer emulated
    over /dev/vhci: the peer brings up an ACL link, opens L2CAP on the
    RFCOMM PSM, starts a session, opens a dlc on a channel bound with
    BT_DEFER_SETUP, and sends DISC after the socket is accepted. recv() on
    the accepted socket then hits:
    
      Oops: general protection fault
      KASAN: null-ptr-deref in range [0x0000000000000010-0x0000000000000017]
      RIP: 0010:rfcomm_dlc_accept+0x54/0x350
      Call Trace:
        rfcomm_sock_recvmsg+0x1cd/0x230
        sock_recvmsg+0x166/0x1c0
        __sys_recvfrom+0x20d/0x300
    
    0x10 is the offset of sock in struct rfcomm_session. With this patch the
    same run completes with recv() returning 0 and no report, and lockdep
    stays quiet, confirming rfcomm_mutex is still taken before lock_sock on
    this path as it is on the thread side.
    
    Fixes: bb23c0ab8246 ("Bluetooth: Add support for deferring RFCOMM connection setup")
    Cc: [email protected]
    Signed-off-by: Ali Ahmet Memis <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
dmaengine: fsl-edma: Add error handling for devm_kasprintf [+ + +]
Author: Griffin Kroah-Hartman <[email protected]>
Date:   Mon Jul 6 16:57:06 2026 +0200

    dmaengine: fsl-edma: Add error handling for devm_kasprintf
    
    commit bf1af4dfdc017dfe989c0dbcf0e608dc95f1d2cb upstream.
    
    Add error handling statement to fls_edma3_irq_init() for the
    devm_kasprintf call.
    
    Assisted-by: gkh_clanker_2000
    Cc: stable <[email protected]>
    Cc: Frank Li <[email protected]>
    Cc: Vinod Koul <[email protected]>
    Cc: [email protected]
    Signed-off-by: Griffin Kroah-Hartman <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Reviewed-by: Frank Li <[email protected]>
    Link: https://patch.msgid.link/2026070605-frying-fling-b9c5@gregkh
    Signed-off-by: Vinod Koul <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/amdgpu: Allocate coredump ring buffers per ring [+ + +]
Author: Lijo Lazar <[email protected]>
Date:   Mon Aug 24 14:28:07 2026 -0400

    drm/amdgpu: Allocate coredump ring buffers per ring
    
    [ Upstream commit e40ff9840fa8a633d149f0242df10cae5e518062 ]
    
    Allocate each ring buffer separately. A single allocation summing all
    ring sizes can exceed the page allocator's MAX_ORDER limit and fail;
    per-ring buffers stay small enough to satisfy. The existing allocation
    style doesn't capture any ring data if the huge allocation fails.
    Splitting into multiple allocations helps to capture as much data as
    possible for the core dump.
    
    A failed ring is left with a NULL buffer and skipped when formatting.
    
    Fixes: eea85914d15b ("drm/amdgpu: save ring content before resetting the device")
    Signed-off-by: Lijo Lazar <[email protected]>
    Assisted-by: Claude Code
    Reviewed-by: Alex Deucher <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    (cherry picked from commit 3e8e92b7892a6377bef86106bfff1b98cf586aee)
    Cc: [email protected]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/amdgpu: fix recursive ww_mutex acquire in amdgpu_devcoredump_format [+ + +]
Author: Mikhail Gavrilov <[email protected]>
Date:   Mon Aug 24 14:28:06 2026 -0400

    drm/amdgpu: fix recursive ww_mutex acquire in amdgpu_devcoredump_format
    
    [ Upstream commit 7152b248dc3c8d5fa8629e99ed5655dd41b51562 ]
    
    When dumping IB contents from a hung job, amdgpu_devcoredump_format()
    acquired the VM root PD's reservation via amdgpu_vm_lock_by_pasid() and
    then, for each IB, called amdgpu_bo_reserve() on the BO backing the IB.
    Both reservations are reservation_ww_class_mutex objects and neither
    used a ww_acquire_ctx, which trips lockdep:
    
      WARNING: possible recursive locking detected
      --------------------------------------------
      kworker/u128:0 is trying to acquire lock:
      ffff88838b16e1f0 (reservation_ww_class_mutex){+.+.}-{4:4},
        at: amdgpu_devcoredump_format+0x1594/0x23f0 [amdgpu]
    
      but task is already holding lock:
      ffff8882f82681f0 (reservation_ww_class_mutex){+.+.}-{4:4},
        at: amdgpu_devcoredump_format+0x1594/0x23f0 [amdgpu]
    
       Possible unsafe locking scenario:
             CPU0
             ----
        lock(reservation_ww_class_mutex);
        lock(reservation_ww_class_mutex);
    
       *** DEADLOCK ***
       May be due to missing lock nesting notation
    
      Workqueue: events_unbound amdgpu_devcoredump_deferred_work [amdgpu]
      Call Trace:
       __ww_mutex_lock.constprop.0
       ww_mutex_lock
       amdgpu_bo_reserve
       amdgpu_devcoredump_format+0x1594 [amdgpu]
       amdgpu_devcoredump_deferred_work+0xea [amdgpu]
    
    The two reservations are on different BOs in the captured trace, so the
    splat is a lockdep-correctness warning, not an observed deadlock. It
    becomes a real self-deadlock whenever the IB BO shares its dma_resv with
    the root PD (the always-valid case, see amdgpu_vm_is_bo_always_valid()):
    amdgpu_bo_reserve(abo) re-acquires the same ww_mutex without a ticket
    and blocks forever. With amdgpu.gpu_recovery=0 the timeout handler
    refires every ~2 s and each invocation produces this splat, drowning the
    kernel ring buffer.
    
    Now that amdgpu_vm_lock_by_pasid() takes a drm_exec context, move the IB
    dumping into a separate helper that locks the root PD and every IB BO
    together in a single drm_exec ticket. DRM_EXEC_IGNORE_DUPLICATES handles
    IB BOs that share a dma_resv (e.g. always-valid BOs, or two IBs backed
    by the same BO). Every lock is now a top-level acquire under one
    ww_acquire_ctx, so the recursive ww_mutex condition is gone, and the
    per-IB amdgpu_bo_reserve()/amdgpu_bo_unref() dance -- including a BO
    refcount leak on the amdgpu_bo_reserve() failure path -- is removed.
    
    Fixes: 7b15fc2d1f1a ("drm/amdgpu: dump job ibs in the devcoredump")
    Suggested-by: Christian König <[email protected]>
    Signed-off-by: Mikhail Gavrilov <[email protected]>
    Reviewed-by: Christian König <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    (cherry picked from commit d6bf4242731219ee08ce54c365631e395486651e)
    Stable-dep-of: e40ff9840fa8 ("drm/amdgpu: Allocate coredump ring buffers per ring")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/i915/pin: s/dev_priv/i915/ and drop struct drm_device usage [+ + +]
Author: Jani Nikula <[email protected]>
Date:   Mon Aug 24 07:22:08 2026 -0400

    drm/i915/pin: s/dev_priv/i915/ and drop struct drm_device usage
    
    [ Upstream commit 3823bf019d3b31ccd3e79860b7a3e20c719a1db4 ]
    
    Improve consistency within i915_fb_pin.c by replacing dev_priv naming
    with i915, and dropping struct drm_device usage.
    
    Reviewed-by: Ville Syrjälä <[email protected]>
    Link: https://patch.msgid.link/3a4ac0a732a561a487e46838bde6327cff5ccb38.1775556190.git.jani.nikula@intel.com
    Signed-off-by: Jani Nikula <[email protected]>
    Stable-dep-of: fc6487579083 ("drm/xe: Fix DPT allocation paths.")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/i915: Introduce struct intel_fb_pin_params [+ + +]
Author: Ville Syrjälä <[email protected]>
Date:   Mon Aug 24 07:22:10 2026 -0400

    drm/i915: Introduce struct intel_fb_pin_params
    
    [ Upstream commit a89b7f72f20db1ae1a65e97881e785639db4480a ]
    
    We need to pass a lot of information between the display driver
    and the core driver to get framebuffers mapped into GGTT/DPT
    correctly. Rather than passing around a swarm of integers and
    boolean as function arguments, let's collect it all into a
    structure (struct intel_fb_pin_params).
    
    Start by moving the gtt view, alignment, phys_alignment,
    and vtd_guard there. Going forward additional things need
    to added as well (mainly various boolean flags).
    
    Signed-off-by: Ville Syrjälä <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Reviewed-by: Jani Nikula <[email protected]>
    Stable-dep-of: fc6487579083 ("drm/xe: Fix DPT allocation paths.")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/i915: Track fence region ID in plane state [+ + +]
Author: Ville Syrjälä <[email protected]>
Date:   Mon Aug 24 07:22:09 2026 -0400

    drm/i915: Track fence region ID in plane state
    
    [ Upstream commit eb3dd9640731ae3ace871190f80474a8e7bae121 ]
    
    Get rid of the needlessly complicated PLANE_HAS_FENCE +
    intel_parent_vma_fence_id() dance by simply tracking the
    fence_id directly in the plane state.
    
    v2: Don't request the redundant fence for fbdev (Jani)
        Assign *out_fence_id with '=' instead of '|=' (Sashiko,Jani)
    
    Reviewed-by: Jani Nikula <[email protected]>
    Signed-off-by: Ville Syrjälä <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Stable-dep-of: fc6487579083 ("drm/xe: Fix DPT allocation paths.")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/xe: Fix DPT allocation paths. [+ + +]
Author: Maarten Lankhorst <[email protected]>
Date:   Mon Aug 24 07:22:11 2026 -0400

    drm/xe: Fix DPT allocation paths.
    
    [ Upstream commit fc648757908304aedbad74f74bf58192aec383db ]
    
    Remove the fallback for VRAM to system memory, I tested it and that
    doesn't work at all, only a black screen with pipe fault errors were
    observed.
    
    On systems with media GT, extra latency is added when accessing stolen
    memory when the GT is in MC6. Since we additionally aren't counting how
    much memory is used for stolen and we could in theory fill up the
    entire stolen area with DPT's, avoid using stolen and only use the
    default memory region.
    
    Using stolen may also result in random system hangs under load.
    
    Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/work_items/7513
    Fixes: 775d0adc01a5 ("drm/xe/fbdev: Limit the usage of stolen for LNL+")
    Cc: <[email protected]> # v6.12+
    Reviewed-by: Matthew Auld <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Maarten Lankhorst <[email protected]>
    Acked-by: Matthew Brost <[email protected]> #teams
    (cherry picked from commit a196406a3831291598fe8e73245914f7acffdfe0)
    Signed-off-by: Thomas Hellström <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ext4: avoid tail write_begin walk for uptodate folios [+ + +]
Author: Jia Zhu <[email protected]>
Date:   Tue Jun 9 11:52:02 2026 +0800

    ext4: avoid tail write_begin walk for uptodate folios
    
    commit d09811183db2891776dbf0c0f1094540e29938f6 upstream.
    
    Ext4 buffered writes into large folios also pay a full buffer_head
    walk in ext4_block_write_begin().  For a small overwrite of an existing
    cached folio, the folio is already uptodate and the write only needs to
    prepare the buffers through the written range.  Walking the suffix still
    makes the write_begin cost proportional to the folio size.
    
    Before ext4 enabled large folios for regular files, the same loop was
    bounded by a single page of buffers.  That commit made the existing
    full-folio walk visible as a regression for cached small overwrites.
    
    The suffix walk is needed for non-uptodate folios, where ext4 may have
    to submit reads for partial blocks, preserve new-buffer cleanup, and run
    error zeroing.  Keep those folios on the old full walk.
    
    For already-uptodate folios, keep the walk starting at the first buffer
    rather than seeking directly to from.  This preserves the existing prefix
    buffer state handling.  Stop once block_start reaches the end of the
    write range, because the skipped suffix would only repeat the
    outside-range uptodate handling for buffers beyond @to.
    
    On current master, the libMicro ext4 large-folio overwrite test shows
    the following full-series result.  Results are median usecs/call over 10
    runs, lower is better:
    
    case        nofix     this series   improvement
    write_u1k   1.418     0.3405        76.0%
    write_u10k  1.887     0.4175        77.9%
    pwrite_u1k  1.6775    0.3390        79.8%
    pwrite_u10k 1.9035    0.4130        78.3%
    
    Fixes: 7ac67301e82f0 ("ext4: enable large folio for regular file")
    Cc: [email protected] # v6.16+
    Reviewed-by: Jan Kara <[email protected]>
    Signed-off-by: Jia Zhu <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ext4: clear error before retrying inode xattr space fallback [+ + +]
Author: Guanghui Yang <[email protected]>
Date:   Wed Jul 8 12:57:19 2026 +0000

    ext4: clear error before retrying inode xattr space fallback
    
    commit 409a7f12a0933ff2c617fa814c76cef0bd1d457a upstream.
    
    When ext4_xattr_make_inode_space() returns -ENOSPC,
    ext4_expand_extra_isize_ea() can retry the expansion with
    s_min_extra_isize.  If that retry succeeds by finding enough ibody free
    space, control jumps directly to the shift label.
    
    The previous -ENOSPC is still stored in error in that path, so the
    function can update i_extra_isize but still return -ENOSPC to the
    caller.  Clear error before retrying so a successful fallback expansion
    returns success.
    
    Reproduced with an ext4 image using 1 KiB blocks, project quota support,
    256-byte inodes, and min_extra_isize/want_extra_isize set to 32.
    FS_IOC_FSSETXATTR failures dropped from 802 to 86 after the fix.
    
    Fixes: 69f3a3039b0d ("ext4: introduce ITAIL helper")
    Cc: [email protected]
    Signed-off-by: Guanghui Yang <[email protected]>
    Reviewed-by: Jan Kara <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ext4: don't enable DAX on new encrypted files [+ + +]
Author: Eric Biggers <[email protected]>
Date:   Thu Jul 30 10:52:12 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 <[email protected]>
    Reported-by: Ojaswin Mujoo <[email protected]>
    Closes: https://lore.kernel.org/r/[email protected]
    Fixes: 043546e46dc7 ("fs/ext4: Only change S_DAX on inode load")
    Cc: [email protected]
    Signed-off-by: Eric Biggers <[email protected]>
    Tested-by: Disha Goel <[email protected]>
    Reviewed-by: Ojaswin Mujoo <[email protected]>
    Reviewed-by: Jan Kara <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ext4: fix incorrect function call when initializing s_resgid [+ + +]
Author: Jiazi Liu <[email protected]>
Date:   Mon Jul 27 18:41:03 2026 +0800

    ext4: fix incorrect function call when initializing s_resgid
    
    commit c87abbab6147dcc5aa1fd8f2a61734d58d8b99ec upstream.
    
    In __ext4_fill_super(), s_resgid is initialized by calling
    ext4_get_resuid() instead of ext4_get_resgid(), resulting in the
    reserved GID being set to the same value as the reserved UID rather
    than the value stored in the superblock.
    
    Fixes: 12c84dd4d308 ("ext4: add support for 32-bit default reserved uid and gid values")
    Cc: [email protected]
    Signed-off-by: Jiazi Liu <[email protected]>
    Reviewed-by: Ritesh Harjani (IBM) <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ext4: propagate errors from fast commit range replay [+ + +]
Author: Guanghui Yang <[email protected]>
Date:   Wed Jul 8 08:12:04 2026 +0000

    ext4: propagate errors from fast commit range replay
    
    commit d8b8dd3530bf41e14b118702cdaf9de64bb96885 upstream.
    
    ext4_fc_replay() stops replaying fast commit tags only when a tag
    handler returns a negative error. However, ext4_fc_replay_add_range()
    and ext4_fc_replay_del_range() currently return 0 from their common
    exit paths even after internal failures.
    
    This hides errors from ext4_fc_record_modified_inode(),
    ext4_map_blocks(), ext4_find_extent(), ext4_ext_insert_extent(),
    ext4_ext_replay_update_ex(), and ext4_ext_remove_space(). As a result,
    a failed ADD_RANGE or DEL_RANGE replay can be treated as successful and
    the replay code may continue with subsequent fast commit tags.
    
    This is particularly problematic for DEL_RANGE because it may already
    have marked blocks as free before ext4_ext_remove_space() fails. If the
    error is swallowed, replay may continue from a partially applied range
    operation.
    
    Return the saved error from the common exit paths and make the
    ERR_PTR() cases in ADD_RANGE store PTR_ERR() before jumping to out.
    
    Fixes: 8016e29f4362 ("ext4: fast commit recovery path")
    Cc: [email protected]
    Signed-off-by: Guanghui Yang <[email protected]>
    Reviewed-by: Jan Kara <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ext4: stop retrying saturated xattr cache entries [+ + +]
Author: Matthias Goergens <[email protected]>
Date:   Sun Aug 2 14:59:41 2026 +0800

    ext4: stop retrying saturated xattr cache entries
    
    commit 54b6bd40898de7906acb2bccc9a96d1b8e6b4323 upstream.
    
    ext4_xattr_block_set() retries when a cache entry selected for reuse
    has a saturated reference count after taking the buffer lock. The retry
    returns to the mbcache lookup without making that entry ineligible, so
    it can select the same unusable entry indefinitely. A task spinning
    there can hold the parent directory's i_rwsem and leave concurrent
    rmdir callers blocked.
    
    Normally a reusable entry has a reference count below
    EXT4_XATTR_REFCOUNT_MAX because the count and MBE_REUSABLE_B are
    updated under the same buffer lock. A corrupted filesystem can violate
    that invariant. The syzbot reproducer reports allocator and xattr
    corruption before triggering this retry loop.
    
    Check the untrusted on-disk count before incrementing it, avoiding
    overflow, and clear MBE_REUSABLE_B when it is already saturated. The
    next lookup then skips the entry that was just proven unusable. This
    mirrors the normal transition at EXT4_XATTR_REFCOUNT_MAX; the release
    path marks the entry reusable again on the exact 1024-to-1023
    transition.
    
    Using the same QEMU harness and guest parameters, current unpatched
    Linux hung in 6 of 8 420-second trials with the do_rmdir signature;
    representative NMI backtraces caught the owner spinning in
    ext4_xattr_block_set(). The patched kernel completed 28 of 28 trials
    without a hung-task report; the final twelve trials exercised the
    reviewed overflow-safe form of the change. syzbot's patch testing also
    completed without reproducing the hang.
    
    Reported-and-tested-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=e68dbebd9617a9250e8d
    Fixes: 65f8b80053a1 ("ext4: fix race when reusing xattr blocks")
    Cc: [email protected]
    Signed-off-by: Matthias Goergens <[email protected]>
    Reviewed-by: Jan Kara <[email protected]>
    Reported-by: [email protected]
    Tested-by: [email protected]
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
fbdev: serialize mode sysfs access with lock_fb_info() [+ + +]
Author: Melbin K Mathew <[email protected]>
Date:   Mon Aug 24 14:10:15 2026 -0400

    fbdev: serialize mode sysfs access with lock_fb_info()
    
    [ Upstream commit 061db6b7a910b8378f3b2df64f8c0a3ddc6e85f2 ]
    
    show_mode(), show_modes(), and store_mode() access fb_info->modelist
    and fb_info->mode without holding lock_fb_info(). store_modes() takes
    lock_fb_info() while replacing the modelist and freeing the old one.
    
    A concurrent reader or writer can load a pointer to an old modelist
    entry before store_modes() frees it, then dereference freed memory or
    store a stale freed pointer in fb_info->mode.
    
    Take lock_fb_info() in show_mode(), show_modes(), and store_mode() to
    serialize with store_modes(). In show_mode(), copy the mode to the
    stack and format after dropping the lock. In store_mode(), split
    activate() into a _locked variant to avoid double-locking, and hold
    the locks for the modelist walk, mode conversion, activation, and
    fb_info->mode assignment together.
    
    Cc: [email protected] # v7.1+
    Signed-off-by: Melbin K Mathew <[email protected]>
    Signed-off-by: Helge Deller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

fbdev: Wrap user-invoked calls to fb_set_var() in helper [+ + +]
Author: Thomas Zimmermann <[email protected]>
Date:   Mon Aug 24 14:10:14 2026 -0400

    fbdev: Wrap user-invoked calls to fb_set_var() in helper
    
    [ Upstream commit 6f611e5e5f3327cf2e2daabe6ee5acac58cc784e ]
    
    Handle fbcon during display updates in fb_set_var_from_user(). Check
    with fbcon if the mode change is possible, update hardware state and
    finally update fbcon. Update all callers.
    
    Only the FBIOPUT_VSCREENINFO ioctl currently does all steps. Other
    mode-changes callers in sysfs and driver code are missing fbcon-related
    steps.
    
    With the new helper, ps3fb and sh_mobile_lcdcfb no longer maintain
    fbcon state themselves.
    
    Signed-off-by: Thomas Zimmermann <[email protected]>
    Signed-off-by: Helge Deller <[email protected]>
    Stable-dep-of: 061db6b7a910 ("fbdev: serialize mode sysfs access with lock_fb_info()")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
futex/pi: Plug private futex exec() race [+ + +]
Author: Thomas Gleixner <[email protected]>
Date:   Tue Aug 25 14:48:35 2026 +0200

    futex/pi: Plug private futex exec() race
    
    commit c5f0bc9fd1cec4a00400cc727fcde03e0fde17cc upstream.
    
    The check for private futexes whether the waiter's mm, which is stored in
    the futex_key and copied into the pi_state, is the same as the owner's mm
    is not sufficient for exec(). exec() has a gap where the mm check fails to
    give the correct answer:
    
      exec()
      ...
        exec_release_mm()
          futex_exec_release()
            tsk::futex::exit_state = EXITING;
            cleanup_robust_list();
    1)      tsk::futex::exit_state = OK;
        ...
        old_mm = tsk::mm;
    2)  tsk::mm = ->mm;
    
    Between #1 and #2 the check for the mm is wrong as that mm is about to be
    swapped out and eventually freed.
    
    Plug this gap by:
    
      1) Setting tsk::futex::exit_state to FUTEX_STATE_DEAD in
         futex_exec_release()
    
      2) Setting tsk::futex::exit_state to FUTEX_STATE_OK after
         the mm has been switched.
    
    >>From a futex point of view the task is dead after it finished the robust
    list cleanup up to the point where it sets the state to OK again.
    
    Fixes: 80367ad01d93 ("futex: Add basic infrastructure for local task local hash")
    Signed-off-by: Thomas Gleixner <[email protected]>
    Reviewed-by: Kyle Zeng <[email protected]>
    Acked-by: Peter Zijlstra <[email protected]>
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

futex/pi: Reject cross-mm private futex owners [+ + +]
Author: Kyle Zeng <[email protected]>
Date:   Tue Aug 25 14:48:27 2026 +0200

    futex/pi: Reject cross-mm private futex owners
    
    commit 59b3732f95dda1fbd2234514d35f4fb6b5bb6d85 upstream.
    
    A private futex key borrows the waiter's mm without taking an mm_users
    reference. Nevertheless, attach_to_pi_owner() currently accepts an owner
    from a different address space and copies the private key into the owner's
    PI state.
    
    When that owner exits, exit_pi_state_list() uses the saved key to find the
    hash bucket and acquires a reference to the waiter's private hash. If the
    last user of the waiter's mm exits concurrently, futex_hash_free() frees
    the hash while the owner still uses its bucket and reference.
    
    Prevent this by validating in attach_to_pi_owner() that, for private
    futexes, the owner mm and waiter mm are the same. Perform the check with
    the owner's pi_lock held and after validating owner::futex::state to
    serialize against a concurrent PI-state exit cleanup.
    
    [ tglx: Amended comment ]
    
    Fixes: 80367ad01d93 ("futex: Add basic infrastructure for local task local hash")
    Signed-off-by: Kyle Zeng <[email protected]>
    Signed-off-by: Thomas Gleixner <[email protected]>
    Acked-by: Peter Zijlstra <[email protected]>
    Assisted-by: Codex:gpt-5.6-sol
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
futex: Avoid private hash use-after-free on final put [+ + +]
Author: Felix Hoffmann <[email protected]>
Date:   Tue Aug 25 11:09:47 2026 -0400

    futex: Avoid private hash use-after-free on final put
    
    [ Upstream commit 1c7efabfbaf796f11000a46094a69955a01ec6cc ]
    
    futex_private_hash_put() drops the reference to fph before evaluating
    fph->mm for wake_up_var(). futex_ref_put() enables preemption again before
    returning. If that put drops the final reference and the task is preempted,
    another task can pivot to the replacement hash and free the old hash after
    an RCU grace period. The first task then reads fph->mm from the freed
    allocation when it resumes.
    
    KASAN reports a slab-use-after-free in futex_private_hash_put(), with the
    read at offset 24 in a freed kmalloc-512 allocation. The allocation and
    free stacks point to futex_hash_allocate() and the RCU free path,
    respectively.
    
    Load the mm pointer while the fph reference is still held and pass the
    saved value to wake_up_var(). wake_up_var() uses the pointer as a waitqueue
    key and does not dereference the mm through it.
    
    Fixes: bd54df5ea7ca ("futex: Allow to resize the private local hash")
    Signed-off-by: Felix Hoffmann <[email protected]>
    Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
    Cc: [email protected]
    Link: https://patch.msgid.link/[email protected]
    [ dropped the `!fph` NULL guard since this tree's callers already check, keeping the existing `if (futex_ref_put(fph))` form ]
    Signed-off-by: Sasha Levin <[email protected]>

futex: Fix might_sleep() warning in futex_pivot_pending() [+ + +]
Author: Peter Zijlstra <[email protected]>
Date:   Tue Aug 25 14:48:48 2026 +0200

    futex: Fix might_sleep() warning in futex_pivot_pending()
    
    commit d8aa5dd97944a72d4a9e3cc79bb80fcac7d6e829 upstream.
    
    A younger me put a WARN in might_sleep() to warn about nested sleep loops. This
    younger me also build a wait-loop variant that can deal with it. This wait-loop
    variant doesn't have all the fancy wrappers, since it isn't used much. It also
    lacks wait-bit support.
    
    Add the wait-bit support and use it to fix the nested wait issue.
    
    Fixes: 8e7ff730dd96 ("futex: Fix race in futex_pivot_pending() during private hash resize")
    Reported-by: [email protected]
    Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
    Signed-off-by: Thomas Gleixner <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=350a93852ac854927f45
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

futex: Fix race in futex_pivot_pending() during private hash resize [+ + +]
Author: Yao Kai <[email protected]>
Date:   Tue Aug 25 14:48:40 2026 +0200

    futex: Fix race in futex_pivot_pending() during private hash resize
    
    commit 8e7ff730dd96519a333d1570edf1c3fabb6d3629 upstream.
    
    A task performing a custom private hash resize can remain blocked in
    uninterruptible sleep indefinitely.  The hung-task detector reports:
    
      INFO: task futex-resizer:314 blocked for more than 10 seconds.
      task:futex-resizer state:D stack:14824 pid:314 tgid:312 ppid:311
    
      Call Trace:
       __schedule+0x521/0xf30
       schedule+0x22/0xa0
       futex_hash_allocate+0x3db/0x490
       __do_sys_prctl+0x6f5/0xbd0
       do_syscall_64+0xf9/0x530
       entry_SYSCALL_64_after_hwframe+0x77/0x7f
    
      Kernel panic - not syncing: hung_task: blocked tasks
    
    futex_pivot_pending() allows the resize request to continue when
    either no replacement hash is pending (hash_new == NULL) or the current
    hash reference count has reached zero.
    
    After the final-reference wake, another futex task can complete the
    pivot between the two observations:
    
      T1                                  T2
    
      futex_hash_allocate()
        wait_var_event(mm, ...)
          futex_pivot_pending(mm)
            hash_new != NULL
                                          futex_hash()
                                            futex_ref_get(old) -> false
                                            futex_pivot_hash(mm)
                                              hash_new = NULL
                                              __futex_pivot_hash(mm, new)
                                                rcu_assign_pointer(hash, new)
            fph = rcu_dereference(hash) /* new */
            futex_ref_is_dead(fph) -> false
          schedule()
    
    The pivot changes the state from hash_new != NULL with a dead current
    hash to hash_new == NULL with a live current hash.  Because
    futex_pivot_pending() reads hash_new and hash without serialization,
    the resize task can observe hash_new in the pre-pivot state and hash in
    the post-pivot state, causing futex_pivot_pending() to return false even
    though the pivot has completed.  The task then goes to sleep after the
    wakeup has already been consumed.
    
    Serialize state reads in futex_pivot_pending() using futex_mm_phash::lock.
    This guarantees that futex_pivot_pending() observes hash_new and hash
    atomically, eliminating the race condition.
    
    Fixes: bd54df5ea7ca ("futex: Allow to resize the private local hash")
    Suggested-by: Peter Zijlstra <[email protected]>
    Signed-off-by: Yao Kai <[email protected]>
    Signed-off-by: Thomas Gleixner <[email protected]>
    Cc: [email protected]
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

futex: Fix race on the initial mm->futex.phash.ref allocation [+ + +]
Author: Hyunwoo Kim <[email protected]>
Date:   Tue Aug 25 14:48:44 2026 +0200

    futex: Fix race on the initial mm->futex.phash.ref allocation
    
    commit bde0238083647381d4747355c5a19115a3422b96 upstream.
    
    futex_hash_allocate() allocates mm->futex.phash.ref without any locking.
    Commit d9b05321e21e ("futex: Move futex_hash_free() back to __mmput()")
    moved the allocation here and assumed that the process has just a single
    thread at this point.
    
    Commit ee9dce44362b ("futex: Drop CLONE_THREAD requirement for private
    default hash alloc") widened need_futex_hash_allocate_default() to cover
    any CLONE_VM clone, but left out vfork because the parent is suspended and
    cannot race.
    
    That no longer holds once vfork is nested. If a vfork child calls vfork
    again and is then killed with SIGKILL, the parent is released from its
    vfork wait and runs concurrently with the grandchild in the same mm.
    Neither of them went through futex_hash_allocate_default().
    
    When both call prctl(PR_FUTEX_HASH, PR_FUTEX_HASH_SET_SLOTS) at the same
    time, each one sees mm->futex.phash.ref as NULL and stores its own percpu
    counter. Only the last store survives. The counter stored first is no
    longer reachable from the mm, so the references on it are not seen by
    __futex_ref_atomic_end(). A private hash that still has references is then
    considered dead and freed, and a task that still holds one of its buckets
    writes into freed memory in futex_q_lock().
    
    Store the counter once with cmpxchg() and let the loser free_percpu() its
    own. The initial reference has to be taken before the store, otherwise
    another task can install a private hash while the counter is still 0.
    
    Fixes: d9b05321e21e ("futex: Move futex_hash_free() back to __mmput()")
    Signed-off-by: Hyunwoo Kim <[email protected]>
    Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
    Signed-off-by: Thomas Gleixner <[email protected]>
    Cc: [email protected]
    Link: https://patch.msgid.link/ansrpP4ImE1MaBY9@v4bel
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

futex: Sanitize and document task_struct::futex::state transitions [+ + +]
Author: Thomas Gleixner <[email protected]>
Date:   Tue Aug 25 14:48:31 2026 +0200

    futex: Sanitize and document task_struct::futex::state transitions
    
    commit f9ece060cc43eae8a1f148737d193ba0d07b8f88 upstream.
    
    The futex state is used to prevent a waiter from attaching to the lock
    owner while the owner runs the futex cleanup in exit() or exec().
    
    Only the state transition from FUTEX_STATE_OK to FUTEX_STATE_EXITING must
    be done with the task's pi_lock held, the transition away from
    FUTEX_STATE_EXITING has no serialization requirements on the writer side,
    but it's completely non obvious why. It's magically protected by
    exit_pi_state(), which operates under tsk::pi_lock, as that's the state
    which has to be correct when the waiter observes the new state.
    
    OTOH, taking the pi_lock in futex_cleanup_end() is not a performance issue
    because at that point the lock should be uncontended in the vast majority
    of cases.
    
    Aside of that the handling of FUTEX_STATE_EXITING in attach_to_pi_owner()
    and handle_exit_race() is confusing at best.
    
    Protect the store in futex_cleanup_end() with tsk::pi_lock, handle
    FUTEX_STATE_EXITING in attach_to_pi_owner() explicitly and document how
    this is supposed to work.
    
    Reported-by: Peter Zijlstra <[email protected]>
    Signed-off-by: Thomas Gleixner <[email protected]>
    Reviewed-by: Kyle Zeng <[email protected]>
    Acked-by: Peter Zijlstra <[email protected]>
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
HID: asus: fix missing hid_is_usb() check [+ + +]
Author: Jann Horn <[email protected]>
Date:   Fri Jul 3 17:45:52 2026 +0200

    HID: asus: fix missing hid_is_usb() check
    
    commit 02bf61dfb44f17ec187d1da1a82495951bbd12df upstream.
    
    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: [email protected]
    Signed-off-by: Jann Horn <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

HID: core: fix number/pointer type confusion on long items [+ + +]
Author: Jann Horn <[email protected]>
Date:   Fri Jul 3 20:30:02 2026 +0200

    HID: core: fix number/pointer type confusion on long items
    
    commit 28abce951343fcec26e397610868efa4e1395c3f upstream.
    
    When fetch_item() is called by hid_scan_report() on an item with
    HID_ITEM_TAG_LONG, it stores a pointer to the item data in
    item->data.longdata instead of storing a value directly in
    item->data.{u8/u16/u32}.
    
    When item_udata() or item_sdata() encounters such an item, it incorrectly
    assumes that the item is in short format, and therefore returns the lower
    part of a kernel pointer reinterpreted as a number.
    
    When a HID device is connected whose descriptor contains a
    HID_GLOBAL_ITEM_TAG_REPORT_SIZE encoded in long format with size=4, this
    causes the lower half of a kernel pointer to be printed into dmesg as a
    number, like this:
    
        hid (null): invalid report_size 107953555
    
    To fix it, let item_udata() and item_sdata() verify that the item is in
    short format.
    
    Note that this bug only affects hid_scan_report(), while the main parsing
    pass hid_parse_collections() will always bail out when encountering a long
    item.
    
    Sidenote: There are currently no users of data.longdata; maybe we should
    just remove any parsing of long-format descriptors as a follow-up.
    
    Fixes: 3dc8fc083dbf ("HID: Use hid_parser for pre-scanning the report descriptors")
    Cc: [email protected]
    Signed-off-by: Jann Horn <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

HID: core: fix OOB read of field->usage in hid_set_field() [+ + +]
Author: Baul Lee <[email protected]>
Date:   Sun Jul 26 15:50:24 2026 +0900

    HID: core: fix OOB read of field->usage in hid_set_field()
    
    commit a13cdb19fcb223ed41bdab3bab42b98dba87e90b upstream.
    
    hid_set_field() hands field->usage + offset to hid_dump_input() before
    the guard that bounds offset:
    
            hid_dump_input(field->report->device, field->usage + offset, value);
    
            if (offset >= field->report_count) {
                    hid_err(...);
                    return -1;
            }
    
    Under CONFIG_DEBUG_FS hid_dump_input() dereferences that pointer, with
    buf = hid_resolv_usage(usage->hid, NULL).  The usage[] array is
    allocated inline with the hid_field in hid_register_field() and holds
    field->maxusage entries, so an offset past it reads off the end of the
    kvzalloc()ed allocation and into a neighbouring object.  Had the guard
    run first, offset < report_count <= maxusage would already have confined
    the pointer to the array.
    
    A caller supplies such an offset today.  picolcd_fb_send_tile()
    validates only report->maxfield before issuing
    hid_set_field(report->field[0], 11 + i, ...) for i = 0..31, so its
    offsets are fixed at 11..42 and are never checked against the bound
    field.  When the device registers that field with fewer usages, the
    framebuffer deferred-io work drives the read on every tile.  KASAN
    reports a 4-byte slab-out-of-bounds read in hid_dump_input() below
    hid_set_field(), and the same boot logs "offset (1) exceeds
    report_count (1)" from the guard that runs only afterwards.
    
    Move the hid_dump_input() call below the guard.  Because
    field->maxusage >= field->report_count, the guard then establishes that
    field->usage + offset lies inside the array before it is dereferenced,
    for every caller and without changing behaviour on the valid path.
    
    Discovered by XBOW, triaged by Baul Lee <[email protected]>
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: Federico Kirschbaum <[email protected]>
    Reported-by: Baul Lee <[email protected]>
    Cc: [email protected]
    Signed-off-by: Baul Lee <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

HID: ft260: fix stack-use-after-return write in I2C read race [+ + +]
Author: Raman Varabets <[email protected]>
Date:   Wed Jun 10 22:29:52 2026 +0800

    HID: ft260: fix stack-use-after-return write in I2C read race
    
    commit bf3e39df3a397fd82967a31d17c4e02c7feab221 upstream.
    
    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: [email protected]
    Signed-off-by: Raman Varabets <[email protected]>
    Reviewed-by: Michael Zaidman <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

HID: huawei: fix missing hid_is_usb() check [+ + +]
Author: Jann Horn <[email protected]>
Date:   Fri Jul 3 17:45:53 2026 +0200

    HID: huawei: fix missing hid_is_usb() check
    
    commit 4cdb6b4b34d7823254f6e1b22faf56c96ac57fb9 upstream.
    
    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: e93faaca84b7 ("HID: huawei: fix CD30 keyboard report descriptor issue")
    Cc: [email protected]
    Signed-off-by: Jann Horn <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

HID: hyperv: validate initial device info bounds [+ + +]
Author: Michael Bommarito <[email protected]>
Date:   Thu Jul 9 22:28:53 2026 -0400

    HID: hyperv: validate initial device info bounds
    
    commit 934b7778aa7b7c8f6bb073d2a73ba3674885bae0 upstream.
    
    The Hyper-V synthetic HID host supplies SYNTH_HID_INITIAL_DEVICE_INFO
    messages that contain a HID descriptor followed by the report descriptor
    bytes. mousevsc_on_receive_device_info() trusts bLength and
    wDescriptorLength without checking that the received packet contains both
    byte ranges.
    
    A malformed host or backend message can therefore make the guest read
    past the received VMBus packet while copying the report descriptor. Pass
    the received initial-device-info size into the parser and reject
    descriptor lengths that exceed the packet.
    
    Impact: A malicious Hyper-V host or backend can crash a guest by sending
    a short initial device-info message with an oversized HID report
    descriptor length.
    
    Fixes: b95f5bcb811e ("HID: Move the hid-hyperv driver out of staging")
    Cc: [email protected]
    Assisted-by: Codex:gpt-5-5-xhigh
    Signed-off-by: Michael Bommarito <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

HID: input: read battery capacity from its actual report offset [+ + +]
Author: Jose Villaseñor Montfort <[email protected]>
Date:   Tue Jul 28 14:13:09 2026 -0600

    HID: input: read battery capacity from its actual report offset
    
    commit d07644524b6511b622ee7b0e2e68c9ee43d522a4 upstream.
    
    hidinput_query_battery_capacity() assumes the state-of-charge value is
    the first byte following the report ID (buf[1]) and ignores where the
    battery field actually sits within the report.
    
    An Apple Magic Trackpad 2 precedes the AbsoluteStateOfCharge byte with a
    byte of status flags in its battery reports, so this query returns the
    flags byte instead of the charge level.
    
    The device happens to make that easy to observe, because it exposes the
    same cell twice: its report descriptor declares AbsoluteStateOfCharge in
    two reports (0x90 and 0x9b), so hidinput_setup_battery() registers two
    power supplies. Only the first one is refreshed by hid-magicmouse -- it
    uses hid_get_battery(), which returns the first battery of the list --
    and that refresh goes through the report event path, which parses the
    field correctly. Nothing ever reports the second one, so every read of
    its capacity takes the query path above. On a USB-C Magic Trackpad over
    USB, on an unpatched 7.1.5:
    
      hid-<serial>-battery-144 = 100%  (Charging)      <- report event path
      hid-<serial>-battery-155 =   3%  (Discharging)   <- query path
    
    Both are the same physical battery. A raw HIDIOCGINPUT of the two
    reports at that same moment:
    
      report 0x90 -> [90 03 64]
      report 0x9b -> [9b 03 64 64 00 00 10 00 00 00 00 00 00 00]
                         ^flags ^SoC = 0x64 = 100%
    
    The device answers correctly in both cases; only the offset the kernel
    reads the capacity from is wrong. 0x03 is the flags byte (present,
    charging), reported as "3%".
    
    Bluetooth takes the same query path for its capacity, where the trackpad
    reported a bogus near-constant ~4% -- 0b100, the FullyCharged flag --
    regardless of the real charge.
    
    Store the battery field's offset within the report at setup time and use
    it when querying, so the capacity is read from its real position. The
    report event path already parses the field correctly through the HID
    core; only the explicit GET_REPORT query was wrong.
    
    Devices whose capacity field is the first field in the report have a
    report_offset of 0 and are unaffected (buf[1 + 0] == buf[1]).
    
    Fixes: 581c4484769e ("HID: input: map digitizer battery usage")
    Cc: [email protected]
    Signed-off-by: Jose Villaseñor Montfort <[email protected]>
    Reviewed-by: Alec Hall <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

HID: magicmouse: do not keep a stale msc->input if no input is claimed [+ + +]
Author: Jose Villaseñor Montfort <[email protected]>
Date:   Tue Jul 28 22:15:57 2026 -0600

    HID: magicmouse: do not keep a stale msc->input if no input is claimed
    
    commit 0af3b89705688af01aa06025b84fa7a1e06ba6cc upstream.
    
    magicmouse_input_mapping() caches the first hid_input's input_dev in
    msc->input while the report descriptor is parsed, and the rest of the
    driver treats a non-NULL msc->input as proof that an input device was
    registered.
    
    That does not hold on the hid-input error path. If hidinput_connect()
    fails -- for instance because input_register_device() returns an error --
    it unwinds through hidinput_disconnect(), which frees every input_dev it
    created, including the one cached in msc->input.
    
    The failure does not abort the probe. hid_connect() only skips the claim:
    
            if ((connect_mask & HID_CONNECT_HIDINPUT) && !hidinput_connect(hdev,
                                    connect_mask & HID_CONNECT_HIDINPUT_FORCE))
                    hdev->claimed |= HID_CLAIMED_INPUT;
    
    and the "device has no listeners" bailout below it does not fire for this
    driver, which sets ->raw_event; on the USB Magic Mouse 2 / Magic Trackpad
    2 paths hidraw and hiddev are claimed as well. hid_hw_start() therefore
    returns 0 and magicmouse_probe() continues with msc->input pointing at
    freed memory. Being non-NULL, it passes the "input not registered" check
    in probe and the NULL checks in ->raw_event and ->event, so the next
    input report dereferences freed memory.
    
    Clear msc->input when the HID core did not claim an input device, so the
    existing NULL checks cover this case as well.
    
    Fixes: f1a9a149abc8 ("HID: magicmouse: fix race between input_register() and probe()")
    Link: https://lore.kernel.org/linux-input/[email protected]/
    Cc: [email protected]
    Signed-off-by: Jose Villaseñor Montfort <[email protected]>
    Reviewed-by: Alec Hall <[email protected]>
    Tested-by: Alec Hall <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

HID: magicmouse: fix battery reporting for Bluetooth Magic Trackpad USB-C [+ + +]
Author: Andrei Fed <[email protected]>
Date:   Mon Jul 6 19:55:07 2026 +0200

    HID: magicmouse: fix battery reporting for Bluetooth Magic Trackpad USB-C
    
    commit a1556b48efc157fdda07b52ecc56c7bd1e1786f0 upstream.
    
    The Apple Magic Trackpad 2 (USB-C) reports a wildly wrong battery
    capacity over Bluetooth, for example a constant 4% for a pack that is
    actually at 74%.
    
    The device's battery input report (0x90) is laid out as
    [report-id][status][charge]. hid-input's synchronous capacity query,
    hidinput_query_battery_capacity(), assumes the common
    [report-id][capacity] layout and returns buf[1], which for this device
    is the status byte rather than the charge (buf[2]).
    
    magicmouse_fetch_battery(), which requests the battery report through
    hid_hw_request() so the reply is decoded via the report descriptor at
    the correct field offset, is gated to the USB models and never runs
    over Bluetooth. The device does not push battery reports on its own
    either, except a single one at connect time, which is delivered while
    probe holds driver_input_lock and is silently dropped. All userspace
    reads therefore go through the misparsing query, and the device is
    stuck reporting its status byte as the capacity.
    
    Enabling the fetch for Bluetooth is not sufficient on its own: user
    space reacts to the power_supply registration immediately, so a query
    is typically already in flight when the fetch reply is parsed.
    hidinput_get_battery_property() stores the query result and marks the
    battery as queried without rechecking whether a report arrived while
    it was waiting, clobbering the just-reported correct value with the
    misparsed one.
    
    Fix this by adding HID_BATTERY_QUIRK_AVOID_QUERY for the Bluetooth
    Magic Trackpad USB-C so the misparsing query path is never used, and
    by fetching the battery at the end of probe for this device. hidp has
    no asynchronous request() callback, so the fetch is serviced
    synchronously via __hid_request() while probe still holds
    driver_input_lock; call hid_device_io_start() first so the reply is
    processed instead of being discarded.
    
    Tested with a Magic Trackpad USB-C (004c:0324) over Bluetooth on
    6.18.37: the reported capacity now matches the device (verified against
    a raw GET_REPORT of report 0x90) and updates on reconnect.
    
    Fixes: 87a2f10395c8 ("HID: magicmouse: Apple Magic Trackpad 2 USB-C driver support")
    Cc: [email protected]
    Signed-off-by: Andrei Fed <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

HID: magicmouse: prevent unbounded recursion in magicmouse_raw_event() [+ + +]
Author: Jose Villaseñor Montfort <[email protected]>
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/[email protected]/
    Cc: [email protected]
    Signed-off-by: Jose Villaseñor Montfort <[email protected]>
    Reviewed-by: Alec Hall <[email protected]>
    Tested-by: Alec Hall <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

HID: magicmouse: re-enable multitouch after reset-resume [+ + +]
Author: Christopher Kodama <[email protected]>
Date:   Sat Jul 25 16:34:46 2026 -0400

    HID: magicmouse: re-enable multitouch after reset-resume
    
    commit 4253fe22b137c4ee68f36b707fdb1b44b191edc4 upstream.
    
    When the Apple Magic Trackpad 2 (USB) is reset across a power transition
    (e.g. resume from hibernation) it drops out of multitouch mode: it keeps
    sending report ID 0x02 on its HID_TYPE_USBMOUSE interface, but the packet
    shrinks from 21 to 8 bytes and the trackpad2 handler drops it (size < 12).
    Clicks still work but pointer motion is lost until the device is re-plugged
    or the driver reloaded.
    
    Re-enable multitouch from .reset_resume via the workqueue.  Only
    .reset_resume is needed; suspend-to-idle keeps the device powered and
    retains multitouch.
    
    Fixes: 87a2f10395c8 ("HID: magicmouse: Apple Magic Trackpad 2 USB-C driver support")
    Cc: [email protected]
    Assisted-by: Claude-Code:claude-opus-4-8
    Signed-off-by: Christopher Kodama <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

HID: nintendo: fix out-of-bounds read in joycon_ctlr_read_handler() [+ + +]
Author: Ibrahim Hashimov <[email protected]>
Date:   Wed Jul 15 13:52:53 2026 +0200

    HID: nintendo: fix out-of-bounds read in joycon_ctlr_read_handler()
    
    commit 27b376b945c0aac46fcdfcc950b14a85b874b557 upstream.
    
    joycon_ctlr_read_handler() casts an incoming HID input report to
    struct joycon_input_report and parses it, guarding the cast only with a
    12-byte length check:
    
            if (size >= 12) /* make sure it contains the input report */
                    joycon_parse_report(ctlr, (struct joycon_input_report *)data);
    
    struct joycon_input_report is 49 bytes: a 13-byte header followed by a
    union whose IMU arm is 36 bytes. For an IMU report joycon_parse_report()
    -> joycon_parse_imu_report() walks that union (struct offsets 13..48),
    so a report of exactly 12 bytes with data[0] == JC_INPUT_IMU_DATA passes
    the guard yet is read up to 37 bytes past its declared length. The
    over-read bytes are decoded into accelerometer/gyroscope values and
    forwarded to userspace through the "(IMU)" input device, leaking
    driver-internal memory. data[0] and size are fully controlled by a
    malicious or spoofed Joy-Con/Pro Controller.
    
    Receive buffers are sized to the maximum report length, so this is an
    over-read within the allocation rather than a slab OOB, but the decoded
    bytes still reach userspace.
    
    The sibling subcmd path in joycon_ctlr_handle_event() already bounds the
    same cast correctly:
    
            if (size < sizeof(struct joycon_input_report) ||
                data[0] != JC_INPUT_SUBCMD_REPLY)
                    break;
    
    Use the same sizeof(struct joycon_input_report) bound here.
    
    Fixes: 2af16c1f846b ("HID: nintendo: add nintendo switch controller driver")
    Cc: [email protected]
    Signed-off-by: Ibrahim Hashimov <[email protected]>
    Assisted-by: AuditCode-AI:2026.07
    Reviewed-by: Silvan Jegen <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

HID: nintendo: register input device after capabilities are set [+ + +]
Author: Jiangshan Yi <[email protected]>
Date:   Thu Jul 30 18:15:06 2026 +0800

    HID: nintendo: register input device after capabilities are set
    
    commit d723bc1fe2e72b9252234e94c11af644ec477bf7 upstream.
    
    input_register_device() exposes the device to userspace immediately.
    In joycon_input_create() it was called before joycon_config_rumble()
    configures the FF_RUMBLE capability and the memless force-feedback
    device, so a concurrent EVIOCSFF could dereference a NULL dev->ff.
    
    Registering early also means the initial udev event lacks button and
    axis information, which can make input managers ignore the device.
    
    Move input_register_device() to the end of joycon_input_create(), after
    all capabilities, the IMU input device and the force-feedback callbacks
    have been configured.
    
    Fixes: 2af16c1f846b ("HID: nintendo: add nintendo switch controller driver")
    Reported-by: [email protected]
    Closes: https://sashiko.dev/#/patchset/[email protected]?part=1
    Cc: [email protected]
    Signed-off-by: Jiangshan Yi <[email protected]>
    Link: https://sashiko.dev/#/patchset/[email protected]?part=1
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

HID: nintendo: stop device IO before hid_hw_stop on probe failure [+ + +]
Author: Jiangshan Yi <[email protected]>
Date:   Thu Jul 30 11:19:27 2026 +0800

    HID: nintendo: stop device IO before hid_hw_stop on probe failure
    
    commit 1f74d3bff6fe04a64e02ab3661d2e0d554565aa6 upstream.
    
    nintendo_hid_probe() calls hid_device_io_start() before joycon_init()
    and joycon_leds_create().  If either fails, the error path jumps to
    err_close which calls hid_hw_close()/hid_hw_stop() without first calling
    hid_device_io_stop().
    
    hid_hw_stop() does not stop device IO, so hid_input_report() may still
    run and access driver data that is being torn down, resulting in a
    use-after-free.
    
    Add an err_io_stop label that calls hid_device_io_stop() before
    hid_hw_close(), and point the two post-io_start error paths at it.
    
    Fixes: 2af16c1f846b ("HID: nintendo: add nintendo switch controller driver")
    Cc: [email protected]
    Signed-off-by: Jiangshan Yi <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

HID: pidff: fix OOB write when hid->inputs is empty [+ + +]
Author: Baul Lee <[email protected]>
Date:   Sun Jul 26 15:25:03 2026 +0900

    HID: pidff: fix OOB write when hid->inputs is empty
    
    commit 67bb1074e3d2d12fa059a9cc707e89398a4e4704 upstream.
    
    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 <[email protected]>
    
    Fixes: f06bf8d94fff ("HID: Add hid-universal-pidff driver and supported device ids")
    Reported-by: Federico Kirschbaum <[email protected]>
    Reported-by: Baul Lee <[email protected]>
    Cc: [email protected]
    Signed-off-by: Baul Lee <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

HID: rapoo: fix missing hid_is_usb() check [+ + +]
Author: Jann Horn <[email protected]>
Date:   Fri Jul 3 17:45:54 2026 +0200

    HID: rapoo: fix missing hid_is_usb() check
    
    commit b57af2448268c30c25509a832b6ff6dc27176b28 upstream.
    
    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.
    
    Add a dependency on USB_HID for hid_is_usb(), as other HID drivers do; the
    alternative would be to provide a simple stub implementation on !USB_HID
    builds.
    
    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: b3b1c68fb726 ("HID: rapoo: Add support for side buttons on RAPOO 0x2015 mouse")
    Cc: [email protected]
    Signed-off-by: Jann Horn <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

HID: sensor: custom: Fix use-after-free in enable_sensor [+ + +]
Author: Haoxiang Li <[email protected]>
Date:   Tue Jul 7 15:15:44 2026 +0800

    HID: sensor: custom: Fix use-after-free in enable_sensor
    
    commit ad8fb82b04422f49530d2aa2753cc81d1c60102c upstream.
    
    enable_sensor_store() can call set_power_report_state(), which
    dereferences sensor_inst->power_state and sensor_inst->report_state.
    These pointers refer to entries in sensor_inst->fields.
    
    Create the field attributes before exposing the enable_sensor sysfs
    attribute, so enable_sensor cannot be accessed before the state it
    depends on has been initialized.
    
    On remove, delete enable_sensor before freeing the field attributes,
    so a concurrent sysfs write cannot dereference freed memory through
    power_state or report_state.
    
    Reported-by: Sashiko AI Review <[email protected]>
    Link: https://sashiko.dev/#/patchset/[email protected]?part=1
    Fixes: 4a7de0519df5 ("HID: sensor: Custom and Generic sensor support")
    Cc: [email protected]
    Signed-off-by: Haoxiang Li <[email protected]>
    Acked-by: Srinivas Pandruvada <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

HID: uclogic: fix use-after-free of inrange_timer on remove [+ + +]
Author: Ibrahim Hashimov <[email protected]>
Date:   Tue Jul 14 19:39:46 2026 +0200

    HID: uclogic: fix use-after-free of inrange_timer on remove
    
    commit 506fd50a9027340f0e9dcc587d10ccb03312dba6 upstream.
    
    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: [email protected]
    Signed-off-by: Ibrahim Hashimov <[email protected]>
    Assisted-by: AuditCode-AI:2026.07
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
io_uring/cmd: fix iovec leak when the async cmd is not recycled [+ + +]
Author: Woraphat Khiaodaeng <[email protected]>
Date:   Sun Aug 2 14:35:18 2026 +0700

    io_uring/cmd: fix iovec leak when the async cmd is not recycled
    
    commit bb34ae5da3365699d53a756f4c96b6ea9f8ba0c1 upstream.
    
    An io_async_cmd carries an iovec array in ->vec.iovec, allocated when the
    vec has to grow and kept across recycling through ctx->cmd_cache.  On two
    paths nothing frees it and io_clean_op()'s kfree(req->async_data) drops
    the io_async_cmd without it.
    
    io_req_uring_cleanup() clears the async data flags only when
    io_alloc_cache_put() succeeds, and the cache holds IO_ALLOC_CACHE_MAX ==
    128 entries, so once it is full the put fails and the vec is left behind.
    An NVMe passthrough workload gets there without doing anything unusual:
    nvme_uring_cmd_io() returns -EIOCBQUEUED, so the io_async_cmd stays
    attached for the lifetime of the command and the live object count tracks
    the queue depth.  Above 128 the puts start failing.
    
    ->cleanup is the last chance to free an inherited vec, since
    io_req_uring_cleanup() returns early for an io-wq issued command and is
    not called at all for one completed without ever being issued.  But
    io_clean_op() calls ->cleanup only if REQ_F_NEED_CLEANUP is set, and for
    uring_cmd that happens only where the vec has to grow, so a command
    reusing a large enough cached vec never sets it.  io_rw_alloc_async() and
    io_msg_alloc_async() flag an inherited vec for exactly this reason;
    io_uring_cmd_prep() does not.
    
    Flag an inherited vec in io_uring_cmd_prep(), and free the vec when the
    cache put fails, as io_req_rw_cleanup() does.
    
    The leak is invisible under KASAN, where io_alloc_cache_vec_kasan() frees
    the vec unconditionally.
    
    Fixes: 3a4689ac109f ("io_uring/cmd: add iovec cache for commands")
    Cc: [email protected]
    Signed-off-by: Woraphat Khiaodaeng <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
io_uring/futex: don't mark futex wake requests as inflight [+ + +]
Author: Jens Axboe <[email protected]>
Date:   Thu Jul 30 06:50:13 2026 -0600

    io_uring/futex: don't mark futex wake requests as inflight
    
    commit 73e7019097473fc9f83a334ef2c6ab3343709fef upstream.
    
    Commit 079afb081c42 ("io_uring/futex: mark wait requests as inflight")
    added inflight tracking to ensure that do_exit() ->
    io_uring_files_cancel() finds and cancels pending futex waits before the
    mm goes away, as a private futex wait depends on the mm private futex
    hash staying alive for the duration of the request. However, as
    io_futex_prep() is shared between FUTEX_WAIT and FUTEX_WAKE, wake
    requests got marked as inflight as well.
    
    A futex wake executes fully inline at issue time and never depends on
    the mm staying alive after completion, hence there's no need to track
    it. Kill it.
    
    Cc: [email protected]
    Fixes: 079afb081c42 ("io_uring/futex: mark wait requests as inflight")
    Reported-by: Chengfeng Lin <[email protected]>
    Link: https://lore.kernel.org/io-uring/CANGjgdn=R_qyUdE=j9za+vkmqcxacbP-84OHXF4nZ4ho9qRyVg@mail.gmail.com/
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

io_uring/futex: only mark private futex waits as inflight [+ + +]
Author: Jens Axboe <[email protected]>
Date:   Thu Jul 30 06:50:47 2026 -0600

    io_uring/futex: only mark private futex waits as inflight
    
    commit 4d327bbd1cd2485783553b6b2b401aa475f90dd0 upstream.
    
    Inflight tracking of futex wait requests exists to ensure that do_exit()
    -> io_uring_files_cancel() cancels them before the mm goes away, as a
    private futex wait depends on the mm private futex hash staying alive
    for the duration of the request.
    
    Shared futexes have no such dependency. A FLAGS_SHARED request always
    resolves to either an inode based key or an mm-shared key, both of which
    fail futex_key_is_private() and hence always hash into the global futex
    hash, whose lifetime isn't tied to the mm.
    
    Only mark vectored futex waits as inflight if the futex is private.
    
    Cc: [email protected]
    Fixes: 079afb081c42 ("io_uring/futex: mark wait requests as inflight")
    Link: https://lore.kernel.org/io-uring/CANGjgdn=R_qyUdE=j9za+vkmqcxacbP-84OHXF4nZ4ho9qRyVg@mail.gmail.com/
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
io_uring/io-wq: fix worker accounting when canceling creation callbacks [+ + +]
Author: Vishnu Razdan <[email protected]>
Date:   Tue Aug 11 00:01:27 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.
    
    Fixes: 1d5f5ea7cb7d ("io-wq: remove worker to owner tw dependency")
    Cc: [email protected]
    Assisted-by: Codex:gpt-5.6-sol
    Signed-off-by: Vishnu Razdan <[email protected]>
    Reviewed-by: Gabriel Krisman Bertazi <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
io_uring/rsrc: fix folio size overflow in io_vec_fill_bvec() [+ + +]
Author: Ali Ahmet Memis <[email protected]>
Date:   Sun Aug 2 16:30:30 2026 +0000

    io_uring/rsrc: fix folio size overflow in io_vec_fill_bvec()
    
    commit 3f3a6a16bbe8bde76532d9415438f8cdef439e5d upstream.
    
    io_vec_fill_bvec() computes the folio size with a plain int 1:
    
            unsigned long folio_size = 1 << imu->folio_shift;
    
    imu->folio_shift is unsigned int and comes from folio_shift() of the
    folio backing the registered buffer, so it can be 32 or more on a 64 bit
    kernel. Shifting int 1 that far is undefined, and on x86 and arm64 the
    count is taken modulo 32, so a shift of 34 yields 4 rather than 16G.
    Every other folio_shift shift in this file already uses 1UL.
    
    The result is that the segment estimate and the fill loop disagree.
    io_estimate_bvec_size() sizes the bvec array with the real shift:
    
            max_segs += (iov[i].iov_len >> shift) + 2;
    
    so a 1M iovec on a 16G folio is charged 2 segments, while
    io_vec_fill_bvec() then walks the same iovec in folio_size chunks of 4
    bytes and writes res_bvec[bvec_idx] a quarter of a million times, past
    the end of the array it was given. src_bvec is advanced once per
    iteration as well, so imu->bvec is read past its end at the same time.
    validate_fixed_range() only checks that the range is inside the
    registered buffer and does not bound the segment count.
    
    Reaching it needs a folio with a shift of at least 32, which means a
    gigantic hugetlb page: 16G on arm64 with 64K pages, where
    CONT_PMD_SHIFT is 34 and hugetlb_add_hstate(CONT_PMD_SHIFT - PAGE_SHIFT)
    registers that size, and likewise on powerpc. x86_64 tops out at 1G, so
    a shift of 30, which still fits in int and is unaffected.
    
    Use 1UL, as the rest of the file does.
    
    Fixes: 9ef4cbbcb4ac ("io_uring: add infra for importing vectored reg buffers")
    Cc: [email protected]
    Signed-off-by: Ali Ahmet Memis <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
io_uring/uring_cmd: don't skip completion for a synchronous multishot cmd [+ + +]
Author: Jens Axboe <[email protected]>
Date:   Sat Aug 15 17:53:44 2026 -0600

    io_uring/uring_cmd: don't skip completion for a synchronous multishot cmd
    
    commit 360941242f09437a1e07cbed9b5a96663ffeabb6 upstream.
    
    If IORING_URING_CMD_MULTISHOT is set, io_uring_cmd() treats any
    non-negative return from ->uring_cmd() as the driver having taken
    ownership of the request and returns IOU_ISSUE_SKIP_COMPLETE. But
    nothing guarantees that the driver did so, and any handler that just
    completes the command inline and returns 0 or a positive result then
    leaves the request orphaned, leaking the io_kiocb, the async data,
    and the file reference.
    
    The special case isn't needed. ublk returns -EIOCBQUEUED for the
    multishot fetch command, which is passed through as-is, and the poll
    driven socket timestamp command returns -EAGAIN. Kill it, a multishot
    handler that wants to hang on to the request must return -EIOCBQUEUED
    or -EAGAIN like any other command.
    
    Fixes: 620a50c92700 ("io_uring: uring_cmd: add multishot support")
    Cc: [email protected]
    Reported-by: [email protected]
    Closes: https://lore.kernel.org/all/[email protected]/
    Link: https://lore.kernel.org/all/[email protected]/
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
io_uring: defer eventfd signaling when queued from a wakeup handler [+ + +]
Author: Jens Axboe <[email protected]>
Date:   Fri Aug 14 06:58:43 2026 -0600

    io_uring: defer eventfd signaling when queued from a wakeup handler
    
    commit cd305ee3633a45fcf5f3a5d83f99f3cb77d87b6e upstream.
    
    io_req_local_work_add() signals the CQ ring eventfd inline when it is the
    one to push the first entry onto ->work_list. For DEFER_TASKRUN rings that
    add is frequently done from a waitqueue wakeup handler, where an
    arbitrary waitqueue lock is held.
    
    eventfd_signal_mask() only refuses to recurse when current->in_eventfd
    is set, but that bit is set by eventfd_signal_mask() itself. If the wake
    chain starts somewhere else, signal goes out inline and can feed back
    into epoll.
    
    Add IOU_F_TWQ_IN_WAKE, set it on the task_work add done from the three
    waitqueue callbacks, and use it to force io_eventfd_signal() down the
    existing call_rcu_hurry() deferral instead of signaling inline.
    
    Fixes: 21a091b970cd ("io_uring: signal registered eventfd to process deferred task work")
    Cc: [email protected]
    Link: https://lore.kernel.org/all/[email protected]/
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
iommu/iommufd: Fix NULL pointer deref in iommufd_ioas_change_process when racing with iopt_map_file_pages [+ + +]
Author: Peiyang He <[email protected]>
Date:   Thu Aug 6 12:50:59 2026 +0800

    iommu/iommufd: Fix NULL pointer deref in iommufd_ioas_change_process when racing with iopt_map_file_pages
    
    commit d616de490ec0242dcf78f02f1adf7baa035c4d0d upstream.
    
    iommufd_ioas_change_process() iterates every IOAS area while only
    holding every IOAS iova_rwsem, so it assumes every area has a non-NULL
    pages pointer. That assumption can be false when it runs concurrently
    with iopt_map_file_pages().
    
    iopt_map_pages() executes in two phases. It first creates the area and
    inserts it into the interval tree under iova_rwsem, with area->pages
    still NULL. It then drops iova_rwsem and later fills area->pages
    under domains_rwsem. This leaves a window between area creation and
    area->pages fill where a concurrent iommufd_ioas_change_process()
    can observe the area and dereference a NULL area->pages pointer,
    leading to a NULL pointer dereference:
    
    BUG: kernel NULL pointer dereference, address: 00000000000000c0
    #PF: supervisor read access in kernel mode
    #PF: error_code(0x0000) - not-present page
    PGD 4b655067 P4D 4b655067 PUD 0
    Oops: Oops: 0000 [#1] SMP NOPTI
    CPU: 0 UID: 0 PID: 11841 Comm: syz.1.628 Not tainted 7.1.0 #3 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
    RIP: 0010:iommufd_ioas_change_process+0x419/0xd50 drivers/iommu/iommufd/ioas.c:538
    Code: 48 89 c3 48 85 c0 0f 84 cc 00 00 00 e8 10 f5 cb fd 48 8d 7b 68 e8 a7 b5 eb fd 48 8b 6b 68 48 8d bd c0 00 00 00 e8 17 b2 eb fd <8b> ad c0 00 00 00 bf 01 00 00 00 89 ee e8 85 ef cb fd 83 fd 01 74
    RSP: 0018:ffffc90015c17d28 EFLAGS: 00010246
    RAX: ffff8880186d5328 RBX: ffff88801d25e240 RCX: 0000000080000000
    RDX: 00000000000002d7 RSI: ffffffff83ba9e10 RDI: 00000000000000c0
    RBP: 0000000000000000 R08: ffffffff8e781eb8 R09: 0000000000000000
    R10: 00000000000000c0 R11: ffffffff83ba9e29 R12: ffff88802e216008
    R13: ffff88802e216000 R14: 0000000000000001 R15: 0000000000000000
    FS:  00007f4aea3f66c0(0000) GS:ffff8880b1fa1000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00000000000000c0 CR3: 000000004b75c000 CR4: 0000000000350ef0
    Call Trace:
     <TASK>
     iommufd_fops_ioctl+0x287/0x400 drivers/iommu/iommufd/main.c:533
     vfs_ioctl fs/ioctl.c:51 [inline]
     __do_sys_ioctl fs/ioctl.c:597 [inline]
     __se_sys_ioctl fs/ioctl.c:583 [inline]
     __x64_sys_ioctl+0x120/0x170 fs/ioctl.c:583
     x64_sys_call+0x1092/0x1fb0 arch/x86/include/generated/asm/syscalls_64.h:17
     do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
     do_syscall_64+0x10a/0x680 arch/x86/entry/syscall_64.c:94
     entry_SYSCALL_64_after_hwframe+0x77/0x7f
    RIP: 0033:0x7f4aec1a82bd
    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:00007f4aea3f6018 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
    RAX: ffffffffffffffda RBX: 00007f4aec436090 RCX: 00007f4aec1a82bd
    RDX: 0000200000000180 RSI: 0000000000003b92 RDI: 0000000000000003
    RBP: 00007f4aec250295 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
    R13: 00007f4aec436128 R14: 00007f4aec436090 R15: 00007ffd04ef23e0
     </TASK>
    Modules linked in:
    CR2: 00000000000000c0
    ---[ end trace 0000000000000000 ]---
    RIP: 0010:iommufd_ioas_change_process+0x419/0xd50 drivers/iommu/iommufd/ioas.c:538
    Code: 48 89 c3 48 85 c0 0f 84 cc 00 00 00 e8 10 f5 cb fd 48 8d 7b 68 e8 a7 b5 eb fd 48 8b 6b 68 48 8d bd c0 00 00 00 e8 17 b2 eb fd <8b> ad c0 00 00 00 bf 01 00 00 00 89 ee e8 85 ef cb fd 83 fd 01 74
    RSP: 0018:ffffc90015c17d28 EFLAGS: 00010246
    RAX: ffff8880186d5328 RBX: ffff88801d25e240 RCX: 0000000080000000
    RDX: 00000000000002d7 RSI: ffffffff83ba9e10 RDI: 00000000000000c0
    RBP: 0000000000000000 R08: ffffffff8e781eb8 R09: 0000000000000000
    R10: 00000000000000c0 R11: ffffffff83ba9e29 R12: ffff88802e216008
    R13: ffff88802e216000 R14: 0000000000000001 R15: 0000000000000000
    FS:  00007f4aea3f66c0(0000) GS:ffff8880b1fa1000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00000000000000c0 CR3: 000000004b75c000 CR4: 0000000000350ef0
    ----------------
    Code disassembly (best guess):
       0:   48 89 c3                mov    %rax,%rbx
       3:   48 85 c0                test   %rax,%rax
       6:   0f 84 cc 00 00 00       je     0xd8
       c:   e8 10 f5 cb fd          call   0xfdcbf521
      11:   48 8d 7b 68             lea    0x68(%rbx),%rdi
      15:   e8 a7 b5 eb fd          call   0xfdebb5c1
      1a:   48 8b 6b 68             mov    0x68(%rbx),%rbp
      1e:   48 8d bd c0 00 00 00    lea    0xc0(%rbp),%rdi
      25:   e8 17 b2 eb fd          call   0xfdebb241
    * 2a:   8b ad c0 00 00 00       mov    0xc0(%rbp),%ebp <-- trapping instruction
      30:   bf 01 00 00 00          mov    $0x1,%edi
      35:   89 ee                   mov    %ebp,%esi
      37:   e8 85 ef cb fd          call   0xfdcbefc1
      3c:   83 fd 01                cmp    $0x1,%ebp
      3f:   74                      .byte 0x74
    
    Fix by mirroring the handling logic in iopt_unmap_iova_range(),
    i.e. return -EBUSY if area->pages is NULL.
    
    Fixes: 829ed626499c ("iommufd: Add IOMMU_IOAS_CHANGE_PROCESS")
    Link: https://patch.msgid.link/r/7344B7A7B9957A65+20260806045059.1884737-1-peiyang_he@smail.nju.edu.cn
    Cc: [email protected]
    Signed-off-by: Peiyang He <[email protected]>
    Signed-off-by: Jason Gunthorpe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
iommu/tegra241-cmdqv: Fix CMD_SYNC use-after-free on teardown [+ + +]
Author: Shameer Kolothum <[email protected]>
Date:   Mon Jun 29 10:41:06 2026 +0100

    iommu/tegra241-cmdqv: Fix CMD_SYNC use-after-free on teardown
    
    commit 9ff145a25c5c8a26b06ef7cf558fb536b18bba6d upstream.
    
    arm_smmu_impl_remove() is registered as a devres action in
    arm_smmu_impl_probe(), before arm_smmu_init_queues() allocates
    smmu->cmdq.q.base. On a devres unwind, whether a failed probe or an
    unbind, the queue is freed first and arm_smmu_impl_remove() then runs
    tegra241_cmdqv_remove_vintf(), whose VINTF deinit issues a CMD_SYNC on
    the freed memory.
    
    Observed during testing with a QEMU hack that makes the VCMDQ fail to
    enable, so the impl reset fails and probe aborts into the devres unwind:
    
     platform NVDA200C:00: tegra241_cmdqv: VINTF0: VCMDQ0/LVCMDQ0: failed to enable, STATUS=0x00000000
     platform NVDA200C:00: tegra241_cmdqv: VINTF0: VCMDQ0/LVCMDQ0: GERRORN=0x0, GERROR=0x4, CONS=0x0
     platform NVDA200C:00: tegra241_cmdqv: VINTF0: VCMDQ0/LVCMDQ0: uncleared error detected, resetting
     arm-smmu-v3 arm-smmu-v3.0.auto: failed to reset impl
     arm-smmu-v3 arm-smmu-v3.0.auto: probe with driver arm-smmu-v3 failed with error -110
     Unable to handle kernel paging request at virtual address ffff8000891e0098
     ...
     Internal error: Oops: 0000000096000047 [#1] SMP
     ...
     Call trace:
      arm_smmu_cmdq_issue_cmdlist+0x320/0x6fc (P)
      tegra241_vcmdq_hw_deinit+0x98/0x168
      tegra241_vintf_hw_deinit+0x5c/0x1b0
      tegra241_cmdqv_remove_vintf+0x34/0xec
      tegra241_cmdqv_remove+0x40/0x9c
      arm_smmu_impl_remove+0x20/0x30
      devm_action_release+0x14/0x20
      devres_release_all+0xa8/0x110
      device_unbind_cleanup+0x18/0x84
      really_probe+0x1f0/0x29c
    
    Drop the VINTF deinit from tegra241_cmdqv_remove_vintf() so the unwind no
    longer touches the freed queue. Quiesce the VINTFs earlier instead. Add a
    device_disable() impl op and run it from arm_smmu_disable_action() while
    the CMDQ is still up. That handles a live unbind. A failed reset is already
    handled because tegra241_vintf_hw_init() deinits the VINTF on its own error
    path. tegra241_cmdqv_remove_vintf() is also used by the iommufd viommu
    destroy path, so quiesce there too.
    
    Fixes: 4dc0d12474f9 ("iommu/tegra241-cmdqv: Add user-space use support")
    Cc: [email protected]
    Reviewed-by: Nicolin Chen <[email protected]>
    Signed-off-by: Shameer Kolothum <[email protected]>
    Reviewed-by: Jason Gunthorpe <[email protected]>
    Signed-off-by: Will Deacon <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ipv4: reject undersized MTUs in ip_do_fragment() [+ + +]
Author: Yong Wang <[email protected]>
Date:   Fri Aug 14 01:35:26 2026 +0800

    ipv4: reject undersized MTUs in ip_do_fragment()
    
    commit c0726f0caf8c6b3208552949e17d23634a2f3129 upstream.
    
    ip_do_fragment() subtracts the IPv4 header length from the effective
    MTU and passes the resulting payload MTU to ip_frag_next().
    
    If the effective MTU is smaller than hlen + 8, ip_frag_next() rounds
    the fragment payload length down to zero. The fragmentation state then
    never makes forward progress: state->left, state->ptr and state->offset
    stay unchanged while ip_do_fragment() keeps allocating and transmitting
    header-only fragments until the softlockup detector fires.
    
    This is reproducible with a route installed using "mtu lock 20", but it
    is also reproducible without route MTU lock, for example by forwarding a
    packet to a device whose MTU is 20.
    
    Fix it in ip_do_fragment() by rejecting mtu < hlen + 8 with -EMSGSIZE,
    matching the existing IPv6 fragmentation check.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: [email protected]
    Reported-by: Vega <[email protected]>
    Signed-off-by: Yong Wang <[email protected]>
    Signed-off-by: Ren Wei <[email protected]>
    Reviewed-by: Ido Schimmel <[email protected]>
    Link: https://patch.msgid.link/8809ef6314b98913681b0b370a05a85c2b6cd579.1786599079.git.edragain@163.com
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ipv6: fix use-after-free in ip6_finish_output2() [+ + +]
Author: Luxiao Xu <[email protected]>
Date:   Wed Aug 12 20:54:38 2026 +0800

    ipv6: fix use-after-free in ip6_finish_output2()
    
    commit d0d48d999b0eee6bb176ef4e39d9be868fa80f7e upstream.
    
    ip6_finish_output2() caches a pointer to the IPv6 destination
    address (daddr) before invoking lwtunnel_xmit().  The LWT-BPF
    transmit path or other encapsulation operations within
    lwtunnel_xmit() can reallocate the skb head, freeing the memory
    that daddr points to.  When lwtunnel_xmit() returns
    LWTUNNEL_XMIT_CONTINUE, the function continues to use the stale
    daddr pointer to compute the nexthop and to look up or create the
    neighbour entry.  This results in a use-after-free read, which can
    leak sensitive kernel data, pollute the neighbour table with
    arbitrary values, misdirect traffic, or crash the system.
    
    Fix this by re-fetching the IPv6 header and the destination
    address pointer after lwtunnel_xmit() returns
    LWTUNNEL_XMIT_CONTINUE, ensuring that the subsequent nexthop
    computation and neighbour lookup operate on valid memory.
    
    Fixes: e415ed3a4b8b ("ipv6: use skb_expand_head in ip6_finish_output2")
    Cc: [email protected]
    Reported-by: Vega <[email protected]>
    Signed-off-by: Luxiao Xu <[email protected]>
    Signed-off-by: Ren Wei <[email protected]>
    Reviewed-by: Vadim Fedorenko <[email protected]>
    Reviewed-by: Ido Schimmel <[email protected]>
    Link: https://patch.msgid.link/4aa3f53bc44e79572c6dd2340ec7b68ef1a3d87d.1786516730.git.rakukuip@gmail.com
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
kcov: fix data corruption and race conditions on PREEMPT_RT [+ + +]
Author: Tetsuo Handa <[email protected]>
Date:   Thu Jul 16 08:01:29 2026 +0900

    kcov: fix data corruption and race conditions on PREEMPT_RT
    
    commit 2eed77fdcb0cc48e8eccb2bcd4b7f2c6d650e84c upstream.
    
    syzbot is reporting KCOV state corruption on PREEMPT_RT kernels, for the
    temporary storage used for saving/restoring remote KCOV state is currently
    allocated as the per-CPU area.
    
    On PREEMPT_RT kernels, softirq handlers run as preemptible task threads
    (e.g., ksoftirqd). If a softirq context preempts a task running a remote
    KCOV session, it safely saves the task's state into the per-CPU area.
    However, if that softirq thread is subsequently preempted by a higher-
    priority softirq thread on the same CPU, the second softirq will overwrite
    the same per-CPU area, permanently destroying the original task's KCOV
    state.
    
    Fix this data corruption by moving the temporary storage from the per-CPU
    area to the per-thread area. Since each softirq thread now owns its own
    task context, nested softirq preemption no longer causes data overwrites.
    
    Note that while the temporary storage is now on a per-thread basis, the
    per-CPU kcov_percpu_data.lock must be retained, for we need to ensure that
    kcov_remote_start() and kcov_remote_stop() operate atomically without
    racing against asynchronous interrupts that manipulate the current task's
    KCOV state.
    
    It is likely that GFP_KERNEL allocation by vmalloc_node() in kcov_init()
    has already called panic() before returning NULL, for there will be no
    OOM-killable userspace processes when __init function of built-in module
    runs. But this patch also fixes crashing the kernel when vmalloc_node()
    in kcov_init() returned NULL, for kcov_init() left per-CPU irq_area == NULL
    but kcov_remote_start() depends on per-CPU irq_area != NULL, resulting in
    
      (1) doing vmalloc() in kcov_remote_start() despite !in_task() context
    
      (2) out-of-array-bounds access if (1) succeeded but
          kcov->remote_size < CONFIG_KCOV_IRQ_AREA_SIZE
    
      (3) always leak memory allocated by (1), eventually killing all
          OOM-killable userspace processes
    
    problems.
    
    Link: https://lore.kernel.org/[email protected]
    Reported-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=3f51ad7ac3ae57a6fdcc
    Reported-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=47cf95ca1f9dcca872c8
    Reported-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=8a173e13208949931dc7
    Reported-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=90984d3713722683112e
    Analyzed-by: AI Mode in Google Search (no mail address)
    Fixes: 5ff3b30ab57d ("kcov: collect coverage from interrupts")
    Signed-off-by: Tetsuo Handa <[email protected]>
    Reviewed-by: Alexander Potapenko <[email protected]>
    Cc: Alan Stern <[email protected]>
    Cc: Andrey Konovalov <[email protected]>
    Cc: Christoph Hellwig <[email protected]>
    Cc: Clark Williams <[email protected]>
    Cc: Dmitry Vyukov <[email protected]>
    Cc: Greg Kroah-Hartman <[email protected]>
    Cc: Marco Elver <[email protected]>
    Cc: Mark Brown <[email protected]>
    Cc: Roman Gushchin <[email protected]>
    Cc: Sebastian Andrzej Siewior <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
Linux: Linux 7.1.11 [+ + +]
Author: Greg Kroah-Hartman <[email protected]>
Date:   Thu Aug 27 14:34:41 2026 +0200

    Linux 7.1.11
    
    Link: https://lore.kernel.org/r/[email protected]
    Tested-by: Pavel Machek (CIP) <[email protected]>
    Tested-by: Justin M. Forbes <[email protected]>
    Tested-by: Florian Fainelli <[email protected]>
    Tested-by: Shuah Khan <[email protected]>
    Tested-by: Ron Economos <[email protected]>
    Tested-by: Salvatore Bonaccorso <[email protected]>
    Tested-by: Brett A C Sheffield <[email protected]>
    Tested-by: Takeshi Ogasawara <[email protected]>
    Tested-by: Miguel Ojeda <[email protected]>
    Tested-by: Peter Schneider <[email protected]>
    Tested-by: Benjamin Boortz <[email protected]>
    Tested-by: Barry K. Nathan <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mailbox: mchp-ipc-sbi: Add null check for devm_kasprintf() [+ + +]
Author: Griffin Kroah-Hartman <[email protected]>
Date:   Thu Jul 9 15:16:40 2026 +0200

    mailbox: mchp-ipc-sbi: Add null check for devm_kasprintf()
    
    commit b37c4d0a2fd90c0c31223acd37f763eb8953ed1a upstream.
    
    Add a check to see if devm_kasprintf() is not NULL in
    mchp_ipc_get_cluster_aggr_irq(), returning -ENOMEM if the function
    failed.
    
    Assisted-by: gkh_clanker_t1000
    CC: Jassi Brar <[email protected]>
    Signed-off-by: Griffin Kroah-Hartman <[email protected]>
    Signed-off-by: Jassi Brar <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mptcp: pm: fix memory leak from alloc-during-teardown race [+ + +]
Author: Shardul Bankar <[email protected]>
Date:   Mon Aug 24 17:55:36 2026 -0400

    mptcp: pm: fix memory leak from alloc-during-teardown race
    
    [ Upstream commit efc33b5102ff859bacd390a5f30112d8e0c084c0 ]
    
    mptcp_pm_destroy() empties msk->pm.anno_list and
    msk->pm.userspace_pm_local_addr_list under msk->pm.lock during socket
    teardown, dropping the lock between the two.
    
    A concurrent userspace PM genl ANNOUNCE on the same msk holds a sock
    reference via mptcp_token_get_sock() and, in
    mptcp_pm_nl_announce_doit(), calls
    mptcp_userspace_pm_append_new_local_addr() and
    mptcp_pm_announced_alloc(). Both take msk->pm.lock briefly to add to
    their respective lists. Because the genl handler holds a sock reference,
    mptcp_pm_destroy() may run on the same msk via mptcp_disconnect(), which
    invokes mptcp_destroy_common() without dropping the sock refcount,
    before the handler completes.
    
    If the lock acquisitions interleave such that mptcp_pm_destroy() empties
    a list first, the later alloc adds its entry to a list head that nothing
    else iterates for this msk, and the entry leaks. kmemleak reports both
    mptcp_pm_add_addr objects (from mptcp_pm_announced_alloc()) and
    mptcp_pm_addr_entry objects (from
    mptcp_userspace_pm_append_new_local_addr()) under sustained concurrent
    ANNOUNCE + close load against the userspace PM.
    
    Add an MPTCP_PM_DESTROYING bit in msk->pm.status, set by
    mptcp_pm_destroy() under pm.lock before the lists are emptied and
    checked under pm.lock by the alloc paths. Either the alloc takes pm.lock
    first, in which case its entry is on the list when mptcp_pm_destroy()
    frees it; or mptcp_pm_destroy() takes pm.lock first, in which case the
    later alloc observes the bit and refuses.
    
    Found by an MPTCP protocol-flow harness extending BRF (arXiv:2305.08782).
    
    Fixes: 9ab4807c84a4 ("mptcp: netlink: Add MPTCP_PM_CMD_ANNOUNCE")
    Cc: [email protected]
    Signed-off-by: Shardul Bankar <[email protected]>
    Reviewed-by: Matthieu Baerts (NGI0) <[email protected]>
    Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
    Link: https://patch.msgid.link/20260803-net-mptcp-misc-fixes-7-2-rc6-v2-6-b8f496d71664@kernel.org
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

mptcp: pm: rename add_entry structure to add_addr [+ + +]
Author: Matthieu Baerts (NGI0) <[email protected]>
Date:   Mon Aug 24 17:55:34 2026 -0400

    mptcp: pm: rename add_entry structure to add_addr
    
    [ Upstream commit 350d76dd6e79468ac85767f2d236299a135572df ]
    
    Using only the 'add' prefix is confusing: does it refer to a generic
    added entry or address, or specifically to ADD_ADDRs. Using add_addr
    removes this confusion.
    
    Reviewed-by: Mat Martineau <[email protected]>
    Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
    Link: https://patch.msgid.link/20260605-net-next-mptcp-add-addr6-port-ts-v2-10-758e7ca73f4d@kernel.org
    Signed-off-by: Jakub Kicinski <[email protected]>
    Stable-dep-of: efc33b5102ff ("mptcp: pm: fix memory leak from alloc-during-teardown race")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

mptcp: pm: uniform announced addresses helpers [+ + +]
Author: Matthieu Baerts (NGI0) <[email protected]>
Date:   Mon Aug 24 17:55:35 2026 -0400

    mptcp: pm: uniform announced addresses helpers
    
    [ Upstream commit 7d4dacc8ccca8e40fcb5f2ece9ea3e502da1bd3f ]
    
    Similar to the previous commit, only using the 'add' or 'anno' prefixes
    is confusing -- generally associated to the action of adding something,
    or the Latin name for "year" -- and lack of uniformity.
    
    This has been causing issues in the past, e.g. del_add_timer seemed to
    suggest the goal is to delete a previously added timer.
    
    Instead, use the mptcp_pm_announced_ prefix.
    
    While at it, slightly improves some helpers:
    
    - mptcp_lookup_anno_list_by_saddr: no need to specify what is used to do
      the lookup: mptcp_pm_announced_lookup.
    
    - mptcp_pm_sport_in_anno_list: it doesn't just compare the port, but the
      whole address linked to the sublow: mptcp_pm_announced_has_ssk.
    
    - mptcp_pm_alloc_anno_list: it allocates one item of the list, not a
      whole list: mptcp_pm_announced_alloc.
    
    Reviewed-by: Mat Martineau <[email protected]>
    Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
    Link: https://patch.msgid.link/20260605-net-next-mptcp-add-addr6-port-ts-v2-11-758e7ca73f4d@kernel.org
    Signed-off-by: Jakub Kicinski <[email protected]>
    Stable-dep-of: efc33b5102ff ("mptcp: pm: fix memory leak from alloc-during-teardown race")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
net/ionic: avoid OOB TX partner lookup for hwstamp RXQ [+ + +]
Author: Anand Khoje <[email protected]>
Date:   Thu Aug 13 08:37:05 2026 +0000

    net/ionic: avoid OOB TX partner lookup for hwstamp RXQ
    
    commit d92255b405fb6f5acca408239ccd742e0a42c9cb upstream.
    
    The dedicated hardware timestamp RX queue is allocated with q->index
    equal to lif->ionic->nrxqs_per_lif. The normal txqcqs array only
    contains the regular queue pairs, so using that index to set rxq->partner
    can read one entry past txqcqs[] and then write through the derived
    pointer.
    Only link RX/TX partners for normal queue-pair indexes. Leave the hwstamp
    RX queue unpaired, and make the XDP_TX path abort cleanly if an RX queue
    has no TX partner.
    
    Fixes: 8eeed8373e1c ("ionic: Add XDP_TX support")
    Reviewed-by: Si-Wei Liu <[email protected]>
    Reviewed-by: Shannon Nelson <[email protected]>
    Cc: [email protected]
    Signed-off-by: Anand Khoje <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Reviewed-by: Brett Creeley <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
nfc: digital: clamp SENSF_RES length to the destination buffer [+ + +]
Author: Doruk Tan Ozturk <[email protected]>
Date:   Wed Jun 3 16:13:55 2026 +0200

    nfc: digital: clamp SENSF_RES length to the destination buffer
    
    commit 344a56d7c8e0f3cbaff0bcb1bcd95a1a1db24b16 upstream.
    
    digital_in_recv_sensf_res() memcpy()s resp->len bytes from a remote
    NFC-F device response into the NFC_SENSF_RES_MAXSIZE-byte target.sensf_res
    field without an upper-bound check. A nearby malicious NFC-F device can
    send an oversized SENSF_RES response to overflow the stack-local struct
    nfc_target.
    
    Clamp resp->len to NFC_SENSF_RES_MAXSIZE before the copy.
    
    Found by 0sec automated security-research tooling (https://0sec.ai).
    
    Fixes: 8c0695e4998d ("NFC Digital: Add NFC-F technology support")
    Cc: [email protected]
    Signed-off-by: Doruk Tan Ozturk <[email protected]>
    Reviewed-by: Alexander Lobakin <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: David Heidelberg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

nfc: fdp: bound the device-reported read length and fix an skb leak [+ + +]
Author: Bryam Vargas <[email protected]>
Date:   Tue Jun 16 23:33:35 2026 -0500

    nfc: fdp: bound the device-reported read length and fix an skb leak
    
    commit 7ad21dcfeb5181af0c3ee2608808c0c0a5283aa1 upstream.
    
    fdp_nci_i2c_read() takes the next packet length from two device-supplied
    bytes and never validates it. The value is a u16 used as the
    i2c_master_recv() count into a 261-byte on-stack buffer: a malicious,
    counterfeit or malfunctioning controller (or an i2c bus interposer) can
    drive it far past the buffer for a stack out-of-bounds write that
    clobbers the canary and return address, or below the minimum frame size
    (directly, or by truncating the computed sum) so the header/LRC strip
    and the next length read run past a short receive. Reject a length
    outside [FDP_NCI_I2C_MIN_PAYLOAD, FDP_NCI_I2C_MAX_PAYLOAD], as a
    corrupted packet already is, and force resynchronization.
    
    The same loop allocates one data skb per iteration and assumes a length
    packet followed by a data packet; a device that sends two data packets
    in one call leaks the first skb when the second allocation overwrites
    it. Free a previously allocated skb before allocating the next.
    
    Fixes: a06347c04c13 ("NFC: Add Intel Fields Peak NFC solution driver")
    Cc: [email protected]
    Suggested-by: Simon Horman <[email protected]>
    Signed-off-by: Bryam Vargas <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: David Heidelberg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

nfc: llcp: bound the connect_sn TLV walk to the skb [+ + +]
Author: Doruk Tan Ozturk <[email protected]>
Date:   Thu Jul 9 15:12:29 2026 +0200

    nfc: llcp: bound the connect_sn TLV walk to the skb
    
    commit 55c68ac93e7dacc0f5f608b9c39dd4ff48cf28e8 upstream.
    
    Commit 27256cdb290e ("nfc: llcp: bound SNL TLV parsing to the skb and
    add length checks") fixed the unbounded TLV walk in nfc_llcp_recv_snl(),
    and commit d8bd2dedbde5 ("nfc: llcp: fix OOB read and u8 offset wrap in
    TLV parsers") subsequently bounded nfc_llcp_parse_gb_tlv() and
    nfc_llcp_parse_connection_tlv(). One sibling parser sharing the same
    pattern remains unbounded: nfc_llcp_connect_sn().
    
    nfc_llcp_connect_sn() walks a TLV list, reading a two-byte header
    (type, length) followed by length bytes of value, without checking that
    the two header bytes or the declared length stay within the buffer. It
    returns a pointer to a service name of up to 255 bytes that may point
    past the end of the skb; it is subsequently consumed by memcmp() in
    nfc_llcp_sock_from_sn(). In addition tlv_array_len was computed as
    "skb->len - LLCP_HEADER_SIZE" in size_t, so a CONNECT/CC frame shorter
    than the LLCP header underflows to a huge length and the walk runs far
    past the buffer.
    
    nfc_llcp_connect_sn() is reachable from nfc_llcp_recv_connect() and
    nfc_llcp_recv_cc(), i.e. from received CONNECT and CC PDUs. A nearby
    NFC device can reach this without authentication; LLCP link activation
    happens automatically after NFC-DEP, and the nfc_llcp_rx_skb()
    dispatcher applies no minimum-length guard.
    
    Walk the TLV list by pointer, bounded by skb_tail_pointer(skb), and
    validate each declared length before use, matching the approach already
    used for nfc_llcp_recv_snl(). Starting the walk at
    &skb->data[LLCP_HEADER_SIZE] against the tail pointer also removes the
    size_t underflow for short frames.
    
    Found by 0sec automated security-research tooling (https://0sec.ai).
    
    Fixes: d646960f7986 ("NFC: Initial LLCP support")
    Cc: [email protected]
    Assisted-by: 0sec:claude-opus-4-8
    Signed-off-by: Doruk Tan Ozturk <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: David Heidelberg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

nfc: llcp: fix OOB read and u8 offset wrap in TLV parsers [+ + +]
Author: Muhammad Bilal <[email protected]>
Date:   Mon Jun 22 18:18:02 2026 +0500

    nfc: llcp: fix OOB read and u8 offset wrap in TLV parsers
    
    commit 78b20c8eeacd2e44a2d8a4cb5316d3c521d90911 upstream.
    
    nfc_llcp_parse_gb_tlv() and nfc_llcp_parse_connection_tlv() contain
    three related bugs in their TLV parsing loops:
    
    1. 'offset' is declared u8 but tlv_array_len is u16. When TLV data
       advances offset past 255 it silently wraps to zero, causing
       infinite loops or double-processing of buffer data.
    
    2. Before reading tlv[0] (type) and tlv[1] (length) there is no
       check that offset+2 <= tlv_array_len. A truncated TLV causes
       an OOB read of one byte past the buffer end.
    
    3. After reading the length field, the value bytes are accessed
       without checking offset+2+length <= tlv_array_len. A crafted
       length=0xFF on a short buffer causes up to 255 bytes of OOB
       read past the buffer end.
    
    Both functions are reachable without authentication via
    nfc_llcp_set_remote_gb() which feeds remote LLCP general bytes
    directly into nfc_llcp_parse_gb_tlv() with no additional
    validation.
    
    Fix all three issues by widening offset from u8 to u16 and adding
    bounds checks for both the TLV header and value field before each
    access.
    
    Fixes: 3df40eb3a2ea ("nfc: constify several pointers to u8, char and sk_buff")
    Cc: [email protected]
    Signed-off-by: Muhammad Bilal <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: David Heidelberg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

nfc: llcp: reject PDUs shorter than the LLCP header [+ + +]
Author: Doruk Tan Ozturk <[email protected]>
Date:   Tue Jul 14 18:46:31 2026 +0200

    nfc: llcp: reject PDUs shorter than the LLCP header
    
    commit 95674f506c6376d6722a23144c9acd26609771ed upstream.
    
    Every LLCP PDU begins with a two-byte header (DSAP/SSAP + PTYPE), but the
    receive path never checked that a frame is at least LLCP_HEADER_SIZE bytes
    before parsing it.
    
    nfc_llcp_rx_skb() reads the header via nfc_llcp_ptype()/nfc_llcp_dsap()/
    nfc_llcp_ssap(), which dereference pdu->data[0] and pdu->data[1], and a
    CONNECT or CC PDU then computes
    
            tlv_array_len = skb->len - LLCP_HEADER_SIZE;
    
    as a size_t and hands it to the TLV walk. When the frame is shorter than
    the header the subtraction wraps to a huge value and the walk runs far
    past the buffer, an out-of-bounds read.
    
    A nearby NFC device can reach this without authentication; LLCP link
    activation happens automatically after NFC-DEP.
    
    Guard the common receive choke point __nfc_llcp_recv(), shared by both the
    target (nfc_llcp_data_received()) and initiator (nfc_llcp_recv()) paths, so
    a short skb is dropped before the rx_work worker parses it. Use
    pskb_may_pull() rather than a skb->len test so the two header bytes are
    guaranteed to sit in the skb linear area even for a non-linear skb,
    matching how the sibling NCI and HCI receive paths validate their headers.
    
    Reproduced with a KFENCE out-of-bounds read via /dev/virtual_nci on
    linux-next.
    
    Found by 0sec automated security-research tooling (https://0sec.ai).
    
    Fixes: d646960f7986 ("NFC: Initial LLCP support")
    Cc: [email protected]
    Suggested-by: David Laight <[email protected]>
    Signed-off-by: Doruk Tan Ozturk <[email protected]>
    Reviewed-by: Vadim Fedorenko <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: David Heidelberg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

nfc: microread: validate target discovery payload lengths [+ + +]
Author: Pengpeng Hou <[email protected]>
Date:   Thu Jul 23 10:37:20 2026 +0800

    nfc: microread: validate target discovery payload lengths
    
    commit 25519469972ef57c3edb1805dabd6c5612b90211 upstream.
    
    microread_target_discovered() parses target discovery payloads from
    skb->data according to the HCI gate. The fixed field offsets and UID
    copies were checked only against the destination nfc_target buffers, not
    against the actual skb length.
    
    Validate that each gate-specific payload contains the fixed fields and
    UID bytes before reading or copying them.
    
    Fixes: cfad1ba87150 ("NFC: Initial support for Inside Secure microread")
    Cc: [email protected]
    Signed-off-by: Pengpeng Hou <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: David Heidelberg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

nfc: nci: add data_len bound checks to activation parameter extractors [+ + +]
Author: Bryam Vargas <[email protected]>
Date:   Fri Jun 12 12:50:25 2026 -0500

    nfc: nci: add data_len bound checks to activation parameter extractors
    
    commit 0428fa2c22e2ba0cff766d3b80d461e149102045 upstream.
    
    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: [email protected]
    Signed-off-by: Bryam Vargas <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: David Heidelberg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

nfc: nci: fix out-of-bounds write in nci_target_auto_activated() [+ + +]
Author: Samuel Page <[email protected]>
Date:   Mon Jun 22 16:52:43 2026 +0200

    nfc: nci: fix out-of-bounds write in nci_target_auto_activated()
    
    commit ac200079db50af81e6b04d058b33ec92901d8edd upstream.
    
    nci_target_auto_activated() appends a target to the fixed-size array
    ndev->targets[NCI_MAX_DISCOVERED_TARGETS] and increments ndev->n_targets
    without first checking the array is full; unlike its sibling
    nci_add_new_target(), which bails out when n_targets already equals
    NCI_MAX_DISCOVERED_TARGETS.
    
    ndev->n_targets is only cleared by nci_clear_target_list(), so an NFCC
    that repeatedly re-runs discovery (RF_DISCOVER_RSP, which re-enters
    NCI_DISCOVERY without clearing the target list) and reports an
    auto-activated target (RF_INTF_ACTIVATED_NTF) drives n_targets past the
    limit. The append then writes a struct nfc_target past the end of the
    array (a slab out-of-bounds write), and nfc_targets_found() goes on to
    walk the array with the inflated count:
    
      BUG: KASAN: slab-out-of-bounds in nci_add_new_protocol+0x94/0x2ac [nci]
      Write of size 2 at addr ffff0000c7299a18 by task kworker/u8:0/12
      Workqueue: nfc0_nci_rx_wq nci_rx_work [nci]
      Call trace:
       nci_add_new_protocol+0x94/0x2ac [nci]
       nci_ntf_packet+0xddc/0x11a0 [nci]
       nci_rx_work+0x15c/0x1e0 [nci]
       process_one_work+0x2dc/0x500
       worker_thread+0x240/0x460
       kthread+0x1c0/0x1d0
       ret_from_fork+0x10/0x20
    
      The buggy address belongs to the cache kmalloc-2k of size 2048
      The buggy address is located 1024 bytes to the right of
      allocated 1560-byte region [ffff0000c7299000, ffff0000c7299618)
    
    Guard nci_target_auto_activated() with the same check used by
    nci_add_new_target().
    
    Fixes: 019c4fbaa790 ("NFC: Add NCI multiple targets support")
    Cc: [email protected]
    Assisted-by: Bynario AI
    Signed-off-by: Samuel Page <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: David Heidelberg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

nfc: nci: fix uninit-value in the RF discover/activated NTF handlers [+ + +]
Author: Samuel Page <[email protected]>
Date:   Fri Jun 26 10:03:01 2026 +0100

    nfc: nci: fix uninit-value in the RF discover/activated NTF handlers
    
    commit 8cbe06c1e699c0a165dae5093a2550e65f914818 upstream.
    
    nci_rf_discover_ntf_packet() and nci_rf_intf_activated_ntf_packet() each
    parse a notification into an on-stack struct (nci_rf_discover_ntf /
    nci_rf_intf_activated_ntf) that is not initialised. The RF
    technology-specific parameters are only extracted when
    rf_tech_specific_params_len is non-zero, so a notification that reports a
    zero length leaves the rf_tech_specific_params union uninitialised - and
    both handlers then pass it to nci_add_new_protocol(), which reads it:
    
     - discover:  nci_add_new_target() -> nci_add_new_protocol();
     - activated: nci_target_auto_activated() -> nci_add_new_protocol().
    
    nci_add_new_protocol() uses nfca_poll->nfcid1_len as both a branch
    condition and a memcpy() length and copies nfcid1/sens_res/sel_res into
    ndev->targets, which is later exposed to user space via NFC_CMD_GET_TARGET.
    
      BUG: KMSAN: uninit-value in nci_add_new_protocol+0x624/0x6c0
       nci_add_new_protocol+0x624/0x6c0
       nci_ntf_packet+0x25b2/0x3c30
       nci_rx_work+0x318/0x5d0
       process_scheduled_works+0x84b/0x17a0
       worker_thread+0xc10/0x11b0
       kthread+0x376/0x500
      Local variable ntf.i created at:
       nci_ntf_packet+0xbc2/0x3c30
    
    Zero-initialise both on-stack notifications so the union reads back as
    zero when no technology-specific parameters are present.
    
    Fixes: 019c4fbaa790 ("NFC: Add NCI multiple targets support")
    Fixes: e8c0dacd9836 ("NFC: Update names and structs to NCI spec 1.0 d18")
    Link: https://lore.kernel.org/netdev/[email protected]/
    Cc: [email protected]
    Assisted-by: Bynario AI
    Signed-off-by: Samuel Page <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: David Heidelberg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

nfc: nci: free destination parameters when closing a connection [+ + +]
Author: Linmao Li <[email protected]>
Date:   Tue Jul 21 10:35:18 2026 +0800

    nfc: nci: free destination parameters when closing a connection
    
    commit 2e65bafdfd3a8bba972b3d17b6a57816557530fc upstream.
    
    When a connection is closed, nci_core_conn_close_rsp_packet() frees
    conn_info but not conn_info->dest_params, which is a separate devm
    allocation. Each connect/close cycle leaks one dest_params until the
    NFC device is removed. Free dest_params along with conn_info.
    
    Fixes: 9b8d1a4cf2aa ("nfc: nci: Add an additional parameter to identify a connection id")
    Cc: [email protected]
    Signed-off-by: Linmao Li <[email protected]>
    Reviewed-by: Vadim Fedorenko <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: David Heidelberg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

nfc: pn533: purge fragmented skbs during cleanup [+ + +]
Author: Xu Rao <[email protected]>
Date:   Mon Jul 20 10:14:44 2026 +0800

    nfc: pn533: purge fragmented skbs during cleanup
    
    commit 5718fc62198c38c2de5316020a90506f9e75e0bb upstream.
    
    pn53x_common_clean() purges resp_q before freeing the common PN533 state,
    but it leaves fragment_skb untouched.  The fragmentation helpers queue
    transmit fragments there while sending large initiator or target-mode
    frames, and those skbs remain owned by the driver until they are sent or
    discarded.
    
    If the device is removed while fragments are still queued, the common
    cleanup path frees the PN533 state without releasing the queued fragment
    skbs, leaking them.
    
    Purge fragment_skb during cleanup alongside resp_q.
    
    Fixes: 963a82e07d4e ("NFC: pn533: Split large Tx frames in chunks")
    Cc: [email protected]
    Signed-off-by: Xu Rao <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: David Heidelberg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

nfc: st21nfca: validate ATR_REQ length against the received frame [+ + +]
Author: Doruk Tan Ozturk <[email protected]>
Date:   Sat Jul 11 09:13:01 2026 +0200

    nfc: st21nfca: validate ATR_REQ length against the received frame
    
    commit 5cdcca5d62a66eda6b774110a44cba67bc1a8d1d upstream.
    
    st21nfca_tm_recv_atr_req() checks that the received ATR_REQ frame is at
    least ST21NFCA_ATR_REQ_MIN_SIZE and that the self-declared atr_req->length
    is at least sizeof(struct st21nfca_atr_req), but never checks that
    atr_req->length does not exceed the actual received length (skb->len).
    
    st21nfca_tm_send_atr_res() then trusts the declared length:
    
            gb_len = atr_req->length - sizeof(struct st21nfca_atr_req);
            ...
            memcpy(atr_res->gbi, atr_req->gbi, gb_len);
    
    so an RF peer that sends a short frame but sets atr_req->length larger
    than the frame makes gb_len exceed the general bytes actually present,
    and the memcpy reads out of bounds past the received skb. Those bytes are
    placed in the ATR_RES and sent back to the peer (kernel-memory disclosure
    to a proximity attacker); a larger declared length is an out-of-bounds
    read (DoS).
    
    Reject frames whose declared length exceeds the received length. The
    adjacent nfc_tm_activated() path in the same function already derives its
    general-bytes length from skb->len rather than the declared field.
    
    Found by 0sec (https://0sec.ai) using automated source analysis; the
    missing bound is evident from source. Compile-tested.
    
    Fixes: 1892bf844ea0 ("NFC: st21nfca: Adding P2P support to st21nfca in Initiator & Target mode")
    Cc: [email protected]
    Assisted-by: 0sec:claude-opus-4-8
    Signed-off-by: Doruk Tan Ozturk <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: David Heidelberg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
nilfs2: reject invalid block index in GC ioctl [+ + +]
Author: Ryusuke Konishi <[email protected]>
Date:   Fri Jul 3 01:07:19 2026 +0900

    nilfs2: reject invalid block index in GC ioctl
    
    commit a1735eae55448bc79c2da6593455791e886f6ed8 upstream.
    
    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: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=c37bed40868932d790e9
    Fixes: 7942b919f732 ("nilfs2: ioctl operations")
    Cc: wuyankun <[email protected]>
    Cc: [email protected]
    Signed-off-by: Ryusuke Konishi <[email protected]>
    Signed-off-by: Viacheslav Dubeyko <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
null_blk: fix UBSAN shift-out-of-bounds when zone_size is 0 or overflows [+ + +]
Author: Rik van Riel <[email protected]>
Date:   Sat Aug 8 11:42:39 2026 -0400

    null_blk: fix UBSAN shift-out-of-bounds when zone_size is 0 or overflows
    
    commit 95491fb05105b61050cb623a5e0227eb26aa3525 upstream.
    
    null_zone_no() does sect >> ilog2(dev->zone_size_sects). When
    zone_size_sects is 0, ilog2(0) returns -1, producing shift exponent -1
    which UBSAN reports as shift-out-of-bounds.
    
      UBSAN: shift-out-of-bounds in drivers/block/null_blk/zoned.c:21:14
      shift exponent -1 is negative
      Call Trace:
       null_zone_no drivers/block/null_blk/zoned.c:21 [inline]
       null_process_zoned_cmd+0xf76/0xf80 drivers/block/null_blk/zoned.c:728
       null_handle_cmd drivers/block/null_blk/main.c:1455 [inline]
       null_queue_rq+0x8bc/0xe70 drivers/block/null_blk/main.c:1703
       __blk_mq_issue_directly block/blk-mq.c:2694 [inline]
       blk_mq_try_issue_directly+0x3f4/0x880 block/blk-mq.c:2754
       blk_mq_submit_bio+0x20c0/0x2a40 block/blk-mq.c:3208
       submit_bio_noacct_nocheck+0x2f4/0xa40 block/blk-core.c:790
       block_read_full_folio+0x7a6/0x810 fs/buffer.c:2463
       filemap_read_folio+0x12c/0x3a0 mm/filemap.c:2510
       read_part_sector+0xb6/0x2b0 block/partitions/core.c:724
       adfspart_check_ICS+0xb1/0x960 block/partitions/acorn.c:357
       check_partition block/partitions/core.c:143 [inline]
       blk_add_partitions block/partitions/core.c:591 [inline]
       bdev_disk_changed+0x851/0x17a0 block/partitions/core.c:695
       blkdev_get_whole+0x372/0x510 block/bdev.c:751
       add_disk_final block/genhd.c:412 [inline]
       add_disk_fwnode+0x24b/0x3a0 block/genhd.c:606
       null_add_dev+0x130b/0x1d70 drivers/block/null_blk/main.c:2052
       nullb_device_power_store+0x240/0x380 drivers/block/null_blk/main.c:501
       configfs_write_iter+0x337/0x430 fs/configfs/file.c:229
    
    Syzkaller triggers this by creating a zoned null_blk device via
    configfs. The Call Trace shows configfs_write_iter in configfs/file.c
    handling a write to power file, which calls nullb_device_power_store in
    main.c, which calls null_add_dev in main.c, which calls add_disk in
    genhd.c, which triggers partition scan via bdev_disk_changed in
    partitions/core.c.
    
    A zoned null_blk device with zone_size 0 should not be legal. Existing
    code tries to reject it via is_power_of_2() check in zoned.c and
    !zone_size check in main.c, but syzkaller can still reach
    null_zone_no() with zone_size_sects 0 via two paths:
    
    1. Direct 0 via configfs: zone_size attribute store in main.c has
    NULLB_DEVICE_ATTR(zone_size, ulong, NULL) with no validation callback,
    so echo 0 > zone_size succeeds before power store. If zoned is false
    at power store time, the !zone_size check in main.c is skipped, and
    later zoned set true leaves zone_size 0.
    
    2. Large value overflow: mb_to_sects() in zoned.c does
    (sector_t)mb * SZ_1M >> SECTOR_SHIFT which is mb * 2048. If mb is
    1UL << 53 (9PB), mb * 2048 overflows 64-bit to 0. The value is
    power-of-two so is_power_of_2() passes, but mb_to_sects() returns 0.
    
    Check for zero zone_size explicitly in null_init_zoned_dev() in
    zoned.c, returning -EINVAL with "must be non-zero power-of-two".
    Check for zero zone_size_sects after mb_to_sects() conversion,
    returning -EINVAL for overflow case. Keep defensive check in
    null_zone_no() returning 0 for zero sectors to avoid shift out-of-bounds
    even if  zero slips through.
    
    This change should be safe because zone_size is set once in
    null_init_zoned_dev() under device lock and never changes after, and 0
    is never valid for a zoned device. Returning -EINVAL at init time fails
    device creation early with clear error, while defensive return 0 in
    null_zone_no() makes zoned command fail via offline zone check.
    No new locking is introduced.
    
    Reported-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=abd6a8dca0f2b7726060
    Link: https://lore.kernel.org/all/[email protected]/
    Fixes: 8a3cf049af68 ("null_blk: add zoned block device emulation")
    Cc: [email protected]
    Assisted-by: Hermes:muse-spark-1.2 syzkaller
    Signed-off-by: Rik van Riel <[email protected]>
    Reviewed-by: Damien Le Moal <[email protected]>
    Link: https://patch.msgid.link/20260808114239.69167f68@fangorn
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
nvmet-auth: zero the AUTH_RECEIVE response buffer [+ + +]
Author: Bryam Vargas <[email protected]>
Date:   Thu Jul 2 03:45:14 2026 -0500

    nvmet-auth: zero the AUTH_RECEIVE response buffer
    
    commit 3ddcfb013322aa37eaa7a0d344b73079c38dfa21 upstream.
    
    nvmet_execute_auth_receive() allocates the response buffer with kmalloc()
    sized by the host-supplied AUTH_RECEIVE allocation length, but the
    DH-HMAC-CHAP builders write only a fixed-size message into it. The full
    allocation length is then copied to the wire by nvmet_copy_to_sgl(), so a
    remote initiator receives the bytes past the built message -- up to nearly
    a page of uninitialized slab -- during the pre-authentication handshake.
    
    Allocate the buffer with kzalloc() so the unwritten tail is zeroed before
    it is sent; conforming responses are unaffected.
    
    Fixes: db1312dd9548 ("nvmet: implement basic In-Band Authentication")
    Cc: [email protected]
    Signed-off-by: Bryam Vargas <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Keith Busch <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
nvmet-fc: fix invalid free in LS IOD error path [+ + +]
Author: Jiang HongHui <[email protected]>
Date:   Wed Jul 29 19:02:06 2026 +0800

    nvmet-fc: fix invalid free in LS IOD error path
    
    commit ba98d6796d12258e837ece065d2ecb59d76ce4ff upstream.
    
    nvmet_fc_alloc_ls_iodlist() advances iod while initializing the LS IOD
    array. If an rqstbuf allocation or response buffer DMA mapping fails,
    the unwind loop decrements iod past the start of the array. The final
    kfree(iod) therefore frees an address before the allocated object.
    
    This can be reproduced with nvme-fcloop and failslab by setting
    fail-nth to 6 before creating a target port. KASAN reports:
    
      BUG: KASAN: invalid-free in nvmet_fc_register_targetport
      Free of addr ffff88816cf8ff48 by task nvmet_fail_nth/9552
    
    Free the original allocation base stored in tgtport->iod instead. With
    this fix applied, the same sysfs write with fail-nth=6 returns -ENOMEM
    without any KASAN report.
    
    Fixes: c53432030d86 ("nvme-fabrics: Add target support for FC transport")
    Cc: [email protected]
    Reviewed-by: Maurizio Lombardi <[email protected]>
    Assisted-by: Codex:gpt-5
    Signed-off-by: Jiang HongHui <[email protected]>
    Signed-off-by: Keith Busch <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
nvmet-tcp: bound SGL data length before allocating command buffers [+ + +]
Author: Ibrahim Hashimov <[email protected]>
Date:   Thu Jul 9 15:25:33 2026 +0200

    nvmet-tcp: bound SGL data length before allocating command buffers
    
    commit 4a3f00262a044e8e15064b1a6860968bf0500bf4 upstream.
    
    nvmet_tcp_map_data() reads the host-controlled 32-bit sgl->length
    and, for the in-capsule offset descriptor (type 0x01), checks it
    against port->inline_data_size before use. Any other SGL descriptor
    type -- including the non-inline transport SGL data-block descriptor
    (type (NVME_TRANSPORT_SGL_DATA_DESC << 4) | NVME_SGL_FMT_TRANSPORT_A,
    the type a real host uses for out-of-capsule writes) skips that check
    entirely and falls straight through to:
    
            cmd->req.sg = sgl_alloc(len, GFP_KERNEL, &cmd->req.sg_cnt);
    
    with len taken directly from the wire, unbounded up to 4 GiB.
    
    nvmet_req_init() only parses the command and never inspects
    sgl->length, and nvmet_check_transfer_len() -- the only other place
    transfer_len is validated -- runs later, from req->execute(), after
    the allocation has already happened. For a write command the target
    responds with an R2T and parks the command waiting for the host to
    send the data; if the host (or an unauthenticated peer that simply
    never follows up) never does, the sgl_alloc() buffer stays resident
    for the life of the command. NVMe/TCP has no mandatory authentication
    in the default configuration, so any peer able to reach the target
    portal and complete a Fabrics connect can drive this with a single
    crafted command, repeatable across queues and connections for
    amplification. This is unbounded kernel memory allocation
    triggered by a remote, effectively unauthenticated peer.
    
    Validate len against the same NVMET_TCP_MAXH2CDATA ceiling this file
    already uses to bound per-PDU H2C data, for every SGL descriptor type,
    before doing any allocation. This closes the gap for the non-inline
    descriptor while leaving the existing, tighter inline_data_size check
    in place for the in-capsule case.
    
    Runtime-verified on a v6.19 KASAN stand: with this bound in place, a
    crafted write command carrying an oversized non-inline SGL length is
    rejected before sgl_alloc() runs, where the same request previously
    drove an unbounded ~256 MiB kernel allocation (up to 4 GiB) that
    stayed resident pending an R2T the host never satisfies.
    
    Fixes: 872d26a391da ("nvmet-tcp: add NVMe over TCP target driver")
    Cc: [email protected]
    Reviewed-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Ibrahim Hashimov <[email protected]>
    Assisted-by: AuditCode-AI:2026.07
    Signed-off-by: Keith Busch <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

nvmet-tcp: Do not WARN on remotely-controlled oversized SGL allocations [+ + +]
Author: Greg Kroah-Hartman <[email protected]>
Date:   Mon Jul 27 22:03:31 2026 +0200

    nvmet-tcp: Do not WARN on remotely-controlled oversized SGL allocations
    
    commit 737a3b535247226f6e1a7988fd9d6e63e7d6fc71 upstream.
    
    When fuzzing the nvme target code, I tripped a kernel warning in
    nvmet_tcp_map_data() because the length passed into the allocator is
    controlled by the remote initiator.
    
    A remote initiator that sends a command with an SGL claiming a huge
    number, can create a scatterlist and iovec allocation of over 1 million
    entries, which causes the backing kmalloc call to exceed MAX_PAGE_ORDER
    and then the page allocator will trip on a WARN_ON_ONCE_GFP() message:
    
      WARNING: mm/page_alloc.c:5280 __alloc_frozen_pages_noprof
      Workqueue: nvmet_tcp_wq nvmet_tcp_io_work
      ...
      sgl_alloc_order
      nvmet_tcp_map_data
      nvmet_tcp_try_recv_pdu
    
    As it's never good to trip a kernel warning remotely due to many systems
    having panic-on-warn enabled, let's silence it by just add GFP_NOWARN to
    the allocation flags.
    
    Assisted-by: gkh_clanker_2000
    Cc: stable <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Keith Busch <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
nvmet: fix NULL pointer dereference in nvmet_execute_identify_nslist() [+ + +]
Author: Guixin Liu <[email protected]>
Date:   Tue Aug 4 10:18:57 2026 +0800

    nvmet: fix NULL pointer dereference in nvmet_execute_identify_nslist()
    
    commit 79aba4c9403419d822972d2851f2a96a2c0531cf upstream.
    
    When a host issues an Identify command with CNS 07h (Active Namespace ID
    List for a specific I/O Command Set), nvmet_execute_identify_nslist() is
    called with match_css set. The command-set filter dereferences req->ns,
    but this handler never calls nvmet_req_find_ns(), so req->ns is always
    NULL (nvmet_req_init() resets it to NULL). As soon as an enabled
    namespace with an NSID greater than the requested value exists,
    req->ns->csi dereferences a NULL pointer and oopses.
    
    Besides the crash, the comparison is logically wrong: to filter the list
    by command set it must test the command set of the namespace being
    iterated, not a single fixed value. Use the loop variable ns->csi.
    
    Fixes: 61c9967cd634 ("nvmet: implement active command set ns list")
    Signed-off-by: Guixin Liu <[email protected]>
    Reviewed-by: Hannes Reinecke <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Nilay Shroff <[email protected]>
    Signed-off-by: Keith Busch <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

nvmet: pci-epf: fix use-after-free in nvmet_pci_epf_exec_iod_work() [+ + +]
Author: Shin'ichiro Kawasaki <[email protected]>
Date:   Thu Jul 30 15:18:39 2026 +0900

    nvmet: pci-epf: fix use-after-free in nvmet_pci_epf_exec_iod_work()
    
    commit c9e9bb757971485b4e8414b1744507af186d72c9 upstream.
    
    nvmet_pci_epf_exec_iod_work() submits an I/O command with req->execute()
    and then waits for the command to complete and transfers the data back
    to the host. This wait is not needed for commands that do not transfer
    data from the device to the host. To decide whether that wait is needed,
    it reads iod->data_len and iod->dma_dir after calling req->execute().
    
    However, once req->execute() is called, the command may complete
    asynchronously on another CPU. For commands that do not require a
    device-to-host data transfer, nvmet_pci_epf_queue_response() calls
    nvmet_pci_epf_complete_iod() directly, which can free the iod before it
    reads iod->data_len and iod->dma_dir, resulting in the KFENCE use-after-
    free:
    
     BUG: KFENCE: use-after-free read in nvmet_pci_epf_exec_iod_work+0x288/0x798 [nvmet_pci_epf]
    
     Use-after-free read at 0x00000000fdfa6d03 (in kfence-#63):
      nvmet_pci_epf_exec_iod_work+0x288/0x798 [nvmet_pci_epf]
      process_one_work+0x15c/0x4f0
      worker_thread+0x18c/0x30c
      kthread+0x130/0x140
      ret_from_fork+0x10/0x20
    
     kfence-#63: 0x00000000e3de0e71-0x00000000c938ad62, size=712, cache=kmalloc-1k
    
     allocated by task 10 on cpu 0 at 73.995480s (0.005122s ago):
      mempool_kmalloc+0x1c/0x28
      mempool_alloc_noprof+0x40/0x9c
      nvmet_pci_epf_poll_sqs_work+0xd4/0x344 [nvmet_pci_epf]
      process_one_work+0x15c/0x4f0
      worker_thread+0x18c/0x30c
      kthread+0x130/0x140
      ret_from_fork+0x10/0x20
    
     freed by task 131 on cpu 3 at 73.995521s (0.008385s ago):
      mempool_kfree+0x10/0x20
      mempool_free+0x44/0x64
      nvmet_pci_epf_free_iod+0x88/0x98 [nvmet_pci_epf]
      nvmet_pci_epf_cq_work+0xfc/0x280 [nvmet_pci_epf]
      process_one_work+0x15c/0x4f0
      worker_thread+0x18c/0x30c
      kthread+0x130/0x140
      ret_from_fork+0x10/0x20
    
    Fix this by referring to iod->data_len and iod->dma_dir before calling
    req->execute(). The remaining iod accesses such as iod->status are only
    reached on the device-to-host read path. In this case,
    nvmet_pci_epf_queue_response() signals iod->done instead of freeing the
    iod, so the iod stays valid.
    
    Fixes: 0faa0fe6f90e ("nvmet: New NVMe PCI endpoint function target driver")
    Cc: [email protected]
    Reviewed-by: Damien Le Moal <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
    Signed-off-by: Keith Busch <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

nvmet: pci-epf: put CQ ref on create_cq mapping failure [+ + +]
Author: Yifei Gao <[email protected]>
Date:   Tue Aug 4 21:36:25 2026 +0000

    nvmet: pci-epf: put CQ ref on create_cq mapping failure
    
    commit 659ae9d02cb5d72c76f74fff7441eb8fb64d8f5c upstream.
    
    nvmet_pci_epf_create_cq() calls nvmet_cq_create(), which takes a
    reference on the controller and installs the completion queue. If the
    subsequent PCI address-space mapping fails or returns a too-small partial
    mapping, the function jumps to err_internal / err_unmap_queue without
    calling nvmet_cq_put(). The matching put in nvmet_pci_epf_delete_cq() is
    gated on NVMET_PCI_EPF_Q_LIVE, which is only set after the mapping
    succeeds, so teardown never releases these references. A remote PCI host
    that drives Create IO CQ commands with a failing PRP1/pci_addr therefore
    leaks the CQ and a controller reference on each attempt.
    
    Drop the CQ reference on the mapping-failure paths. The err_internal and
    err_unmap_queue labels are only reachable after nvmet_cq_create() has
    succeeded, so this pairs the create/put correctly.
    
    Fixes: 0faa0fe6f90e ("nvmet: New NVMe PCI endpoint function target driver")
    Cc: [email protected]
    Reviewed-by: Damien Le Moal <[email protected]>
    Assisted-by: Claude:claude-opus-4-8
    Signed-off-by: Yifei Gao <[email protected]>
    Signed-off-by: Keith Busch <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ocfs2: fix missing metadata reservation for large xattrs [+ + +]
Author: Ian Bridges <[email protected]>
Date:   Thu Jul 23 23:57:03 2026 -0500

    ocfs2: fix missing metadata reservation for large xattrs
    
    commit 0cdc7dde00ec63ac714271fa8b2918d630b8da1a upstream.
    
    [BUG]
    lsetxattr() panics the kernel when setting a large xattr value on a
    fragmented filesystem where the file already has an external xattr
    block.
    
    [CAUSE]
    ocfs2_calc_xattr_set_need() never reserves metadata blocks for a new
    xattr value's extent tree when the file already has an external xattr
    block. The not_found path leaves meta_add at zero, so meta_ac is NULL
    when ocfs2_xattr_extend_allocation() runs.
    
    A new value root has room for a single extent record. On a fragmented
    filesystem, the allocator cannot satisfy the xattr value in one
    contiguous run, so each non-contiguous run requires its own extent
    record. When the value root's extent list is full and meta_ac is NULL,
    ocfs2_add_clusters_in_btree() returns RESTART_META, and
    ocfs2_xattr_extend_allocation() hits BUG_ON(why == RESTART_META).
    
    [FIX]
    The case where no xattr block exists yet already calls
    ocfs2_extend_meta_needed(&def_xv.xv.xr_list) to reserve value tree
    metadata. Add the same reservation to the case where an xattr block
    already exists, making the two cases consistent.
    
    Replace the BUG_ON with a -ENOSPC return so that if RESTART_META is
    returned despite the reservation, the error propagates to userspace
    instead of panicking the kernel.
    
    Link: https://lore.kernel.org/amLwn3i9tET8yhG7@dev
    Fixes: a78f9f466894 ("ocfs2: make xattr extension work with new local alloc reservation.")
    Signed-off-by: Ian Bridges <[email protected]>
    Reported-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=e538032956b1157914a3
    Reviewed-by: Joseph Qi <[email protected]>
    Cc: Mark Fasheh <[email protected]>
    Cc: Joel Becker <[email protected]>
    Cc: Junxiao Bi <[email protected]>
    Cc: Changwei Ge <[email protected]>
    Cc: Jun Piao <[email protected]>
    Cc: Heming Zhao <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
PCI: host-generic: Fix NULL pointer dereference on 32-bit CAM systems [+ + +]
Author: Steffen Persvold <[email protected]>
Date:   Thu Jul 9 14:24:46 2026 +0200

    PCI: host-generic: Fix NULL pointer dereference on 32-bit CAM systems
    
    commit 008cb88edb41f3c7c8e0ed763ff9f26719830984 upstream.
    
    On 32-bit systems the config space is too large to ioremap in one go, so
    pci_ecam_create() maps each bus segment separately and relies on the
    ->add_bus callback (pci_ecam_add_bus) to populate the per-bus mapping in
    cfg->winp[]. pci_ecam_map_bus() then uses that mapping as the base for
    every config access.
    
    The generic ECAM ops (pci_generic_ecam_ops) already provide the ->add_bus
    and ->remove_bus callbacks, but the CAM (legacy) ops in pci-host-generic.c
    do not. As a result, on a 32-bit host using "pci-host-cam-generic" the
    per-bus mapping is never set up and the first config read dereferences a
    NULL base, crashing during bus enumeration:
    
     Unable to handle kernel NULL pointer dereference at virtual address 00000800
     Oops [#1]
     CPU: 0 PID: 1 Comm: swapper Not tainted 6.9.7+ #43
     Hardware name: Digilent Nexys-Video-A7 RV32 (DT)
     epc : pci_generic_config_read+0x40/0xb0
      ra : pci_generic_config_read+0x2c/0xb0
     [<c038db9c>] pci_generic_config_read+0x40/0xb0
     [<c038da04>] pci_bus_read_config_dword+0x50/0xb0
     [<c0391e94>] pci_bus_generic_read_dev_vendor_id+0x3c/0x1ec
     [<c039245c>] pci_scan_single_device+0xa4/0x11c
     [<c0392570>] pci_scan_slot+0x9c/0x23c
     [<c039388c>] pci_scan_child_bus_extend+0x58/0x2f4
     [<c0393db0>] pci_scan_root_bus_bridge+0x64/0xe8
     [<c0393e54>] pci_host_probe+0x20/0xc8
     [<c03bc6f4>] pci_host_common_probe+0x144/0x1e4
    
    Fix this by giving the CAM ops the same ->add_bus/->remove_bus callbacks.
    Since pci_ecam_add_bus() and pci_ecam_remove_bus() are static to ecam.c,
    move the CAM ops definition there as pci_generic_cam_ops (mirroring
    pci_generic_ecam_ops) and export it for pci-host-generic.c to reference.
    
    Fixes: 8fe55ef23387 ("PCI: Dynamically map ECAM regions")
    Signed-off-by: Steffen Persvold <[email protected]>
    [mani: removed timestamp from log]
    Signed-off-by: Manivannan Sadhasivam <[email protected]>
    Cc: [email protected]
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ptp: vmclock: prevent read-only mappings from becoming writable [+ + +]
Author: Abdifatah Suruur <[email protected]>
Date:   Thu Aug 13 20:47:07 2026 +0300

    ptp: vmclock: prevent read-only mappings from becoming writable
    
    commit a5edadbae57e2298a56cf7a4e774a027905a331f upstream.
    
    vmclock_miscdev_mmap() rejects writable mappings of the shared vmclock
    ABI page with -EROFS, but leaves VM_MAYWRITE set.  Userspace can map the
    page read-only and then upgrade it to writable with mprotect(), after
    which the guest can corrupt the host-written timekeeping data (sequence
    counter, UTC time, TSC offset) that the vmclock ABI defines as read-only.
    
    Clear VM_MAYWRITE on the read-only path so the mapping cannot be
    upgraded, as i915 does for its read-only objects and as fixed in drm/vc4
    (CVE-2026-68445) and drm/panthor (CVE-2024-53071).
    
    Cc: [email protected]
    Fixes: 205032724226 ("ptp: Add support for the AMZNC10C 'vmclock' device")
    Signed-off-by: Abdifatah Suruur <[email protected]>
    Link: https://patch.msgid.link/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
rndis_host: add overflow check in rndis_rx_fixup() [+ + +]
Author: Griffin Kroah-Hartman <[email protected]>
Date:   Thu Jul 9 14:24:01 2026 +0200

    rndis_host: add overflow check in rndis_rx_fixup()
    
    commit 965a251f23ff69cfb4486974d4532e9bb551c7fc upstream.
    
    Add an overflow check to ensure that data_offset + data_len + 8 does not
    wrap, which would enable an OOB read of the USB data buffer.
    
    Cc: Andrew Lunn <[email protected]>
    Cc: Shaoxu Liu <[email protected]>
    Signed-off-by: Griffin Kroah-Hartman <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://patch.msgid.link/2026070900-denim-brook-52d4@gregkh
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
xfs: add a xchk_ip_set_corrupt helper [+ + +]
Author: Christoph Hellwig <[email protected]>
Date:   Sun Aug 23 14:04:10 2026 -0400

    xfs: add a xchk_ip_set_corrupt helper
    
    [ Upstream commit aa7cfdb6e16b474328c79736f9b9dad09addc81c ]
    
    Add a smaller wrapper to set a inode corrupted by the xfs_inode
    pointer.
    
    Signed-off-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Carlos Maiolino <[email protected]>
    Reviewed-by: "Darrick J. Wong" <[email protected]>
    Signed-off-by: Carlos Maiolino <[email protected]>
    Stable-dep-of: 8ed78104722b ("xfs: rtsummary scrub should treat rtbitmap corruption errors as an xref error")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

xfs: don't livelock in scrub on a circular unlinked list [+ + +]
Author: Darrick J. Wong <[email protected]>
Date:   Sun Aug 23 14:03:51 2026 -0400

    xfs: don't livelock in scrub on a circular unlinked list
    
    [ Upstream commit 527eaaefddb6ec5c83a06c9a1559960dd6361753 ]
    
    LOLLM points out that online fsck can livelock if an unlinked inode list
    contains a loop.  Use a bitmap to detect cycles.
    
    Cc: [email protected] # v4.15
    Fixes: a12890aebb8959 ("xfs: scrub the AGI")
    Signed-off-by: Darrick J. Wong <[email protected]>
    Assisted-by: LOLLM # finding obvious bugs
    Reviewed-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Carlos Maiolino <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

xfs: hoist per-bucket unlinked list check to helper [+ + +]
Author: Darrick J. Wong <[email protected]>
Date:   Sun Aug 23 14:03:50 2026 -0400

    xfs: hoist per-bucket unlinked list check to helper
    
    [ Upstream commit 7cdafd8f10ebdf745ba6046b9fa67490c343a17f ]
    
    In the next patch we're going to make this loop more exciting, so hoist
    the code to a helper function to reduce clutter in the resulting code.
    
    Signed-off-by: Darrick J. Wong <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Carlos Maiolino <[email protected]>
    Stable-dep-of: 527eaaefddb6 ("xfs: don't livelock in scrub on a circular unlinked list")
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
xfs: restore nofs context unconditionally in xfs_trans_roll [+ + +]
Author: Yun Zhou <[email protected]>
Date:   Thu Jul 30 17:30:02 2026 +0800

    xfs: restore nofs context unconditionally in xfs_trans_roll
    
    commit 0241ea5fb0fe86d2a673163b2f5815111aadc7f7 upstream.
    
    When __xfs_trans_commit() fails in xfs_trans_roll(), the NOFS context
    is cleared but only restored in the success path.  This leaves the
    error path without nofs protection, causing a circular lock dependency
    between xfs_nondir_ilock_class and fs_reclaim:
    
           CPU0                    CPU1
           ----                    ----
      lock(&xfs_nondir_ilock_class);
                                   lock(fs_reclaim);
                                   lock(&xfs_nondir_ilock_class);
      lock(fs_reclaim);
    
    Fix this by moving xfs_trans_set_context() before the error check so
    that nofs context is always restored on the new transaction.
    
    Reported-by: [email protected]
    Closes: https://syzkaller.appspot.com/bug?extid=59178abfeb0ea3f0ab20
    Fixes: a1ca658d649a ("xfs: fix incorrect context handling in xfs_trans_roll")
    Cc: [email protected]
    Reviewed-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Yun Zhou <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Carlos Maiolino <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

xfs: rtsummary scrub should treat rtbitmap corruption errors as an xref error [+ + +]
Author: Darrick J. Wong <[email protected]>
Date:   Sun Aug 23 14:04:11 2026 -0400

    xfs: rtsummary scrub should treat rtbitmap corruption errors as an xref error
    
    [ Upstream commit 8ed78104722b57df69478b0b1608a408c1036085 ]
    
    LOLLM notes the discrepancy between the comment saying that this is an
    xref error and the code, which marks a (non-xref) corruption error.
    This appears to be a regression.
    
    Cc: [email protected] # v6.13
    Fixes: e3088ae2dcae3c ("xfs: move RT bitmap and summary information to the rtgroup")
    Signed-off-by: "Darrick J. Wong" <[email protected]>
    Assisted-by: LOLLM # finding obvious bugs
    Reviewed-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Carlos Maiolino <[email protected]>
    [ changed `xchk_ip_xref_set_corrupt(sc, rbmip)` to `xchk_ino_xref_set_corrupt(sc, rbmip->i_ino)` since the renamed helper is absent ]
    Signed-off-by: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

xfs: validate attr entry pointer before field access [+ + +]
Author: Hongling Zeng <[email protected]>
Date:   Tue Jul 28 15:43:40 2026 +0800

    xfs: validate attr entry pointer before field access
    
    commit b7eea80be25f3334f131d52982b3131aba77b97d upstream.
    
    xfs_attr3_leaf_verify_entry() accesses lentry/rentry fields (namelen,
    valuelen) before checking if the entry pointer itself is within bounds.
    If nameidx is crafted to point near the end of the buffer, these field
    accesses can read out-of-bounds before the bounds check at
    name_end > buf_end is performed.
    
    Add explicit bounds checks for entry pointers before accessing their
    fields. Use offsetof() to check that the start of the flexible array
    member (nameval/name) is within bounds, which ensures all preceding
    fields are safe to access.
    
    Fixes: c84760659dcf2 ("xfs: check attribute leaf block structure")
    Cc: <[email protected]> # v5.5
    Signed-off-by: Hongling Zeng <[email protected]>
    Reviewed-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Carlos Maiolino <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>