linux-stable/fs/ceph
Xiubo Li 448875a73e ceph: fix potential use-after-free bug when trimming caps
commit aaf67de788 upstream.

When trimming the caps and just after the 'session->s_cap_lock' is
released in ceph_iterate_session_caps() the cap maybe removed by
another thread, and when using the stale cap memory in the callbacks
it will trigger use-after-free crash.

We need to check the existence of the cap just after the 'ci->i_ceph_lock'
being acquired. And do nothing if it's already removed.

Cc: stable@vger.kernel.org
Link: https://tracker.ceph.com/issues/43272
Signed-off-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Luís Henriques <lhenriques@suse.de>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-05-11 23:10:55 +09:00
..
Kconfig ceph: conversion to new fscache API 2022-01-11 22:13:01 +00:00
Makefile
acl.c fs: pass dentry to set acl method 2022-10-19 12:55:42 +02:00
addr.c ceph: blocklist the kclient when receiving corrupted snap trace 2023-02-02 13:58:15 +01:00
cache.c netfs: Fix gcc-12 warning by embedding vfs inode in netfs_i_context 2022-06-09 13:55:00 -07:00
cache.h netfs: Further cleanups after struct netfs_inode wrapper introduced 2022-06-10 20:55:21 +01:00
caps.c ceph: fix potential use-after-free bug when trimming caps 2023-05-11 23:10:55 +09:00
ceph_frag.c
debugfs.c ceph: fix potential use-after-free bug when trimming caps 2023-05-11 23:10:55 +09:00
dir.c fs: rename current get acl method 2022-10-20 10:13:27 +02:00
export.c ceph: fail the open_by_handle_at() if the dentry is being unlinked 2022-10-04 19:18:08 +02:00
file.c ceph: update the time stamps and try to drop the suid/sgid 2023-03-10 09:29:47 +01:00
inode.c A fix to facilitate prompt cap releases on async creates from Xiubo. 2022-12-14 10:35:47 -08:00
io.c ceph: fix kerneldoc copypasta over ceph_start_io_direct 2021-04-27 23:52:23 +02:00
io.h
ioctl.c ceph: remove useless session parameter for check_caps() 2022-12-12 19:15:39 +01:00
ioctl.h
locks.c ceph: avoid use-after-free in ceph_fl_release_lock() 2023-01-02 12:27:25 +01:00
mds_client.c ceph: fix potential use-after-free bug when trimming caps 2023-05-11 23:10:55 +09:00
mds_client.h ceph: fix potential use-after-free bug when trimming caps 2023-05-11 23:10:55 +09:00
mdsmap.c treewide: use get_random_u32_below() instead of deprecated function 2022-11-18 02:15:15 +01:00
metric.c ceph: include average/stdev r/w/m latency in mds metrics 2022-03-21 13:35:16 +01:00
metric.h ceph: include average/stdev r/w/m latency in mds metrics 2022-03-21 13:35:16 +01:00
quota.c ceph: fix statfs for subdir mounts 2022-05-25 20:45:14 +02:00
snap.c ceph: blocklist the kclient when receiving corrupted snap trace 2023-02-02 13:58:15 +01:00
strings.c ceph: add getvxattr op 2022-03-01 18:26:37 +01:00
super.c ceph: make f_bsize always equal to f_frsize 2022-08-03 00:54:13 +02:00
super.h ceph: fix potential use-after-free bug when trimming caps 2023-05-11 23:10:55 +09:00
util.c
xattr.c ceph: prevent a client from exceeding the MDS maximum xattr size 2022-08-03 00:54:12 +02:00