drbd: correctly handle failed crypto_alloc_hash
authorLars Ellenberg <lars.ellenberg@linbit.com>
Mon, 13 Jun 2016 22:26:39 +0000 (00:26 +0200)
committerJens Axboe <axboe@fb.com>
Tue, 14 Jun 2016 03:43:08 +0000 (21:43 -0600)
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>
drivers/block/drbd/drbd_receiver.c
include/linux/drbd.h

index 0d74602feca0aba24bacd1d9f0ad4c8c7fa08c2e..df45713dfbe8694772ea564976a6a6d3449bd2d1 100644 (file)
@@ -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;
index 2b26156365ecfcbc707775216ac19425b1a4cf56..002611c85318f53365f6a606b4d37e445e40f9b6 100644 (file)
@@ -51,7 +51,7 @@
 #endif
 
 extern const char *drbd_buildtag(void);
-#define REL_VERSION "8.4.6"
+#define REL_VERSION "8.4.7"
 #define API_VERSION 1
 #define PRO_VERSION_MIN 86
 #define PRO_VERSION_MAX 101