Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1708148
| From | Baoquan He <bhe@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [V2] kexec_file: use crypto_free_shash to free memory |
| Date | 2017-08-10 04:30 +0200 |
| Message-ID | <ucLou-7NK-13@gated-at.bofh.it> (permalink) |
| References | <ucxvb-6u6-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 08/09/17 at 07:30pm, Pan Bian wrote: > 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@163.com> Makes sense to call the crypto alloc/free api in pairs. Acked-by: Baoquan He <bhe@redhat.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 > > > > _______________________________________________ > kexec mailing list > kexec@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/kexec
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[V2] kexec_file: use crypto_free_shash to free memory Pan Bian <bianpan2016@163.com> - 2017-08-09 13:40 +0200 Re: [V2] kexec_file: use crypto_free_shash to free memory Baoquan He <bhe@redhat.com> - 2017-08-10 04:30 +0200
csiph-web