Skip to content

Commit

Permalink
drbd: correctly handle failed crypto_alloc_hash
Browse files Browse the repository at this point in the history
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 <[email protected]>

Signed-off-by: Philipp Reisner <[email protected]>
Signed-off-by: Lars Ellenberg <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
lge authored and axboe committed Jun 14, 2016
1 parent 27ea1d8 commit 1b57e66
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion drivers/block/drbd/drbd_receiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion include/linux/drbd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1b57e66

Please sign in to comment.