summaryrefslogtreecommitdiff
path: root/fs/ubifs
diff options
context:
space:
mode:
authorDinghao Liu <dinghao.liu@zju.edu.cn>2021-01-05 14:03:40 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-03-04 10:26:25 +0100
commit5501892826bb8373c1cf38d3b80c65c1b29514bd (patch)
tree8b08aa6b185d7973d1eb1ad7d1cab042dc838fda /fs/ubifs
parentc4ede7571b4fc05dc1d9d799d466cc5275173082 (diff)
ubifs: Fix memleak in ubifs_init_authentication
[ Upstream commit 11b8ab3836454a2600e396f34731e491b661f9d5 ] When crypto_shash_digestsize() fails, c->hmac_tfm has not been freed before returning, which leads to memleak. Fixes: 49525e5eecca5 ("ubifs: Add helper functions for authentication support") Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn> Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/ubifs')
-rw-r--r--fs/ubifs/auth.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ubifs/auth.c b/fs/ubifs/auth.c
index b10418b5fb71..8be17a773196 100644
--- a/fs/ubifs/auth.c
+++ b/fs/ubifs/auth.c
@@ -342,7 +342,7 @@ int ubifs_init_authentication(struct ubifs_info *c)
ubifs_err(c, "hmac %s is bigger than maximum allowed hmac size (%d > %d)",
hmac_name, c->hmac_desc_len, UBIFS_HMAC_ARR_SZ);
err = -EINVAL;
- goto out_free_hash;
+ goto out_free_hmac;
}
err = crypto_shash_setkey(c->hmac_tfm, ukp->data, ukp->datalen);