Skip to content

Commit 9640fe5

Browse files
author
Al Viro
committed
ocfs2_dentry_revalidate(): use stable parent inode and name passed by caller
theoretically, ->d_name use in there is a UAF, but only if you are messing with tracepoints... Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent ffeeaad commit 9640fe5

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

fs/ocfs2/dcache.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,16 @@ static int ocfs2_dentry_revalidate(struct inode *dir, const struct qstr *name,
4545
inode = d_inode(dentry);
4646
osb = OCFS2_SB(dentry->d_sb);
4747

48-
trace_ocfs2_dentry_revalidate(dentry, dentry->d_name.len,
49-
dentry->d_name.name);
48+
trace_ocfs2_dentry_revalidate(dentry, name->len, name->name);
5049

5150
/* For a negative dentry -
5251
* check the generation number of the parent and compare with the
5352
* one stored in the inode.
5453
*/
5554
if (inode == NULL) {
5655
unsigned long gen = (unsigned long) dentry->d_fsdata;
57-
unsigned long pgen;
58-
spin_lock(&dentry->d_lock);
59-
pgen = OCFS2_I(d_inode(dentry->d_parent))->ip_dir_lock_gen;
60-
spin_unlock(&dentry->d_lock);
61-
trace_ocfs2_dentry_revalidate_negative(dentry->d_name.len,
62-
dentry->d_name.name,
56+
unsigned long pgen = OCFS2_I(dir)->ip_dir_lock_gen;
57+
trace_ocfs2_dentry_revalidate_negative(name->len, name->name,
6358
pgen, gen);
6459
if (gen != pgen)
6560
goto bail;

0 commit comments

Comments
 (0)