Linux/linux e2a9369drivers/accel/amdxdna aie2_ctx.c, drivers/accel/ethosu ethosu_gem.c

Merge tag 'drm-fixes-2026-07-25' of https://gitlab.freedesktop.org/drm/kernel

Pull drm fixes from Dave Airlie:
 "Weekly drm pull request, small and scattered seems to be the new
  normal, the ttm change is probably the largest, with xe being the
  most. Alex was out this week so amdgpu is smaller and only has some
  urgent fixes.

  MAINTAINERS:
   - update mailmap address

  ttm:
   - backup pages using correct order

  gpusvm:
   - fix mm leak on eviction
   - properly zero page array in mm scanning

  tests:

    [69 lines not shown]
DeltaFile
+82-41drivers/gpu/drm/ttm/ttm_backup.c
+74-15drivers/gpu/drm/ttm/ttm_pool.c
+36-18drivers/accel/ethosu/ethosu_gem.c
+30-23drivers/gpu/drm/tiny/appletbdrm.c
+18-8drivers/accel/amdxdna/aie2_ctx.c
+17-5drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+257-11027 files not shown
+418-17333 files

Linux/linux dad0a87fs/ceph caps.c mds_client.c, net/ceph osdmap.c auth_x.c

Merge tag 'ceph-for-7.2-rc5' of https://github.com/ceph/ceph-client

Pull ceph fixes from Ilya Dryomov:
 "A bunch of assorted fixes with the majority being hardening against
  malformed input and invalid data scenarios that don't happen in real
  deployments but can be utilized to trigger use-after-free and similar
  issues, some error path leak fixups and two patches from Max to avoid
  a potential hang in __ceph_get_caps() and unintended nesting of
  current->journal_info while handling replies from the MDS.

  All marked for stable"

* tag 'ceph-for-7.2-rc5' of https://github.com/ceph/ceph-client:
  ceph: avoid fs reclaim while using current->journal_info
  ceph: add owner/capability checks for CEPH_IOC_SET_LAYOUT*
  ceph: fix hanging __ceph_get_caps() with stale mds_wanted
  rbd: Reset positive result codes to zero in object map update path
  libceph: bound pg_{temp,upmap,upmap_items} length to CEPH_PG_MAX_SIZE
  libceph: refresh auth->authorizer_buf{,_len} after authorizer update

    [10 lines not shown]
DeltaFile
+16-2fs/ceph/caps.c
+12-4net/ceph/osdmap.c
+11-0fs/ceph/mds_client.c
+8-1net/ceph/auth_x.c
+5-4fs/ceph/file.c
+9-0fs/ceph/addr.c
+61-117 files not shown
+90-1913 files

Linux/linux 981f4a2fs/crypto inline_crypt.c keysetup_v1.c, fs/f2fs super.c

Merge tag 'fscrypt-for-linus' of git://git.kernel.org/pub/scm/fs/fscrypt/linux

Pull fscrypt fixes from Eric Biggers:
 "A couple fixes for AI-detected bugs"

* tag 'fscrypt-for-linus' of git://git.kernel.org/pub/scm/fs/fscrypt/linux:
  fscrypt: Avoid dynamic allocation in fscrypt_get_devices()
  fscrypt: Add missing superblock check in find_or_insert_direct_key()
DeltaFile
+20-37fs/crypto/inline_crypt.c
+14-11fs/f2fs/super.c
+10-8include/linux/fscrypt.h
+7-1fs/crypto/keysetup_v1.c
+51-574 files

Linux/linux 6c33542drivers/gpu/drm/amd/display/amdgpu_dm amdgpu_dm_crtc.c amdgpu_dm.c

Merge tag 'amd-drm-fixes-v7.2-2026-07-24' of git://git.kernel.org/pub/scm/linux/kernel/git/superm1/linux into drm-fixes

amd-drm-fixes-v7.2-2026-07-04:

- Fix a backport mistake for dm_gpureset_toggle_interrupts()
- Fix a failure on flip-done timeouts for mode1 reset

Signed-off-by: Dave Airlie <airlied at redhat.com>

