|
|
@@ -5240,7 +5240,7 @@ static int drbd_do_auth(struct drbd_connection *connection)
|
|
|
unsigned int key_len;
|
|
|
char secret[SHARED_SECRET_MAX]; /* 64 byte */
|
|
|
unsigned int resp_size;
|
|
|
- SHASH_DESC_ON_STACK(desc, connection->cram_hmac_tfm);
|
|
|
+ struct shash_desc *desc;
|
|
|
struct packet_info pi;
|
|
|
struct net_conf *nc;
|
|
|
int err, rv;
|
|
|
@@ -5253,6 +5253,13 @@ static int drbd_do_auth(struct drbd_connection *connection)
|
|
|
memcpy(secret, nc->shared_secret, key_len);
|
|
|
rcu_read_unlock();
|
|
|
|
|
|
+ desc = kmalloc(sizeof(struct shash_desc) +
|
|
|
+ crypto_shash_descsize(connection->cram_hmac_tfm),
|
|
|
+ GFP_KERNEL);
|
|
|
+ if (!desc) {
|
|
|
+ rv = -1;
|
|
|
+ goto fail;
|
|
|
+ }
|
|
|
desc->tfm = connection->cram_hmac_tfm;
|
|
|
desc->flags = 0;
|
|
|
|
|
|
@@ -5395,7 +5402,10 @@ static int drbd_do_auth(struct drbd_connection *connection)
|
|
|
kfree(peers_ch);
|
|
|
kfree(response);
|
|
|
kfree(right_response);
|
|
|
- shash_desc_zero(desc);
|
|
|
+ if (desc) {
|
|
|
+ shash_desc_zero(desc);
|
|
|
+ kfree(desc);
|
|
|
+ }
|
|
|
|
|
|
return rv;
|
|
|
}
|