Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

libceph: Remove obsolete session key alignment logic

Since the call to crypto_shash_setkey() was replaced with
hmac_sha256_preparekey() which doesn't allocate memory regardless of the
alignment of the input key, remove the session key alignment logic from
process_auth_done(). Also remove the inclusion of crypto/hash.h, which
is no longer needed since crypto_shash is no longer used.

[ idryomov: rewrap comment ]

Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>

authored by

Eric Biggers and committed by
Ilya Dryomov
c7aac00c a0d9555b

+5 -8
+5 -8
net/ceph/messenger_v2.c
··· 8 8 #include <linux/ceph/ceph_debug.h> 9 9 10 10 #include <crypto/aead.h> 11 - #include <crypto/hash.h> 12 11 #include <crypto/sha2.h> 13 12 #include <crypto/utils.h> 14 13 #include <linux/bvec.h> ··· 2351 2352 } 2352 2353 2353 2354 /* 2354 - * Align session_key and con_secret to avoid GFP_ATOMIC allocation 2355 - * inside crypto_shash_setkey() and crypto_aead_setkey() called from 2356 - * setup_crypto(). __aligned(16) isn't guaranteed to work for stack 2357 - * objects, so do it by hand. 2355 + * Align con_secret to avoid GFP_ATOMIC allocation inside 2356 + * crypto_aead_setkey() called from setup_crypto(). __aligned(16) 2357 + * isn't guaranteed to work for stack objects, so do it by hand. 2358 2358 */ 2359 2359 static int process_auth_done(struct ceph_connection *con, void *p, void *end) 2360 2360 { 2361 - u8 session_key_buf[CEPH_MAX_KEY_LEN + 16]; 2361 + u8 session_key[CEPH_MAX_KEY_LEN]; 2362 2362 u8 con_secret_buf[CEPH_MAX_CON_SECRET_LEN + 16]; 2363 - u8 *session_key = PTR_ALIGN(&session_key_buf[0], 16); 2364 2363 u8 *con_secret = PTR_ALIGN(&con_secret_buf[0], 16); 2365 2364 int session_key_len, con_secret_len; 2366 2365 int payload_len; ··· 2412 2415 con->state = CEPH_CON_S_V2_AUTH_SIGNATURE; 2413 2416 2414 2417 out: 2415 - memzero_explicit(session_key_buf, sizeof(session_key_buf)); 2418 + memzero_explicit(session_key, sizeof(session_key)); 2416 2419 memzero_explicit(con_secret_buf, sizeof(con_secret_buf)); 2417 2420 return ret; 2418 2421