aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds2022-02-04 09:44:42 -0800
committerLinus Torvalds2022-02-04 09:44:42 -0800
commit1eb7de177d4073085e3a1cebf19d5d538d171f10 (patch)
tree6fd630f0612884f20a2476710cc4819263cf3cda
parent633a8e8986eac2c9e32c76ccb9cfe0e5a898b314 (diff)
parent22e424feb6658c5d6789e45121830357809c59cb (diff)
Merge tag '9p-for-5.17-rc3' of git://github.com/martinetd/linux
Pull 9p fix from Dominique Martinet: "Fix 'cannot walk open fid' rule The 9p 'walk' operation requires fid arguments to not originate from an open or create call and we've missed that for a while as the servers regularly running tests with don't enforce the check and no active reviewer knew about the rule. Both reporters confirmed reverting this patch fixes things for them and looking at it further wasn't actually required... Will take more time for follow up and enforcing the rule more thoroughly later" * tag '9p-for-5.17-rc3' of git://github.com/martinetd/linux: Revert "fs/9p: search open fids first"
-rw-r--r--fs/9p/fid.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/9p/fid.c b/fs/9p/fid.c
index 6aab046c98e2..79df61fe0e59 100644
--- a/fs/9p/fid.c
+++ b/fs/9p/fid.c
@@ -96,12 +96,8 @@ static struct p9_fid *v9fs_fid_find(struct dentry *dentry, kuid_t uid, int any)
dentry, dentry, from_kuid(&init_user_ns, uid),
any);
ret = NULL;
-
- if (d_inode(dentry))
- ret = v9fs_fid_find_inode(d_inode(dentry), uid);
-
/* we'll recheck under lock if there's anything to look in */
- if (!ret && dentry->d_fsdata) {
+ if (dentry->d_fsdata) {
struct hlist_head *h = (struct hlist_head *)&dentry->d_fsdata;
spin_lock(&dentry->d_lock);
@@ -113,6 +109,9 @@ static struct p9_fid *v9fs_fid_find(struct dentry *dentry, kuid_t uid, int any)
}
}
spin_unlock(&dentry->d_lock);
+ } else {
+ if (dentry->d_inode)
+ ret = v9fs_fid_find_inode(dentry->d_inode, uid);
}
return ret;