From: Mario Limonciello <superm1 at kernel.org>
Link: https://patch.msgid.link/5d5964a3-fb85-4a3c-9252-a43c93fe935d@kernel.org
DeltaFile
+11-2drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c
+2-1drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+13-32 files

Linux/linux 0c452fbarch/arm64/include/asm kprobes.h fixmap.h, arch/arm64/kernel/probes kprobes.c

Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux

Pull arm64 fixes from Will Deacon:
 "It's a bit all over the place, as I was hoping to fix a decade-old bug
  in our seccomp handling on syscall entry and ended up collecting other
  fixes in the meantime. You'll see the failed attempt (+revert) here
  but I didn't want to hold off on the others any longer. Hopefully
  we'll get that one squashed next week...

   - Fix early_ioremap() of unaligned ACPI tables

   - Remove bogus information from data abort diagnostics

   - Fix kprobes recursion during single-step

   - Fix incorrect constant in ESR address size fault macro

   - Fix OOB page-table walk in memory hot-unplug notifier


    [20 lines not shown]
DeltaFile
+44-1arch/arm64/kernel/probes/kprobes.c
+22-14drivers/resctrl/mpam_devices.c
+4-3arch/arm64/mm/fault.c
+6-0arch/arm64/include/asm/kprobes.h
+5-1arch/arm64/include/asm/fixmap.h
+1-1drivers/virt/coco/pkvm-guest/arm-pkvm-guest.c
+82-203 files not shown
+85-239 files

Linux/linux a93212bdrivers/iommu/amd nested.c iommu.c, drivers/iommu/intel perf.c svm.c

Merge tag 'iommu-fixes-v7.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux

Pull iommu fixes from Will Deacon:
 "Joerg's away at the moment so I've been looking after the IOMMU tree
  in his absence. In the process of doing that, I've hoovered up a
  handful of fixes for the AMD and Intel drivers which address a
  combination of the usual out-of-bounds/locking/leak bugs as well as
  some logical issues around SVA and command completion.

  AMD:

   - Fix lockdep splat from nested domain allocation

   - Fix nested domain leak

   - Fix broken synchronisation of command completion

   - Fix OOB write in "ivrs_acpihid" command-line parsing


    [13 lines not shown]
DeltaFile
+19-15drivers/iommu/amd/nested.c
+16-6drivers/iommu/amd/iommu.c
+6-0drivers/iommu/amd/init.c
+1-1drivers/iommu/intel/perf.c
+1-1drivers/iommu/intel/svm.c
+43-235 files

Linux/linux fbbaca9drivers/gpu/drm/amd/display/amdgpu_dm amdgpu_dm.c

drm/amd/display: Fix missing DCE check in dm_gpureset_toggle_interrupts()

This line was lost when cping from amd-staging-drm-next to drm-fixes.
So add it back.

Cc: stable at vger.kernel.org
Fixes: 8382cd234981 ("drm/amd/display: consolidate DCN vblank/flip handling onto vupdate_no_lock")
Reported-by: Lu Yao <yaolu at kylinos.cn>
Signed-off-by: Leo Li <sunpeng.li at amd.com>
Reviewed-by: Mario Limonciello (AMD) <superm1 at kernel.org>
Link: https://patch.msgid.link/20260723134450.13838-1-sunpeng.li@amd.com
Signed-off-by: Mario Limonciello <mario.limonciello at amd.com>
DeltaFile
+2-1drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+2-11 files

Linux/linux 86ba24cinclude/linux slab.h alloc_tag.h, lib alloc_tag.c

Merge tag 'slab-for-7.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab

Pull slab fixes from Vlastimil Babka:

 - Prevent unbounded recursion in free path with memory allocation
   profiling, which has caused a stack overflow on a Meta production
   host due to a 125-deep __free_slab<->kfree recursion (Harry Yoo)

 - Fix type-based partitioning confusing sparse which does not know
   __builtin_infer_alloc_token() (Marco Elver)

 - Fix a potential memory leak in bulk freeing path on NUMA machines
   (Shengming Hu)

