linux-yocto/fs/ceph
Alex Markuze 305935130d ceph: fix race condition where r_parent becomes stale before sending message
commit bec324f33d1ed346394b2eee25bf6dbf3511f727 upstream.

When the parent directory's i_rwsem is not locked, req->r_parent may become
stale due to concurrent operations (e.g. rename) between dentry lookup and
message creation. Validate that r_parent matches the encoded parent inode
and update to the correct inode if a mismatch is detected.

[ idryomov: folded a follow-up fix from Alex to drop extra reference
  from ceph_get_reply_dir() in ceph_fill_trace():

  ceph_get_reply_dir() may return a different, referenced inode when
  r_parent is stale and the parent directory lock is not held.
  ceph_fill_trace() used that inode but failed to drop the reference
  when it differed from req->r_parent, leaking an inode reference.

  Keep the directory inode in a local variable and iput() it at
  function end if it does not match req->r_parent. ]

Cc: stable@vger.kernel.org
Signed-off-by: Alex Markuze <amarkuze@redhat.com>
Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-09-19 16:35:47 +02:00
..
acl.c
addr.c ceph: avoid kernel BUG for encrypted inode with unaligned file size 2025-06-27 11:11:19 +01:00
cache.c
cache.h
caps.c
ceph_frag.c
crypto.c parse_longname(): strrchr() expects NUL-terminated string 2025-08-15 12:13:31 +02:00
crypto.h
debugfs.c ceph: fix race condition validating r_parent before applying state 2025-09-19 16:35:47 +02:00
dir.c ceph: fix race condition validating r_parent before applying state 2025-09-19 16:35:47 +02:00
export.c
file.c ceph: fix race condition validating r_parent before applying state 2025-09-19 16:35:47 +02:00
inode.c ceph: fix race condition where r_parent becomes stale before sending message 2025-09-19 16:35:47 +02:00
io.c
io.h
ioctl.c
ioctl.h
Kconfig
locks.c
Makefile
mds_client.c ceph: fix race condition validating r_parent before applying state 2025-09-19 16:35:47 +02:00
mds_client.h ceph: fix race condition validating r_parent before applying state 2025-09-19 16:35:47 +02:00
mdsmap.c
mdsmap.h
metric.c
metric.h
quota.c
snap.c
strings.c
super.c ceph: set superblock s_magic for IMA fsmagic matching 2025-06-27 11:11:19 +01:00
super.h
util.c
xattr.c