mirror of
https://github.com/ceph/ceph
synced 2025-01-20 01:51:34 +00:00
Merge PR #22611 into master
* refs/pull/22611/head: client: fix use-after-free in Client::link() Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
This commit is contained in:
commit
ad3aee3a57
@ -2978,8 +2978,10 @@ Dentry* Client::link(Dir *dir, const string& name, Inode *in, Dentry *dn)
|
||||
}
|
||||
|
||||
if (in) { // link to inode
|
||||
InodeRef tmp_ref;
|
||||
// only one parent for directories!
|
||||
if (in->is_dir() && !in->dentries.empty()) {
|
||||
tmp_ref = in; // prevent unlink below from freeing the inode.
|
||||
Dentry *olddn = in->get_first_parent();
|
||||
assert(olddn->dir != dir || olddn->name != name);
|
||||
Inode *old_diri = olddn->dir->parent_inode;
|
||||
|
Loading…
Reference in New Issue
Block a user