From: Eric Biggers <ebiggers@google.com>
To: stable@vger.kernel.org
Cc: tytso@mit.edu, jaegeuk@kernel.org, Eric Biggers <ebiggers@google.com>
Subject: [PATCH] fscrypto: require write access to mount to set encryption policy
Date: Mon, 19 Sep 2016 17:49:46 -0700 [thread overview]
Message-ID: <1474332586-101295-1-git-send-email-ebiggers@google.com> (raw)
commit ba63f23d69a3a10e7e527a02702023da68ef8a6d upstream, backported to
fs/ext4/ioctl.c for pre-4.8 kernels.
Since setting an encryption policy requires writing metadata to the
filesystem, it should be guarded by mnt_want_write/mnt_drop_write.
Otherwise, a user could cause a write to a frozen or readonly
filesystem. This was handled correctly by f2fs but not by ext4.
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
fs/ext4/ioctl.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index 28cc412..64eddc5 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -782,7 +782,13 @@ resizefs_out:
goto encryption_policy_out;
}
+ err = mnt_want_write_file(filp);
+ if (err)
+ goto encryption_policy_out;
+
err = ext4_process_policy(&policy, inode);
+
+ mnt_drop_write_file(filp);
encryption_policy_out:
return err;
#else
--
2.8.0.rc3.226.g39d4020
next reply other threads:[~2016-09-20 0:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-20 0:49 Eric Biggers [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-10-24 23:32 [PATCH] fscrypto: require write access to mount to set encryption policy Eric Biggers
2017-10-25 9:42 ` Greg KH
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=1474332586-101295-1-git-send-email-ebiggers@google.com \
--to=ebiggers@google.com \
--cc=jaegeuk@kernel.org \
--cc=stable@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).