Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 346069
b: refs/heads/master
c: 7aca6c7
h: refs/heads/master
i:
  346067: 3560614
v: v3
  • Loading branch information
Philipp Reisner committed Nov 8, 2012
1 parent 415dc59 commit 34b7d08
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f179d76d76ce6653ba4c6a6b0c2e7c42215734bc
refs/heads/master: 7aca6c754976f2813a3fcc2f5068b8fe09eb219c
15 changes: 15 additions & 0 deletions trunk/drivers/block/drbd/drbd_receiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -3004,6 +3004,7 @@ static int receive_protocol(struct drbd_tconn *tconn, struct packet_info *pi)
int p_proto, p_after_sb_0p, p_after_sb_1p, p_after_sb_2p;
int p_discard_my_data, p_two_primaries, cf;
struct net_conf *nc;
void *int_dig_in = NULL, *int_dig_vv = NULL;

p_proto = be32_to_cpu(p->protocol);
p_after_sb_0p = be32_to_cpu(p->after_sb_0p);
Expand All @@ -3026,18 +3027,32 @@ static int receive_protocol(struct drbd_tconn *tconn, struct packet_info *pi)
integrity_alg[SHARED_SECRET_MAX-1] = 0;

if (integrity_alg[0]) {
int hash_size;

tfm = crypto_alloc_hash(integrity_alg, 0, CRYPTO_ALG_ASYNC);
if (!tfm) {
conn_err(tconn, "peer data-integrity-alg %s not supported\n",
integrity_alg);
goto disconnect;
}
conn_info(tconn, "peer data-integrity-alg: %s\n", integrity_alg);

hash_size = crypto_hash_digestsize(tfm);
int_dig_in = kmalloc(hash_size, GFP_KERNEL);
int_dig_vv = kmalloc(hash_size, GFP_KERNEL);
if (!(int_dig_in && int_dig_vv)) {
crypto_free_hash(tfm);
goto disconnect;
}
}

if (tconn->peer_integrity_tfm)
crypto_free_hash(tconn->peer_integrity_tfm);
tconn->peer_integrity_tfm = tfm;
kfree(tconn->int_dig_in);
kfree(tconn->int_dig_vv);
tconn->int_dig_in = int_dig_in;
tconn->int_dig_vv = int_dig_vv;
}

clear_bit(CONN_DRY_RUN, &tconn->flags);
Expand Down

0 comments on commit 34b7d08

Please sign in to comment.