* tag 'slab-for-7.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab:
  slab: silence sparse warning with type-based partitioning
  mm/slab: prevent unbounded recursion in free path with new kmalloc type
  lib/alloc_tag: introduce mem_alloc_profiling_permanently_disabled()
  mm/slab: decouple SLAB_NO_SHEAVES from SLAB_NO_OBJ_EXT

    [2 lines not shown]
DeltaFile
+50-71mm/slub.c
+29-3mm/slab.h
+22-3include/linux/slab.h
+18-1mm/slab_common.c
+9-0lib/alloc_tag.c
+3-0include/linux/alloc_tag.h
+131-786 files

Linux/linux 82730dbdrivers/gpu/drm/amd/display/amdgpu_dm amdgpu_dm_crtc.c

drm/amd/display: Fix flip-done timeouts on mode1 reset

The vblank on/off callbacks mixed use of amdgpu_irq_get/put() and
amdgpu_dm_crtc_set_vupdate_irq() to enable and disable IRQs.

With get/put, base driver will callback into DC to disable IRQs when
refcount == 0. With set_vupdate_irq(), DC is called directly to disable
IRQs, bypassing base driver's refcount tracking.

During gpu reset, base driver can restore IRQs via
amdgpu_irq_gpu_reset_resume_helper() > amdgpu_irq_update(). So if
get/put() is not used (i.e. refcount == 0), then vupdate_irq will be
disabled.

This is problematic if DRM requests vblank on before amdgpu_irq_update()
is called: drm_vblank_on() > set_vupdate_irq() enables vupdate_irq, but
the refcount is still 0. gpu_reset_resume_helper() > irq_update() then
immediately disables it, thus leading to flip done timeouts.


    [16 lines not shown]
DeltaFile
+11-2drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c
+11-21 files

Linux/linux e24b02ddrivers/accel/amdxdna aie2_ctx.c, drivers/accel/ethosu ethosu_gem.c

Merge tag 'drm-misc-fixes-2026-07-24' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-fixes

drm-misc-fixes for v7.2-rc5:
- Improve damage handling in appletbdrm.
- Fix harmful fragmenting of MM by backing up TTM pages at native
  page order.
- Fix timeout handling in amdxdna.
- Fix imagination locking for map/unmap operations.
- Fix mm leak in gpusvm eviction.
- Properly zero page array in gpusvm mm scanning.
- Prevent trusted shader bo's from being mapped again in vc4.
- Validate shader array size in vmwgfx.
- Fix length calculation bugs in ethosu.
- Better error handling during pagemap migration.
- Improve v3d suspend.
- Kconfig updates for some panels.
- Handle missing iovcc in ili9881c panel.
- Fix vc4 unbind.
- Add i2c error handling in gma500.

    [7 lines not shown]
DeltaFile
+82-41drivers/gpu/drm/ttm/ttm_backup.c
+74-15drivers/gpu/drm/ttm/ttm_pool.c
+36-18drivers/accel/ethosu/ethosu_gem.c
+30-23drivers/gpu/drm/tiny/appletbdrm.c
+18-8drivers/accel/amdxdna/aie2_ctx.c
+17-5drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+257-11018 files not shown
+355-14824 files

Linux/linux 1ff399cdrivers/gpu/drm drm_pagemap.c

Revert "drm/pagemap: Guard HPAGE_PMD_ORDER use with CONFIG_ARCH_ENABLE_THP_MIGRATION"

This reverts commit 04b177544a040cbafab760d6b766381c6b22e0a8.

The original author requested it to be reverted, as it conflicts with
changes in the -next branch for MM:

"I'm not sure who is doing the drm-misc-fixes PR, but if you are can
you omit this patch: https://patchwork.freedesktop.org/series/170865/

I guess this conflicts with MM changes in their next tree and it easy
enough on our side to do this slightly differently to avoid a conflict
so going to post revert + a different change. If this is already sent nbd."

Signed-off-by: Maarten Lankhorst <dev at lankhorst.se>
DeltaFile
+3-10drivers/gpu/drm/drm_pagemap.c
+3-101 files

Linux/linux 6273dd3drivers/gpu/drm/vc4 vc4_bo.c

drm/vc4: Shut down BO cache timer before teardown

