android_kernel_xiaomi_sm8450/fs/ceph
Rishabh Dave 8180d0c27b ceph: prevent use-after-free in encode_cap_msg()
commit cda4672da1c26835dcbd7aec2bfed954eda9b5ef upstream.

In fs/ceph/caps.c, in encode_cap_msg(), "use after free" error was
caught by KASAN at this line - 'ceph_buffer_get(arg->xattr_buf);'. This
implies before the refcount could be increment here, it was freed.

In same file, in "handle_cap_grant()" refcount is decremented by this
line - 'ceph_buffer_put(ci->i_xattrs.blob);'. It appears that a race
occurred and resource was freed by the latter line before the former
line could increment it.

encode_cap_msg() is called by __send_cap() and __send_cap() is called by
ceph_check_caps() after calling __prep_cap(). __prep_cap() is where
arg->xattr_buf is assigned to ci->i_xattrs.blob. This is the spot where
the refcount must be increased to prevent "use after free" error.

Cc: stable@vger.kernel.org
Link: https://tracker.ceph.com/issues/59259
Signed-off-by: Rishabh Dave <ridave@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Xiubo Li <xiubli@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-23 08:42:29 +01:00
..
acl.c ceph: add caps perf metric for each superblock 2020-06-01 13:22:51 +02:00
addr.c ceph: remove bogus checks and WARN_ONs from ceph_set_page_dirty 2021-07-20 16:05:48 +02:00
cache.c ceph: replace zero-length array with flexible-array member 2020-03-30 12:42:40 +02:00
cache.h libceph, rbd, ceph: convert to use the new mount API 2019-11-27 22:28:37 +01:00
caps.c ceph: prevent use-after-free in encode_cap_msg() 2024-02-23 08:42:29 +01:00
ceph_frag.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
debugfs.c ceph: metrics for opened files, pinned caps and opened inodes 2020-10-12 15:29:26 +02:00
dir.c ceph: fix memory leak in ceph_readdir when note_last_dentry returns error 2022-04-13 21:01:00 +02:00
export.c ceph: don't allow access to MDS-private inodes 2021-05-22 11:40:54 +02:00
file.c ceph: fix type promotion bug on 32bit systems 2023-10-25 11:54:15 +02:00
inode.c ceph: fix incorrect revoked caps assert in ceph_fill_file_size() 2023-10-25 11:54:15 +02:00
io.c ceph: add buffered/direct exclusionary locking for reads and writes 2019-09-16 12:06:25 +02:00
io.h ceph: add buffered/direct exclusionary locking for reads and writes 2019-09-16 12:06:25 +02:00
ioctl.c ceph: consider inode's last read/write when calculating wanted caps 2020-03-30 12:42:42 +02:00
ioctl.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Kconfig libceph: replace HTTP links with HTTPS ones 2020-08-03 11:05:26 +02:00
locks.c ceph: switch to vfs_inode_has_locks() to fix file lock bug 2023-01-14 10:16:47 +01:00
Makefile ceph: add dentry lease metric support 2020-06-01 13:22:51 +02:00
mds_client.c ceph: defer stopping mdsc delayed_work 2023-08-11 11:57:52 +02:00
mds_client.h ceph: defer stopping mdsc delayed_work 2023-08-11 11:57:52 +02:00
mdsmap.c ceph: fix possible null-pointer dereference in ceph_mdsmap_decode() 2021-09-08 08:49:01 +02:00
metric.c ceph: never send metrics if disable_send_metrics is set 2023-08-11 11:57:44 +02:00
metric.h ceph: metrics for opened files, pinned caps and opened inodes 2020-10-12 15:29:26 +02:00
quota.c ceph: check session state after bumping session->s_seq 2020-11-04 20:55:49 +01:00
snap.c ceph: fix use-after-free bug for inodes when flushing capsnaps 2023-06-14 11:09:51 +02:00
strings.c ceph: flush mdlog before umounting 2022-12-02 17:40:03 +01:00
super.c ceph: defer stopping mdsc delayed_work 2023-08-11 11:57:52 +02:00
super.h ceph: switch to vfs_inode_has_locks() to fix file lock bug 2023-01-14 10:16:47 +01:00
util.c ceph: move net/ceph/ceph_fs.c to fs/ceph/util.c 2020-01-27 16:53:40 +01:00
xattr.c ceph: allow ceph.dir.rctime xattr to be updatable 2022-06-14 18:32:44 +02:00