All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] efi/tpm: Fix memory leak in grub_tpm1/2_log_event()
@ 2020-03-23 11:52 Tianjia Zhang
  2020-03-23 18:22 ` Javier Martinez Canillas
  0 siblings, 1 reply; 4+ messages in thread
From: Tianjia Zhang @ 2020-03-23 11:52 UTC (permalink / raw)
  To: grub-devel

The memory requested for the event is not released here,
causing memory leaks. This patch fixes this problem.

Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com>
Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
---
 grub-core/commands/efi/tpm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/grub-core/commands/efi/tpm.c b/grub-core/commands/efi/tpm.c
index 32909c192..6a6cd0d83 100644
--- a/grub-core/commands/efi/tpm.c
+++ b/grub-core/commands/efi/tpm.c
@@ -247,6 +247,7 @@ grub_tpm1_log_event (grub_efi_handle_t tpm_handle, unsigned char *buf,
   algorithm = TCG_ALG_SHA;
   status = efi_call_7 (tpm->log_extend_event, tpm, (grub_addr_t) buf, (grub_uint64_t) size,
 		       algorithm, event, &eventnum, &lastevent);
+  grub_free (event);
 
   switch (status)
     {
@@ -297,6 +298,7 @@ grub_tpm2_log_event (grub_efi_handle_t tpm_handle, unsigned char *buf,
 
   status = efi_call_5 (tpm->hash_log_extend_event, tpm, 0, (grub_addr_t) buf,
 		       (grub_uint64_t) size, event);
+  grub_free (event);
 
   switch (status)
     {
-- 
2.17.1



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

* Re: [PATCH] efi/tpm: Fix memory leak in grub_tpm1/2_log_event()
  2020-03-23 11:52 [PATCH] efi/tpm: Fix memory leak in grub_tpm1/2_log_event() Tianjia Zhang
@ 2020-03-23 18:22 ` Javier Martinez Canillas
  2020-03-25 17:35   ` Daniel Kiper
  0 siblings, 1 reply; 4+ messages in thread
From: Javier Martinez Canillas @ 2020-03-23 18:22 UTC (permalink / raw)
  To: The development of GNU GRUB, Tianjia Zhang

Hello Tianjia,

On 3/23/20 12:52 PM, Tianjia Zhang wrote:
> The memory requested for the event is not released here,
> causing memory leaks. This patch fixes this problem.
> 
> Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com>
> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

Best regards,
-- 
Javier Martinez Canillas
Software Engineer - Desktop Hardware Enablement
Red Hat



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

* Re: [PATCH] efi/tpm: Fix memory leak in grub_tpm1/2_log_event()
  2020-03-23 18:22 ` Javier Martinez Canillas
@ 2020-03-25 17:35   ` Daniel Kiper
  2020-03-31 11:34     ` Daniel Kiper
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Kiper @ 2020-03-25 17:35 UTC (permalink / raw)
  To: Javier Martinez Canillas; +Cc: The development of GNU GRUB, Tianjia Zhang

On Mon, Mar 23, 2020 at 07:22:43PM +0100, Javier Martinez Canillas wrote:
> Hello Tianjia,
>
> On 3/23/20 12:52 PM, Tianjia Zhang wrote:
> > The memory requested for the event is not released here,
> > causing memory leaks. This patch fixes this problem.
> >
> > Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com>
> > Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
> > ---
>
> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

Daniel


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

* Re: [PATCH] efi/tpm: Fix memory leak in grub_tpm1/2_log_event()
  2020-03-25 17:35   ` Daniel Kiper
@ 2020-03-31 11:34     ` Daniel Kiper
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Kiper @ 2020-03-31 11:34 UTC (permalink / raw)
  To: tianjia.zhang; +Cc: The development of GNU GRUB, javierm

On Wed, Mar 25, 2020 at 06:35:00PM +0100, Daniel Kiper wrote:
> On Mon, Mar 23, 2020 at 07:22:43PM +0100, Javier Martinez Canillas wrote:
> > Hello Tianjia,
> >
> > On 3/23/20 12:52 PM, Tianjia Zhang wrote:
> > > The memory requested for the event is not released here,
> > > causing memory leaks. This patch fixes this problem.
> > >
> > > Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com>
> > > Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
> > > ---
> >
> > Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
>
> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

I have just pushed this patch. Thanks a lot for fixing this issue.

Daniel


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

end of thread, other threads:[~2020-03-31 11:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-23 11:52 [PATCH] efi/tpm: Fix memory leak in grub_tpm1/2_log_event() Tianjia Zhang
2020-03-23 18:22 ` Javier Martinez Canillas
2020-03-25 17:35   ` Daniel Kiper
2020-03-31 11:34     ` Daniel Kiper

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.