The BO cache timer callback schedules time_work, and time_work can rearm
the timer through vc4_bo_cache_free_old().

vc4_bo_cache_destroy() deletes the timer and then cancels the work, which
does not break that cycle: the work being cancelled can rearm the timer,
and the timer then queues work again after teardown.

Use timer_shutdown_sync() instead, so the timer cannot be rearmed and the
cycle ends with cancel_work_sync().

Fixes: c826a6e10644 ("drm/vc4: Add a BO cache.")
Cc: stable at vger.kernel.org
Signed-off-by: Linmao Li <lilinmao at kylinos.cn>
Link: https://patch.msgid.link/20260720084426.1632508-1-lilinmao@kylinos.cn
Reviewed-by: Maíra Canal <mcanal at igalia.com>
Signed-off-by: Maíra Canal <mcanal at igalia.com>
DeltaFile
+1-1drivers/gpu/drm/vc4/vc4_bo.c
+1-11 files

Linux/linux 2027793drivers/gpu/drm/xe xe_vm_madvise.c xe_migrate.c

Merge tag 'drm-xe-fixes-2026-07-23' of https://gitlab.freedesktop.org/drm/xe/kernel into drm-fixes

Driver Changes:
- Skip invalidation for purgeable state updates (Arvind)
- Add drm_dev guards when detaching CCS read / write buffers (Satyanarayana)
- Alloc per domain unique i2c id (Raag)
- Fix SVM leak on resv obj alloc failure in xe_vm_create (Shuicheng)

Signed-off-by: Dave Airlie <airlied at redhat.com>

From: Thomas Hellstrom <thomas.hellstrom at linux.intel.com>
Link: https://patch.msgid.link/amJ5-WUA_OS_RBAp@fedora
DeltaFile
+17-2drivers/gpu/drm/xe/xe_vm_madvise.c
+10-6drivers/gpu/drm/xe/xe_migrate.c
+12-2drivers/gpu/drm/xe/xe_sriov_vf_ccs.c
+4-4drivers/gpu/drm/xe/xe_vm.c
+4-1drivers/gpu/drm/xe/xe_i2c.c
+2-1drivers/gpu/drm/xe/xe_migrate.h
+49-166 files

Linux/linux 394586adrivers/gpu/drm/i915/display intel_dp_aux_backlight.c

Merge tag 'drm-intel-fixes-2026-07-23' of https://gitlab.freedesktop.org/drm/i915/kernel into drm-fixes

- Remove DP_EDP_BACKLIGHT_AUX_ENABLE_CAP check for DPCD backlight (Suraj)

Signed-off-by: Dave Airlie <airlied at redhat.com>

From: Rodrigo Vivi <rodrigo.vivi at intel.com>
Link: https://patch.msgid.link/amJDXaBKC9uUgRFt@intel.com
DeltaFile
+1-6drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
+1-61 files

Linux/linux 48a5a7afs/smb/client misc.c file.c

Merge tag 'v7.2-rc4-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6

Pull smb client fixes from Steve French:
 - Fix leak in cifs_close_deferred_file()
 - Fix resolving MacOS symlinks
 - Fix stale file size in readdir
 - Update git branches in MAINTAINERS file
 - Fix bounds check in cifs_filldir
 - Fix checks in parse_dfs_referrals()
 - Fix DFS referral checks for malformed packet

* tag 'v7.2-rc4-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6:
  cifs: fix cifsFileInfo leak on kmalloc failure in deferred close drain paths
  cifs: prevent readdir from changing file size due to stale directory metadata
  smb: client: handle STATUS_STOPPED_ON_SYMLINK responses without a symlink target
  Add missing git branch info for cifs and ksmbd to MAINTAINERS file
  smb: client: bound dirent name against end of SMB response in cifs_filldir
  smb: client: validate DFS referral PathConsumed
DeltaFile
+88-18fs/smb/client/misc.c
+64-5fs/smb/client/file.c
+20-3fs/smb/client/smb2inode.c
+21-0fs/smb/client/smb2file.c
+7-2fs/smb/client/readdir.c
+6-0fs/smb/client/inode.c
+206-283 files not shown
+210-309 files

