Skip to content

Commit f43b156

Browse files
committed
Merge tag 'keys-next-6.12-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd
Pull keys fixes from Jarkko Sakkinen: "A couple of fixes for keys and trusted keys" * tag 'keys-next-6.12-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd: KEYS: trusted: dcp: fix NULL dereference in AEAD crypto operation security/keys: fix slab-out-of-bounds in key_task_permission
2 parents 7758b20 + 04de758 commit f43b156

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

security/keys/keyring.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -772,8 +772,11 @@ static bool search_nested_keyrings(struct key *keyring,
772772
for (; slot < ASSOC_ARRAY_FAN_OUT; slot++) {
773773
ptr = READ_ONCE(node->slots[slot]);
774774

775-
if (assoc_array_ptr_is_meta(ptr) && node->back_pointer)
776-
goto descend_to_node;
775+
if (assoc_array_ptr_is_meta(ptr)) {
776+
if (node->back_pointer ||
777+
assoc_array_ptr_is_shortcut(ptr))
778+
goto descend_to_node;
779+
}
777780

778781
if (!keyring_ptr_is_keyring(ptr))
779782
continue;

security/keys/trusted-keys/trusted_dcp.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ static int do_aead_crypto(u8 *in, u8 *out, size_t len, u8 *key, u8 *nonce,
133133
struct scatterlist src_sg, dst_sg;
134134
struct crypto_aead *aead;
135135
int ret;
136+
DECLARE_CRYPTO_WAIT(wait);
136137

137138
aead = crypto_alloc_aead("gcm(aes)", 0, CRYPTO_ALG_ASYNC);
138139
if (IS_ERR(aead)) {
@@ -163,8 +164,8 @@ static int do_aead_crypto(u8 *in, u8 *out, size_t len, u8 *key, u8 *nonce,
163164
}
164165

165166
aead_request_set_crypt(aead_req, &src_sg, &dst_sg, len, nonce);
166-
aead_request_set_callback(aead_req, CRYPTO_TFM_REQ_MAY_SLEEP, NULL,
167-
NULL);
167+
aead_request_set_callback(aead_req, CRYPTO_TFM_REQ_MAY_SLEEP,
168+
crypto_req_done, &wait);
168169
aead_request_set_ad(aead_req, 0);
169170

170171
if (crypto_aead_setkey(aead, key, AES_KEYSIZE_128)) {
@@ -174,9 +175,9 @@ static int do_aead_crypto(u8 *in, u8 *out, size_t len, u8 *key, u8 *nonce,
174175
}
175176

176177
if (do_encrypt)
177-
ret = crypto_aead_encrypt(aead_req);
178+
ret = crypto_wait_req(crypto_aead_encrypt(aead_req), &wait);
178179
else
179-
ret = crypto_aead_decrypt(aead_req);
180+
ret = crypto_wait_req(crypto_aead_decrypt(aead_req), &wait);
180181

181182
free_req:
182183
aead_request_free(aead_req);

0 commit comments

Comments
 (0)