]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - crypto/hmac.c
cifs: fix panic in smb2_reconnect
[linux.git] / crypto / hmac.c
index 241b1868c1d01c5730d919ee598c804e2038de75..8b2a212eb0ad412e1d8a34d178c53d6eefb71342 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Cryptographic API.
  *
@@ -8,12 +9,6 @@
  *
  * The HMAC implementation is derived from USAGI.
  * Copyright (c) 2002 Kazunori Miyazawa <miyazawa@linux-ipv6.org> / USAGI
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
  */
 
 #include <crypto/hmac.h>
@@ -157,8 +152,10 @@ static int hmac_init_tfm(struct crypto_tfm *tfm)
 
        parent->descsize = sizeof(struct shash_desc) +
                           crypto_shash_descsize(hash);
-       if (WARN_ON(parent->descsize > HASH_MAX_DESCSIZE))
+       if (WARN_ON(parent->descsize > HASH_MAX_DESCSIZE)) {
+               crypto_free_shash(hash);
                return -EINVAL;
+       }
 
        ctx->hash = hash;
        return 0;