android_kernel_sony_sdm845/fs/ceph
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Luis Henriques a4d310043c ceph: fix use-after-free in __ceph_remove_cap()
commit ea60ed6fcf29eebc78f2ce91491e6309ee005a01 upstream.

KASAN reports a use-after-free when running xfstest generic/531, with the
following trace:

[  293.903362]  kasan_report+0xe/0x20
[  293.903365]  rb_erase+0x1f/0x790
[  293.903370]  __ceph_remove_cap+0x201/0x370
[  293.903375]  __ceph_remove_caps+0x4b/0x70
[  293.903380]  ceph_evict_inode+0x4e/0x360
[  293.903386]  evict+0x169/0x290
[  293.903390]  __dentry_kill+0x16f/0x250
[  293.903394]  dput+0x1c6/0x440
[  293.903398]  __fput+0x184/0x330
[  293.903404]  task_work_run+0xb9/0xe0
[  293.903410]  exit_to_usermode_loop+0xd3/0xe0
[  293.903413]  do_syscall_64+0x1a0/0x1c0
[  293.903417]  entry_SYSCALL_64_after_hwframe+0x44/0xa9

This happens because __ceph_remove_cap() may queue a cap release
(__ceph_queue_cap_release) which can be scheduled before that cap is
removed from the inode list with

	rb_erase(&cap->ci_node, &ci->i_caps);

And, when this finally happens, the use-after-free will occur.

This can be fixed by removing the cap from the inode list before being
removed from the session list, and thus eliminating the risk of an UAF.

Cc: stable@vger.kernel.org
Signed-off-by: Luis Henriques <lhenriques@suse.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-12 19:15:44 +01:00
..
acl.c ceph: Propagate dentry down to inode_change_ok() 2016-09-22 10:56:19 +02:00
addr.c ceph: fix readpage from fscache 2017-09-07 08:35:40 +02:00
cache.c ceph: fix readpage from fscache 2017-09-07 08:35:40 +02:00
cache.h ceph: improve fscache revalidation 2016-06-01 10:31:50 +02:00
caps.c ceph: fix use-after-free in __ceph_remove_cap() 2019-11-12 19:15:44 +01:00
ceph_frag.c
debugfs.c ceph: don't show symlink target in debugfs/mdsc 2016-05-26 01:15:32 +02:00
dir.c ceph: ensure d_name stability in ceph_dentry_hash() 2019-05-02 09:32:01 +02:00
export.c ceph: fix d_obtain_alias() misuses 2016-06-24 23:49:03 -04:00
file.c ceph: only dirty ITER_IOVEC pages for direct read 2018-04-08 12:12:42 +02:00
inode.c ceph: fix directories inode i_blkbits initialization 2019-10-17 13:42:11 -07:00
ioctl.c ceph: fix bogus endianness change in ceph_ioctl_set_layout 2017-10-21 17:21:37 +02:00
ioctl.h ceph: fully initialize new layout 2012-05-16 14:28:27 -05:00
Kconfig ceph: add acl for cephfs 2013-12-31 20:32:01 +02:00
locks.c ceph: fix mandatory flock check 2016-10-03 16:13:49 +02:00
Makefile ceph: add acl for cephfs 2013-12-31 20:32:01 +02:00
mds_client.c ceph: reconnect connection if session hang in opening state 2019-10-17 13:42:11 -07:00
mds_client.h ceph: handle CEPH_SESSION_REJECT message 2016-10-03 16:13:50 +02:00
mdsmap.c ceph: CEPH_FEATURE_MDSENC support 2016-05-26 01:15:31 +02:00
snap.c ceph: fix ci->i_head_snapc leak 2019-05-02 09:32:01 +02:00
strings.c ceph: handle CEPH_SESSION_REJECT message 2016-10-03 16:13:50 +02:00
super.c ceph: flush dirty inodes before proceeding with remount 2019-05-25 18:26:49 +02:00
super.h ceph: fix improper use of smp_mb__before_atomic() 2019-08-06 18:29:35 +02:00
xattr.c ceph: fix buffer free while holding i_ceph_lock in __ceph_setxattr() 2019-09-10 10:31:02 +01:00