diff --git a/fs/hmdfs/inode_cloud.c b/fs/hmdfs/inode_cloud.c index 289e05a398425c3666b219f603d49ba149e508a5..4fde1d5880b56f66817d21720e4863e2e8b1f573 100644 --- a/fs/hmdfs/inode_cloud.c +++ b/fs/hmdfs/inode_cloud.c @@ -286,6 +286,10 @@ static struct dentry *hmdfs_lookup_cloud_dentry(struct inode *parent_inode, if (in_share_dir(child_dentry)) gdi->file_type = HM_SHARE; inode = fill_inode_cloud(sb, lookup_result, parent_inode); + if (IS_ERR(inode)) { + ret = ERR_CAST(inode); + goto out; + } check_and_fixup_ownership_remote(parent_inode, inode, @@ -297,6 +301,7 @@ static struct dentry *hmdfs_lookup_cloud_dentry(struct inode *parent_inode, ret = ERR_PTR(-ENOENT); } +out: kfree(lookup_result); return ret; } diff --git a/fs/hmdfs/inode_local.c b/fs/hmdfs/inode_local.c index a6dff05efb0e376b154437aa9a836bb49f7c47eb..da1db4cbc7c58a6e5cc7e01429c943cb802f553a 100644 --- a/fs/hmdfs/inode_local.c +++ b/fs/hmdfs/inode_local.c @@ -38,7 +38,6 @@ int init_hmdfs_dentry_info(struct hmdfs_sb_info *sbi, struct dentry *dentry, if (!info) return -ENOMEM; - dentry->d_fsdata = info; INIT_LIST_HEAD(&info->cache_list_head); INIT_LIST_HEAD(&info->remote_cache_list_head); spin_lock_init(&info->cache_list_lock); @@ -47,6 +46,7 @@ int init_hmdfs_dentry_info(struct hmdfs_sb_info *sbi, struct dentry *dentry, spin_lock_init(&info->lock); info->dentry_type = dentry_type; info->device_id = 0; + dentry->d_fsdata = info; if (dentry_type == HMDFS_LAYER_ZERO || dentry_type == HMDFS_LAYER_FIRST_DEVICE || dentry_type == HMDFS_LAYER_SECOND_LOCAL ||