[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1502278201-14562-1-git-send-email-bianpan2016@163.com>
Date: Wed, 9 Aug 2017 19:30:01 +0800
From: Pan Bian <bianpan2016@....com>
To: Eric Biederman <ebiederm@...ssion.com>
Cc: kexec@...ts.infradead.org, linux-kernel@...r.kernel.org,
Pan Bian <bianpan2016@....com>
Subject: [V2] kexec_file: use crypto_free_shash to free memory
In function kexec_calculate_store_digests(), kfree() is used to free
memory allocated by crypto_alloc_shash(). It is better to use function
crypto_free_shash(), which frees up tfm and any resources associated with
it. And then, the refcount of the algorithm used in crypto_alloc_shash()
is also dropped.
Signed-off-by: Pan Bian <bianpan2016@....com>
---
kernel/kexec_file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index 9f48f44..94eeb38 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -627,7 +627,7 @@ static int kexec_calculate_store_digests(struct kimage *image)
out_free_desc:
kfree(desc);
out_free_tfm:
- kfree(tfm);
+ crypto_free_shash(tfm);
out:
return ret;
}
--
1.9.1
Powered by blists - more mailing lists