1 ext4: use file_dentry()
3 From: Miklos Szeredi <mszeredi@redhat.com>
5 EXT4 may be used as lower layer of overlayfs and accessing f_path.dentry
8 Fix by replacing direct access of file->f_path.dentry with the
9 file_dentry() accessor, which will always return a native object.
11 Reported-by: Daniel Axtens <dja@axtens.net>
12 Fixes: 4bacc9c9234c ("overlayfs: Make f_path always point to the overlay and f_inode to the underlay")
13 Fixes: ff978b09f973 ("ext4 crypto: move context consistency check to ext4_file_open()")
14 Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
15 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
16 Cc: David Howells <dhowells@redhat.com>
17 Cc: Al Viro <viro@zeniv.linux.org.uk>
18 Cc: <stable@vger.kernel.org> # v4.5
21 1 file changed, 1 insertion(+), 1 deletion(-)
23 diff --git a/fs/ext4/file.c b/fs/ext4/file.c
24 index feb9ffc6f20d..38847f38b34a 100644
27 @@ -380,7 +380,7 @@ static int ext4_file_open(struct inode * inode, struct file * filp)
31 - dir = dget_parent(filp->f_path.dentry);
32 + dir = dget_parent(file_dentry(filp));
33 if (ext4_encrypted_inode(d_inode(dir)) &&
34 !ext4_is_child_context_consistent_with_parent(d_inode(dir), inode)) {
35 ext4_warning(inode->i_sb,