Commit 11b8ab38 authored by Dinghao Liu's avatar Dinghao Liu Committed by Richard Weinberger
Browse files

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: 49525e5e ("ubifs: Add helper functions for authentication support")
Signed-off-by: default avatarDinghao Liu <dinghao.liu@zju.edu.cn>
Reviewed-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent 19646447
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);