Linux/linux d326f83drivers/net amt.c, drivers/net/ethernet/airoha airoha_eth.c

Merge tag 'net-7.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Pull networking fixes from Jakub Kicinski:
 "Lots of fixes, double the count even for the 'new normal'. Largely due
  to my time off followed by a networking conference which distracted
  most maintainers (less so the AI generators).

  Including fixes from Bluetooth and WiFi.

  Current release - regressions:

   - wifi: mt76: fix MAC address for non OF pcie cards

  Current release - new code bugs:

   - mptcp: fix BUILD_BUG_ON on legacy ARM config

   - wifi: cfg80211: guard optional PMSR nominal time


    [61 lines not shown]
DeltaFile
+197-0drivers/net/ethernet/realtek/rtase/rtase_main.c
+106-68drivers/net/ethernet/airoha/airoha_eth.c
+164-1net/vmw_vsock/virtio_transport_common.c
+113-0tools/testing/selftests/bpf/prog_tests/tc_qevent.c
+74-27drivers/net/amt.c
+41-55drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+695-151258 files not shown
+2,774-887264 files

Linux/linux 5b60234fs/ceph mds_client.c

ceph: avoid fs reclaim while using current->journal_info

handle_reply() stores a `ceph_mds_request` pointer in
`current->journal_info` while filling the inode and dentry cache from
an MDS reply.

