Skip to content

Commit

Permalink
fs/9p: Compare qid.path in v9fs_test_inode
Browse files Browse the repository at this point in the history
Commit fd2421f ("fs/9p: When doing inode lookup compare qid details
and inode mode bits.") transformed v9fs_qid_iget() to use iget5_locked()
instead of iget_locked(). However, the test() callback is not checking
fid.path at all, which means that a lookup in the inode cache can now
accidentally locate a completely wrong inode from the same inode hash
bucket if the other fields (qid.type and qid.version) match.

Fixes: fd2421f ("fs/9p: When doing inode lookup compare qid details and inode mode bits.")
Cc: [email protected]
Reviewed-by: Latchesar Ionkov <[email protected]>
Signed-off-by: Tuomas Tynkkynen <[email protected]>
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
dezgeg authored and Al Viro committed Oct 24, 2017
1 parent 357fdad commit 8ee0316
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/9p/vfs_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,9 @@ static int v9fs_test_inode(struct inode *inode, void *data)

if (v9inode->qid.type != st->qid.type)
return 0;

if (v9inode->qid.path != st->qid.path)
return 0;
return 1;
}

Expand Down
3 changes: 3 additions & 0 deletions fs/9p/vfs_inode_dotl.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ static int v9fs_test_inode_dotl(struct inode *inode, void *data)

if (v9inode->qid.type != st->qid.type)
return 0;

if (v9inode->qid.path != st->qid.path)
return 0;
return 1;
}

Expand Down

0 comments on commit 8ee0316

Please sign in to comment.