]>
Commit | Line | Data |
---|---|---|
d431789d GKH |
1 | From 8ee031631546cf2f7859cc69593bd60bbdd70b46 Mon Sep 17 00:00:00 2001 |
2 | From: Tuomas Tynkkynen <tuomas@tuxera.com> | |
3 | Date: Wed, 6 Sep 2017 17:59:07 +0300 | |
4 | Subject: fs/9p: Compare qid.path in v9fs_test_inode | |
5 | ||
6 | From: Tuomas Tynkkynen <tuomas@tuxera.com> | |
7 | ||
8 | commit 8ee031631546cf2f7859cc69593bd60bbdd70b46 upstream. | |
9 | ||
10 | Commit fd2421f54423 ("fs/9p: When doing inode lookup compare qid details | |
11 | and inode mode bits.") transformed v9fs_qid_iget() to use iget5_locked() | |
12 | instead of iget_locked(). However, the test() callback is not checking | |
13 | fid.path at all, which means that a lookup in the inode cache can now | |
14 | accidentally locate a completely wrong inode from the same inode hash | |
15 | bucket if the other fields (qid.type and qid.version) match. | |
16 | ||
17 | Fixes: fd2421f54423 ("fs/9p: When doing inode lookup compare qid details and inode mode bits.") | |
18 | Reviewed-by: Latchesar Ionkov <lucho@ionkov.net> | |
19 | Signed-off-by: Tuomas Tynkkynen <tuomas@tuxera.com> | |
20 | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> | |
21 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
22 | ||
23 | --- | |
24 | fs/9p/vfs_inode.c | 3 +++ | |
25 | fs/9p/vfs_inode_dotl.c | 3 +++ | |
26 | 2 files changed, 6 insertions(+) | |
27 | ||
28 | --- a/fs/9p/vfs_inode.c | |
29 | +++ b/fs/9p/vfs_inode.c | |
30 | @@ -483,6 +483,9 @@ static int v9fs_test_inode(struct inode | |
31 | ||
32 | if (v9inode->qid.type != st->qid.type) | |
33 | return 0; | |
34 | + | |
35 | + if (v9inode->qid.path != st->qid.path) | |
36 | + return 0; | |
37 | return 1; | |
38 | } | |
39 | ||
40 | --- a/fs/9p/vfs_inode_dotl.c | |
41 | +++ b/fs/9p/vfs_inode_dotl.c | |
42 | @@ -87,6 +87,9 @@ static int v9fs_test_inode_dotl(struct i | |
43 | ||
44 | if (v9inode->qid.type != st->qid.type) | |
45 | return 0; | |
46 | + | |
47 | + if (v9inode->qid.path != st->qid.path) | |
48 | + return 0; | |
49 | return 1; | |
50 | } | |
51 |