An allocation in this section can enter direct reclaim and prune
dentries from another filesystem.  If this dirties an ext4 inode, ext4
starts a JBD2 transaction.  JBD2 interprets the Ceph request in
`current->journal_info` as a journal handle and dereferences the
request's `r_tid` as `h_transaction`, causing a kernel crash, e.g.:

 Unable to handle kernel paging request at virtual address 00000000077b4818
 [...]
 Internal error: Oops: 0000000096000004 [#1]  SMP
 Modules linked in:
 CPU: 6 UID: 0 PID: 2699135 Comm: kworker/6:3 Tainted: G        W           6.18.38-i3 #1113 NONE
 [...]
 Workqueue: ceph-msgr ceph_con_workfn

    [40 lines not shown]
DeltaFile
+11-0fs/ceph/mds_client.c
+11-01 files

Linux/linux 50958bbfs/ceph caps.c file.c

ceph: fix hanging __ceph_get_caps() with stale mds_wanted

A reader can hang forever in __ceph_get_caps() when the client no
longer holds `FILE_RD`, but local cap state still says that the
capability is already wanted (via `mds_wanted`).

One way to trigger this is through MDS cap revocation.  If another
client performs a conflicting operation, the MDS can revoke `FILE_RD`
from the reader; the next read then has to reacquire `FILE_RD`.  If
the cap update that should request `FILE_RD` never reaches the MDS
after `cap->mds_wanted` was raised, the reader is left holding only
non-file caps while local `mds_wanted` still includes the file read
caps.

In that state, try_get_cap_refs() sees `need <= mds_wanted` and
returns 0, so __ceph_get_caps() just waits on `i_cap_wq`.  If the cap
update that was supposed to request `FILE_RD never reaches the MDS
after `cap->mds_wanted was` raised, no further request is sent and the
waiter can sleep indefinitely until unrelated cap traffic happens to

    [52 lines not shown]
DeltaFile
+15-2fs/ceph/caps.c
+5-4fs/ceph/file.c
+1-0fs/ceph/mds_client.h
+21-63 files

Linux/linux a6c4250drivers/block rbd.c

rbd: Reset positive result codes to zero in object map update path

In a reply message to an RBD request, a positive result code indicates
a data payload, which is not allowed for writes. While
rbd_osd_req_callback() already resets a positive result code for writes
to zero, rbd_object_map_callback() does not. This allows a corrupted
reply to an object map update to trigger the rbd_assert(*result < 0) in
__rbd_obj_handle_request(). This happens, because
rbd_object_map_callback() calls rbd_obj_handle_request() ->
__rbd_obj_handle_request() and passes this positive result code. From
__rbd_obj_handle_request(), rbd_obj_advance_write() is called, which
leaves the positive result code unchanged and returns true. Therefore,
the if(done && *result) branch is executed in __rbd_obj_handle_request()
and the assertion triggers.

This patch fixes the issue by adjusting the logic in the
rbd_object_map_callback() path. A positive result code for an object map
update is now reset to zero (similar to rbd_osd_req_callback()), and the
message is subsequently handled the same way as if the result code was

    [8 lines not shown]
DeltaFile
+6-1drivers/block/rbd.c
+6-11 files

Linux/linux 9f00f9cnet/ceph osdmap.c

libceph: bound pg_{temp,upmap,upmap_items} length to CEPH_PG_MAX_SIZE

__decode_pg_temp() decodes an user-controlled length but only rejects
values large enough to overflow the allocation; it does not bound it to
CEPH_PG_MAX_SIZE. The helper backs both pg_temp and pg_upmap decoding, and
apply_upmap()/get_temp_osds() later copy the decoded list into the fixed-size
on-stack array struct ceph_osds.osds[CEPH_PG_MAX_SIZE]. A monitor that sends
an OSDMap with a pg_temp/pg_upmap entry longer than 32 thus causes a stack
out-of-bounds write.

An OSD set for a single PG can never exceed CEPH_PG_MAX_SIZE, so reject longer
entries at decode time. The bound is well below the old overflow threshold, so
it also covers the allocation-size overflow the previous check guarded against.

  BUG: KASAN: stack-out-of-bounds in ceph_pg_to_up_acting_osds
  Write of size 4 ... by task exploit
   kasan_report (mm/kasan/report.c:595)
   ceph_pg_to_up_acting_osds (net/ceph/osdmap.c:2617 net/ceph/osdmap.c:2833)
   calc_target (net/ceph/osd_client.c:1638)

    [17 lines not shown]
DeltaFile
+2-2net/ceph/osdmap.c
+2-21 files

Linux/linux cee38bbfs/ceph ioctl.c

ceph: add owner/capability checks for CEPH_IOC_SET_LAYOUT*

These permission checks were already missing in the initial
impementation of these ioctls.  This Ceph allows any user who owns a
file descriptor to manipulate the layout of any file, even if they
don't have write permissions.

It might be a good idea to guard other ioctls with permission checks
as well or even disallow regular users (even if they own the file) to
manipulate layout settings completely, as this may be abused to DoS
the Ceph servers, but right now, I find it most urgent to have setter
checks at all.

Cc: stable at vger.kernel.org
Fixes: 8f4e91dee2a2 ("ceph: ioctls")
Signed-off-by: Max Kellermann <max.kellermann at ionos.com>
Reviewed-by: Xiubo Li <xiubo.li at clyso.com>
Signed-off-by: Ilya Dryomov <idryomov at gmail.com>
DeltaFile
+6-0fs/ceph/ioctl.c
+6-01 files

Linux/linux 937d61fnet/ceph auth_x.c

libceph: refresh auth->authorizer_buf{,_len} after authorizer update

ceph_x_create_authorizer() caches au->buf->vec.iov_base and
au->buf->vec.iov_len in struct ceph_auth_handshake.  These
cached values are then used by the messenger connect code when
sending the authorizer.

ceph_x_update_authorizer() can rebuild the authorizer when a newer
service ticket is available.  If the rebuilt authorizer no longer
fits in the existing buffer, ceph_x_build_authorizer() drops its
reference to au->buf and allocates a new one.  If this is the final
reference, ceph_buffer_put() frees the old ceph_buffer and its
vec.iov_base, but auth->authorizer_buf still points at that freed
memory.

A subsequent msgr1 reconnect can therefore queue the stale pointer
and trigger a KASAN slab-use-after-free in _copy_from_iter() while
tcp_sendmsg() copies the authorizer.


    [10 lines not shown]
DeltaFile
+8-1net/ceph/auth_x.c
+8-11 files

Linux/linux c3e6407fs/ceph dir.c

ceph: fix refcount leak in ceph_readdir()

The ceph_readdir() function allocates a ceph_mds_request via
ceph_mdsc_create_request() and stores it in dfi->last_readdir. In
the directory entry processing loop, if the entry's offset is less
than ctx->pos or if the inode pointer is unexpectedly NULL, the
function returns -EIO without releasing the reference held by
dfi->last_readdir, causing a refcount leak.

Fix this by adding ceph_mdsc_put_request(dfi->last_readdir) before
returning on these error paths. Also set dfi->last_readdir to NULL
for safety, matching the cleanup done at the normal exit.

Cc: stable at vger.kernel.org
Fixes: af9ffa6df7e3 ("ceph: add support to readdir for encrypted names")
Signed-off-by: WenTao Liang <vulab at iscas.ac.cn>
Reviewed-by: Viacheslav Dubeyko <slava at dubeyko.com>
Reviewed-by: Alex Markuze <amarkuze at redhat.com>
Signed-off-by: Ilya Dryomov <idryomov at gmail.com>
DeltaFile
+6-1fs/ceph/dir.c
+6-11 files

Linux/linux e4c8047net/ceph ceph_common.c

libceph: remove debugfs files before client teardown

ceph_destroy_client() tears down the monitor client before removing
the per-client debugfs files. A concurrent read of the monmap debugfs
file can enter monmap_show() after ceph_monc_stop() has freed
monc->monmap, triggering a use-after-free.

Remove the debugfs files before stopping the OSD and monitor clients.
debugfs_remove() drains active handlers and prevents new accesses, so
the debugfs callbacks can no longer race the rest of client teardown.

Cc: stable at vger.kernel.org
Fixes: 76aa844d5b2f ("ceph: debugfs")
Reported-by: Yuan Tan <yuantan098 at gmail.com>
Reported-by: Zhengchuan Liang <zcliangcn at gmail.com>
Reported-by: Xin Liu <bird at lzu.edu.cn>
Assisted-by: Codex:GPT-5.4
Signed-off-by: Douya Le <ldy3087146292 at gmail.com>
Signed-off-by: Ren Wei <n05ec at lzu.edu.cn>

    [2 lines not shown]
DeltaFile
+2-2net/ceph/ceph_common.c
+2-21 files

Linux/linux 4dbc71bfs/ceph caps.c

ceph: fix pre-auth out-of-bounds read on snaptrace in ceph_handle_caps()

ceph_handle_caps() reads snap_trace_len from the wire-format
ceph_mds_caps header and uses it unconditionally to build a fake
end pointer (snaptrace + snaptrace_len) that is later handed to
ceph_update_snap_trace() in the CEPH_CAP_OP_IMPORT case:

    snaptrace     = h + 1;
    snaptrace_len = le32_to_cpu(h->snap_trace_len);
    p             = snaptrace + snaptrace_len;
    ...
    case CEPH_CAP_OP_IMPORT:
        if (snaptrace_len) {
            ...
            if (ceph_update_snap_trace(mdsc, snaptrace,
                                       snaptrace + snaptrace_len,
                                       false, &realm)) { ... }

ceph_update_snap_trace() then decodes a struct ceph_mds_snap_realm

    [31 lines not shown]
DeltaFile
+1-0fs/ceph/caps.c
+1-01 files

Linux/linux cbf5961fs/ceph addr.c

ceph: fix writeback_count leak in write_folio_nounlock()

write_folio_nounlock() increments fsc->writeback_count to track
in-flight writeback operations. On several error paths where the
function returns early (folio lookup failure, snapshot context
allocation failure, and writepages submission failure), the function
returns without calling atomic_long_dec_return() to decrement the
counter.

Each leaked increment keeps the counter above zero, which can prevent
the filesystem from cleanly unmounting or suspending writes.

Add atomic_long_dec_return() calls on all error paths that currently
return without decrementing the counter.

Cc: stable at vger.kernel.org
Fixes: d55207717ded ("ceph: add encryption support to writepage and writepages")
Signed-off-by: Wentao Liang <vulab at iscas.ac.cn>
Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko at ibm.com>
Signed-off-by: Ilya Dryomov <idryomov at gmail.com>
DeltaFile
+9-0fs/ceph/addr.c
+9-01 files

Linux/linux a109a55net/ceph cls_lock_client.c

libceph: fix two unsafe bare decodes in decode_lockers()

decode_lockers() in cls_lock_client.c contains two bare decode operations
that allow a malicious or compromised OSD to trigger slab-out-of-bounds
reads:

1. ceph_decode_32(p) at the num_lockers field has no preceding bounds
   check. ceph_start_decoding() accepts struct_len=0 as valid -- the
   internal ceph_decode_need(p, end, 0, bad) always passes -- so when an
   OSD sends struct_len=0, ceph_start_decoding() returns success with
   p == end. The immediately following bare ceph_decode_32(p) then reads
   4 bytes past the validated buffer boundary. The garbage value is
   passed directly to kzalloc_objs() as the locker count.

   The sibling function decode_watchers() in osd_client.c already uses
   ceph_decode_32_safe() after its own ceph_start_decoding() call.
   decode_lockers() was the only site using the bare variant.

2. ceph_decode_8(p) after the decode_locker() loop has no preceding

    [42 lines not shown]
DeltaFile
+6-2net/ceph/cls_lock_client.c
+6-21 files

Linux/linux bbeae12net/ceph osdmap.c

libceph: guard missing CRUSH type name lookup

Localized read selection can walk a parent bucket whose name exists in
the CRUSH map while its type has no matching entry in type_names.
get_immediate_parent() then dereferences a NULL type_cn and passes an
invalid pointer into strcmp(), causing a null-ptr-deref.

Skip such malformed parent buckets unless both the bucket name and type
name metadata are present. This keeps malformed hierarchy data from
crashing locality lookup and safely falls back to "not local".

[ idryomov: add WARN_ON_ONCE ]

Cc: stable at vger.kernel.org
Fixes: 117d96a04f00 ("libceph: support for balanced and localized reads")
Reported-by: Yuan Tan <yuantan098 at gmail.com>
Reported-by: Zhengchuan Liang <zcliangcn at gmail.com>
Reported-by: Xin Liu <bird at lzu.edu.cn>
Assisted-by: Codex:GPT-5.4

    [4 lines not shown]
DeltaFile
+4-1net/ceph/osdmap.c
+4-11 files

Linux/linux d3c3293net/ceph mon_client.c

libceph: bound get_version reply decode to front len

handle_get_version_reply() uses msg->front_alloc_len as the decode
boundary for MON_GET_VERSION_REPLY.  That is the size of the reused
reply buffer, not the number of bytes actually received.

A truncated reply can therefore pass ceph_decode_need() and decode the
second u64 from stale tail bytes left in the buffer by an earlier
message, causing an uninitialized memory read.

Use msg->front.iov_len as the receive-side decode boundary, matching
other libceph reply handlers and limiting decoding to the bytes that
were actually read from the wire.

Cc: stable at vger.kernel.org
Fixes: 513a8243d67f ("libceph: mon_get_version request infrastructure")
Reported-by: Yuan Tan <yuantan098 at gmail.com>
Reported-by: Zhengchuan Liang <zcliangcn at gmail.com>
Reported-by: Xin Liu <bird at lzu.edu.cn>

    [5 lines not shown]
DeltaFile
+1-1net/ceph/mon_client.c
+1-11 files

Linux/linux 40480eenet/ceph mon_client.c

libceph: Reject monmaps advertising zero monitors

A message of type CEPH_MSG_MON_MAP contains a monmap that is sent from a
monitor to the client. This monmap contains information about the
existing monitors in the cluster. Currently, a monmap indicating that
there are zero monitors in the cluster is treated as valid. However, it
is impossible to have zero monitors in the cluster and still receive a
valid monmap from a monitor. Therefore, such a monmap must be corrupted
and should be treated as invalid. Furthermore, a monmap with a monitor
count of zero can subsequently crash the client when attempting to open
a session with a monitor in __open_session(). This happens because the
"BUG_ON(monc->monmap->num_mon < 1)" assertion in pick_new_mon() is
triggered.

This patch extends a check in ceph_monmap_decode() to also reject
arriving mon_maps with num_mon == 0 rather than only with
num_mon > CEPH_MAX_MON.

[ idryomov: drop "log output for unusual values of num_mon" part ]

    [5 lines not shown]
DeltaFile
+1-1net/ceph/mon_client.c
+1-11 files