Skip to content

Commit

Permalink
fix hostfs_open() use of ->f_path.dentry
Browse files Browse the repository at this point in the history
this is one of the cases where we need to use d_real() - we are
using more than the name of dentry here.  ->d_sb is used as well,
so in case of hostfs being used as a layer we get the wrong
superblock.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Tested-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Dec 22, 2020
1 parent 1a97d89 commit 2e2cbaf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/hostfs/hostfs_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ static int hostfs_open(struct inode *ino, struct file *file)
if (mode & FMODE_WRITE)
r = w = 1;

name = dentry_name(file->f_path.dentry);
name = dentry_name(d_real(file->f_path.dentry, file->f_inode));
if (name == NULL)
return -ENOMEM;

Expand Down

0 comments on commit 2e2cbaf

Please sign in to comment.