From: Al Viro Date: Wed, 3 Aug 2016 15:02:48 +0000 (-0400) Subject: 9p: fix braino introduced in "9p: new helper - v9fs_parent_fid()" X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=797fc16d8f00bf681b7f9969c0701725b472b11a;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 9p: fix braino introduced in "9p: new helper - v9fs_parent_fid()" In v9fs_vfs_rename() we need to clone the parents' fids, not just find them. Spotted-by: Johannes Berg Signed-off-by: Al Viro --- diff --git a/fs/9p/fid.h b/fs/9p/fid.h index 12700df0bb51..d4c5002d56ad 100644 --- a/fs/9p/fid.h +++ b/fs/9p/fid.h @@ -31,4 +31,8 @@ static inline struct p9_fid *v9fs_parent_fid(struct dentry *dentry) struct p9_fid *v9fs_fid_clone(struct dentry *dentry); void v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid); struct p9_fid *v9fs_writeback_fid(struct dentry *dentry); +static inline struct p9_fid *clone_fid(struct p9_fid *fid) +{ + return IS_ERR(fid) ? fid : p9_client_walk(fid, 0, NULL, 1); +} #endif diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 7da9a8354fad..26189eebcd1c 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c @@ -975,13 +975,13 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry, if (IS_ERR(oldfid)) return PTR_ERR(oldfid); - olddirfid = v9fs_parent_fid(old_dentry); + olddirfid = clone_fid(v9fs_parent_fid(old_dentry)); if (IS_ERR(olddirfid)) { retval = PTR_ERR(olddirfid); goto done; } - newdirfid = v9fs_parent_fid(new_dentry); + newdirfid = clone_fid(v9fs_parent_fid(new_dentry)); if (IS_ERR(newdirfid)) { retval = PTR_ERR(newdirfid); goto clunk_olddir;