All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ubifs: Fix memleak in ubifs_init_authentication
@ 2021-01-05  6:03 ` Dinghao Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Dinghao Liu @ 2021-01-05  6:03 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Richard Weinberger, Sascha Hauer, linux-mtd, linux-kernel

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>
---
 fs/ubifs/auth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-01-05  7:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-05  6:03 [PATCH] ubifs: Fix memleak in ubifs_init_authentication Dinghao Liu
2021-01-05  6:03 ` Dinghao Liu
2021-01-05  7:57 ` Zhihao Cheng
2021-01-05  7:57   ` Zhihao Cheng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.