mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
synced 2026-11-10 20:48:12 +00:00
ceph: require the dentry lease record to cover struct ceph_mds_reply_lease
parse_reply_info_lease() reads a 32-bit struct_len off the wire and only
checks that many bytes are present, without requiring struct_len to cover
sizeof(struct ceph_mds_reply_lease) (10 bytes). A malicious MDS can
declare a shorter record and still get the pointer published: the
following *p += sizeof(**lease) overshoot is undone by *p = lend, so
nothing downstream rejects the reply. ceph_fill_trace() ->
update_dentry_lease() then reads 10 bytes through that pointer on any
lookup on a mounted CephFS, running past the end of the message front.
Require the record to cover the structure, matching the sibling
parse_reply_info_dir(). A conforming MDS always encodes the full 10
bytes.
BUG: KASAN: slab-out-of-bounds in __update_dentry_lease.constprop.0 (fs/ceph/inode.c:1459)
Read of size 4 at addr ffff888026c63d65 by task kworker/0:3/2366
Workqueue: ceph-msgr ceph_con_workfn
Call Trace:
__update_dentry_lease.constprop.0 (fs/ceph/inode.c:1459)
ceph_fill_trace (fs/ceph/inode.c:1474 fs/ceph/inode.c:1823)
mds_dispatch (fs/ceph/mds_client.c:4229 fs/ceph/mds_client.c:7225)
ceph_con_process_message (net/ceph/messenger.c:1424)
ceph_con_v1_try_read (net/ceph/messenger_v1.c:1430)
ceph_con_workfn (net/ceph/messenger.c:1576)
process_one_work (kernel/workqueue.c:3396)
worker_thread (kernel/workqueue.c:3479 kernel/workqueue.c:3560)
kthread (kernel/kthread.c:436)
ret_from_fork (arch/x86/kernel/process.c:158)
ret_from_fork_asm (arch/x86/entry/entry_64.S:245)
The buggy address is located 357 bytes inside of
allocated 360-byte region [ffff888026c63c00, ffff888026c63d68)
Cc: stable@vger.kernel.org
Fixes: 4ac4c23eaa ("ceph: decode alternate_name in lease info")
Reported-by: co+f92fbe44e3c6df69@bugs.sh
Assisted-by: LLM
Signed-off-by: Xiang Mei <xmei5@asu.edu>
Reviewed-by: Alex Markuze <amarkuze@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
parent
c1742590d2
commit
7286b2ffe0
1 changed files with 2 additions and 0 deletions
Loading…
Add table
Add a link
Reference in a new issue