diff options
author | Lars Ellenberg <lars.ellenberg@linbit.com> | 2016-06-14 00:26:39 +0200 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2016-06-14 05:43:08 +0200 |
commit | 1b57e66384e2d21150301e68078526fac5680a16 (patch) | |
tree | 3af5073c4650026854b1af1af191ac9f22ec6464 /drivers/block | |
parent | drbd: al_write_transaction: skip re-scanning of bitmap page pointer array (diff) | |
download | linux-1b57e66384e2d21150301e68078526fac5680a16.tar.xz linux-1b57e66384e2d21150301e68078526fac5680a16.zip |
drbd: correctly handle failed crypto_alloc_hash
crypto_alloc_hash returns an ERR_PTR(), not NULL.
Also reset peer_integrity_tfm to NULL, to not call crypto_free_hash()
on an errno in the cleanup path.
Reported-by: Insu Yun <wuninsu@gmail.com>
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/drbd/drbd_receiver.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 0d74602feca0..df45713dfbe8 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c @@ -3681,7 +3681,8 @@ static int receive_protocol(struct drbd_connection *connection, struct packet_in */ peer_integrity_tfm = crypto_alloc_ahash(integrity_alg, 0, CRYPTO_ALG_ASYNC); - if (!peer_integrity_tfm) { + if (IS_ERR(peer_integrity_tfm)) { + peer_integrity_tfm = NULL; drbd_err(connection, "peer data-integrity-alg %s not supported\n", integrity_alg); goto disconnect; |