linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Ext4 Developers List <linux-ext4@vger.kernel.org>
Cc: dhowells@redhat.com, viro@ZenIV.linux.org.uk,
	Linux Filesystem Development List <linux-fsdevel@vger.kernel.org>,
	jaegeuk@kernel.org, Miklos Szeredi <mszeredi@redhat.com>,
	Theodore Ts'o <tytso@mit.edu>, Al Viro <viro@zeniv.linux.org.uk>,
	<stable@vger.kernel.org>
Subject: [PATCH 4/5] ext4: use file_dentry()
Date: Sat, 26 Mar 2016 17:09:59 -0400	[thread overview]
Message-ID: <1459026600-9232-5-git-send-email-tytso@mit.edu> (raw)
In-Reply-To: <1459026600-9232-1-git-send-email-tytso@mit.edu>

From: Miklos Szeredi <mszeredi@redhat.com>

EXT4 may be used as lower layer of overlayfs and accessing f_path.dentry
can lead to a crash.

Fix by replacing direct access of file->f_path.dentry with the
file_dentry() accessor, which will always return a native object.

Reported-by: Daniel Axtens <dja@axtens.net>
Fixes: 4bacc9c9234c ("overlayfs: Make f_path always point to the overlay and f_inode to the underlay")
Fixes: ff978b09f973 ("ext4 crypto: move context consistency check to ext4_file_open()")
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: David Howells <dhowells@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: <stable@vger.kernel.org> # v4.5
---
 fs/ext4/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 257118d..edba9fb 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -374,7 +374,7 @@ static int ext4_file_open(struct inode * inode, struct file * filp)
 			return -ENOKEY;
 	}
 
-	dir = dget_parent(filp->f_path.dentry);
+	dir = dget_parent(file_dentry(filp));
 	if (ext4_encrypted_inode(d_inode(dir)) &&
 	    !ext4_is_child_context_consistent_with_parent(d_inode(dir), inode)) {
 		ext4_warning(inode->i_sb,
-- 
2.5.0

  parent reply	other threads:[~2016-03-26 21:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-26 21:09 [PATCH 0/5] Miklos's vfs/nfs/ext4 patches in the ext4.git tree Theodore Ts'o
2016-03-26 21:09 ` [PATCH 1/5] fs: add file_dentry() Theodore Ts'o
2016-03-26 21:09 ` [PATCH 2/5] nfs: use file_dentry() Theodore Ts'o
2016-03-26 21:09 ` [PATCH 3/5] ext4: use dget_parent() in ext4_file_open() Theodore Ts'o
2016-03-26 21:09 ` Theodore Ts'o [this message]
2016-03-26 21:10 ` [PATCH 5/5] ext4 crypto: use dget_parent() in ext4_d_revalidate() Theodore Ts'o
2016-03-27  8:02   ` Sedat Dilek
2016-03-27 18:16     ` Theodore Ts'o
2016-03-27  8:06 ` [PATCH 0/5] Miklos's vfs/nfs/ext4 patches in the ext4.git tree Sedat Dilek
2016-03-27 18:15   ` Theodore Ts'o
2016-03-27 19:31     ` Sedat Dilek
2016-03-28 12:36       ` Theodore Ts'o
2016-03-27 22:51 ` Sedat Dilek
2016-03-28 14:02   ` Chris Mason
2016-03-29 17:15     ` Theodore Ts'o
2016-03-29 20:12       ` Chris Mason
2016-03-29 19:58 ` Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1459026600-9232-5-git-send-email-tytso@mit.edu \
    --to=tytso@mit.edu \
    --cc=dhowells@redhat.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=mszeredi@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).