linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: Theodore Ts'o <tytso@mit.edu>, Jaegeuk Kim <jaegeuk@kernel.org>
Cc: linux-ext4@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: ext4, f2fs: fscrypt_has_permitted_context() check in file open
Date: Thu, 22 Sep 2016 14:24:35 +0200	[thread overview]
Message-ID: <6789d30e-f95d-d8bd-cd6e-664a89c0dfd1@nod.at> (raw)

Hi!

Both ext4 and f2fs check in the file open code the context of the parent directory too:

ext4:
        if (ext4_encrypted_inode(d_inode(dir)) &&
                        !fscrypt_has_permitted_context(d_inode(dir), inode)) {
                ext4_warning(inode->i_sb,
                             "Inconsistent encryption contexts: %lu/%lu",
                             (unsigned long) d_inode(dir)->i_ino,
                             (unsigned long) inode->i_ino);
                dput(dir);
                return -EPERM;
        }

f2fs:
        if (f2fs_encrypted_inode(d_inode(dir)) &&
                        !fscrypt_has_permitted_context(d_inode(dir), inode)) {
                dput(dir);
                return -EPERM;
        }

Why do we need this check? AFAIK this situation can never happen unless due to
a bug in the filesystem code.

Thanks,
//richard

             reply	other threads:[~2016-09-22 12:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-22 12:24 Richard Weinberger [this message]
2016-09-22 13:44 ` ext4, f2fs: fscrypt_has_permitted_context() check in file open Theodore Ts'o
2016-09-22 14:21   ` Richard Weinberger
2016-09-22 15:59     ` Theodore Ts'o

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=6789d30e-f95d-d8bd-cd6e-664a89c0dfd1@nod.at \
    --to=richard@nod.at \
    --cc=jaegeuk@kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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).