crypto: brcm - Avoid double free in ahash_finup()
authorRob Rice <rob.rice@broadcom.com>
Tue, 14 Feb 2017 17:45:52 +0000 (12:45 -0500)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 15 Feb 2017 05:23:51 +0000 (13:23 +0800)
In Broadcom SPU driver, in case where incremental hash
is done in software in ahash_finup(), tmpbuf was freed
twice.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Rob Rice <rob.rice@broadcom.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/bcm/cipher.c

index a654a01ff2ba29f5e2dc5f5d1d002902e53cfee2..cc0d5b98006ea9e8f66faf08cdb33f63fd77092a 100644 (file)
@@ -2331,7 +2331,6 @@ static int ahash_finup(struct ahash_request *req)
                /* Call synchronous update */
                ret = crypto_shash_finup(ctx->shash, tmpbuf, req->nbytes,
                                         req->result);
-               kfree(tmpbuf);
        } else {
                /* Otherwise call the internal function which uses SPU hw */
                return __ahash_finup(req);