aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/auth.c
diff options
context:
space:
mode:
authorDinghao Liu <dinghao.liu@zju.edu.cn>2021-01-05 14:03:40 +0800
committerRichard Weinberger <richard@nod.at>2021-02-12 21:53:22 +0100
commit11b8ab3836454a2600e396f34731e491b661f9d5 (patch)
tree53a6514323a97fdc5b4e60c9be837193c3e358c2 /fs/ubifs/auth.c
parentjffs2: fix use after free in jffs2_sum_write_data() (diff)
downloadlinux-dev-11b8ab3836454a2600e396f34731e491b661f9d5.tar.xz
linux-dev-11b8ab3836454a2600e396f34731e491b661f9d5.zip
ubifs: Fix memleak in ubifs_init_authentication
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>
Diffstat (limited to 'fs/ubifs/auth.c')
-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 51a7c8c2c3f0..e564d5ff8781 100644
--- a/fs/ubifs/auth.c
+++ b/fs/ubifs/auth.c
@@ -327,7 +327,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);