kernel_samsung_a53x/fs/ceph
Rishabh Dave b8c675dea5 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-11-18 12:13:33 +01:00
..
acl.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
addr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cache.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cache.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
caps.c ceph: prevent use-after-free in encode_cap_msg() 2024-11-18 12:13:33 +01:00
ceph_frag.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
debugfs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dir.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
export.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
file.c ceph: fix type promotion bug on 32bit systems 2024-11-08 11:25:50 +01:00
inode.c ceph: fix incorrect revoked caps assert in ceph_fill_file_size() 2024-11-08 11:25:50 +01:00
io.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
io.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ioctl.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ioctl.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
locks.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mds_client.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mds_client.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mdsmap.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
metric.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
metric.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
quota.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
snap.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
strings.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
super.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
super.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
util.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xattr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00