Skip to content

Commit 8709c53

Browse files
dezgeggregkh
authored andcommitted
fs/9p: Compare qid.path in v9fs_test_inode
commit 8ee031631546cf2f7859cc69593bd60bbdd70b46 upstream. 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.") Reviewed-by: Latchesar Ionkov <lucho@ionkov.net> Signed-off-by: Tuomas Tynkkynen <tuomas@tuxera.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 1b11593 commit 8709c53

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

fs/9p/vfs_inode.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,9 @@ static int v9fs_test_inode(struct inode *inode, void *data)
483483

484484
if (v9inode->qid.type != st->qid.type)
485485
return 0;
486+
487+
if (v9inode->qid.path != st->qid.path)
488+
return 0;
486489
return 1;
487490
}
488491

fs/9p/vfs_inode_dotl.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ static int v9fs_test_inode_dotl(struct inode *inode, void *data)
8787

8888
if (v9inode->qid.type != st->qid.type)
8989
return 0;
90+
91+
if (v9inode->qid.path != st->qid.path)
92+
return 0;
9093
return 1;
9194
}
9295

0 commit comments

Comments
 (0)