aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/crypto_key.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-01-22 14:23:35 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-01-22 14:23:35 -0500
commit391f2a16b74b95da2f05a607f53213fc8ed24b8e (patch)
tree93bfd1906778d7ff24f6ce7c03f2e7c0f91caef5 /fs/ext4/crypto_key.c
parentd5ffdf8b4ac6e6db5702ba31870c476d5fa30660 (diff)
parent68ce7bfcd995a8a393b1b14fa67dbc16fa3dc784 (diff)
Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
Pull ext4 updates from Ted Ts'o: "Some locking and page fault bug fixes from Jan Kara, some ext4 encryption fixes from me, and Li Xi's Project Quota commits" * tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: fs: clean up the flags definition in uapi/linux/fs.h ext4: add FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support ext4: add project quota support ext4: adds project ID support ext4 crypto: simplify interfaces to directory entry insert functions ext4 crypto: add missing locking for keyring_key access ext4: use pre-zeroed blocks for DAX page faults ext4: implement allocation of pre-zeroed blocks ext4: provide ext4_issue_zeroout() ext4: get rid of EXT4_GET_BLOCKS_NO_LOCK flag ext4: document lock ordering ext4: fix races of writeback with punch hole and zero range ext4: fix races between buffered IO and collapse / insert range ext4: move unlocked dio protection from ext4_alloc_file_blocks() ext4: fix races between page faults and hole punching
Diffstat (limited to 'fs/ext4/crypto_key.c')
-rw-r--r--fs/ext4/crypto_key.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/ext4/crypto_key.c b/fs/ext4/crypto_key.c
index c5882b36e558..9a16d1e75a49 100644
--- a/fs/ext4/crypto_key.c
+++ b/fs/ext4/crypto_key.c
@@ -213,9 +213,11 @@ retry:
213 res = -ENOKEY; 213 res = -ENOKEY;
214 goto out; 214 goto out;
215 } 215 }
216 down_read(&keyring_key->sem);
216 ukp = user_key_payload(keyring_key); 217 ukp = user_key_payload(keyring_key);
217 if (ukp->datalen != sizeof(struct ext4_encryption_key)) { 218 if (ukp->datalen != sizeof(struct ext4_encryption_key)) {
218 res = -EINVAL; 219 res = -EINVAL;
220 up_read(&keyring_key->sem);
219 goto out; 221 goto out;
220 } 222 }
221 master_key = (struct ext4_encryption_key *)ukp->data; 223 master_key = (struct ext4_encryption_key *)ukp->data;
@@ -226,10 +228,12 @@ retry:
226 "ext4: key size incorrect: %d\n", 228 "ext4: key size incorrect: %d\n",
227 master_key->size); 229 master_key->size);
228 res = -ENOKEY; 230 res = -ENOKEY;
231 up_read(&keyring_key->sem);
229 goto out; 232 goto out;
230 } 233 }
231 res = ext4_derive_key_aes(ctx.nonce, master_key->raw, 234 res = ext4_derive_key_aes(ctx.nonce, master_key->raw,
232 raw_key); 235 raw_key);
236 up_read(&keyring_key->sem);
233 if (res) 237 if (res)
234 goto out; 238 goto out;
235got_key: 239got_key: