From: Theodore Ts'o <tytso@mit.edu>
To: Ext4 Developers List <linux-ext4@vger.kernel.org>
Cc: mhalcrow@google.com, Theodore Ts'o <tytso@mit.edu>, stable@kernel.org
Subject: [PATCH v3 3/3] ext4 crypto: add missing locking for keyring_key access
Date: Thu, 10 Dec 2015 10:04:39 -0500 [thread overview]
Message-ID: <1449759879-2166-4-git-send-email-tytso@mit.edu> (raw)
In-Reply-To: <1449759879-2166-1-git-send-email-tytso@mit.edu>
Cc: stable@kernel.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
fs/ext4/crypto_key.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/ext4/crypto_key.c b/fs/ext4/crypto_key.c
index 039b22d..f96a57a 100644
--- a/fs/ext4/crypto_key.c
+++ b/fs/ext4/crypto_key.c
@@ -213,9 +213,11 @@ retry:
res = -ENOKEY;
goto out;
}
+ down_read(&keyring_key->sem);
ukp = user_key_payload(keyring_key);
if (ukp->datalen != sizeof(struct ext4_encryption_key)) {
res = -EINVAL;
+ up_read(&keyring_key->sem);
goto out;
}
master_key = (struct ext4_encryption_key *)ukp->data;
@@ -226,10 +228,12 @@ retry:
"ext4: key size incorrect: %d\n",
master_key->size);
res = -ENOKEY;
+ up_read(&keyring_key->sem);
goto out;
}
res = ext4_derive_key_aes(ctx.nonce, master_key->raw,
raw_key);
+ up_read(&keyring_key->sem);
if (res)
goto out;
got_key:
--
2.5.0
next prev parent reply other threads:[~2015-12-10 15:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-10 15:04 [PATCH v3 0/3] ext4 crypto: back up encrypted files Theodore Ts'o
2015-12-10 15:04 ` [PATCH v3 1/3] ext4 crypto: add ciphertext_access mount option Theodore Ts'o
2015-12-10 15:04 ` [PATCH v3 2/3] ext4 crypto: add ioctls to allow backup of encryption metadata Theodore Ts'o
2015-12-10 23:48 ` Andreas Dilger
2015-12-11 2:45 ` Theodore Ts'o
2015-12-10 15:04 ` Theodore Ts'o [this message]
2015-12-16 15:10 ` [PATCH v3 0/3] ext4 crypto: back up encrypted files Jan Kara
2015-12-18 0:49 ` 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=1449759879-2166-4-git-send-email-tytso@mit.edu \
--to=tytso@mit.edu \
--cc=linux-ext4@vger.kernel.org \
--cc=mhalcrow@google.com \
--cc=stable@kernel.org \
/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).