All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] libxc: fix leak of t_info in xc_tbuf_get_size()
@ 2016-02-12 11:08 Harmandeep Kaur
  2016-02-12 12:34 ` Wei Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Harmandeep Kaur @ 2016-02-12 11:08 UTC (permalink / raw)
  To: xen-devel
  Cc: wei.liu2, ian.campbell, stefano.stabellini, dario.faggioli,
	ian.jackson, Harmandeep Kaur

Avoid leaking the memory mapping of the trace buffer

Coverity ID 1351228

Signed-off-by: Harmandeep Kaur <write.harmandeep@gmail.com>
Reviewed-by: Dario Faggioli <dario.faggioli@citrix.com>
---
v2: call to unmapping function reduced to one from two
v3: passed correct argument sysctl.u.tbuf_op.size in 
    xenforeignmemory_unmap()
---
 tools/libxc/xc_tbuf.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/libxc/xc_tbuf.c b/tools/libxc/xc_tbuf.c
index 695939a..283fbd1 100644
--- a/tools/libxc/xc_tbuf.c
+++ b/tools/libxc/xc_tbuf.c
@@ -70,11 +70,13 @@ int xc_tbuf_get_size(xc_interface *xch, unsigned long *size)
                     sysctl.u.tbuf_op.buffer_mfn);
 
     if ( t_info == NULL || t_info->tbuf_size == 0 )
-        return -1;
+        rc = -1;
+    else
+	*size = t_info->tbuf_size;
 
-    *size = t_info->tbuf_size;
+    xenforeignmemory_unmap(xch->fmem, t_info, sysctl.u.tbuf_op.size);
 
-    return 0;
+    return rc;
 }
 
 int xc_tbuf_enable(xc_interface *xch, unsigned long pages, unsigned long *mfn,
-- 
2.5.0

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

* Re: [PATCH v3] libxc: fix leak of t_info in xc_tbuf_get_size()
  2016-02-12 11:08 [PATCH v3] libxc: fix leak of t_info in xc_tbuf_get_size() Harmandeep Kaur
@ 2016-02-12 12:34 ` Wei Liu
  2016-02-18 11:58   ` Ian Campbell
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Liu @ 2016-02-12 12:34 UTC (permalink / raw)
  To: Harmandeep Kaur
  Cc: wei.liu2, ian.campbell, stefano.stabellini, dario.faggioli,
	ian.jackson, xen-devel

On Fri, Feb 12, 2016 at 04:38:32PM +0530, Harmandeep Kaur wrote:
> Avoid leaking the memory mapping of the trace buffer
> 
> Coverity ID 1351228
> 
> Signed-off-by: Harmandeep Kaur <write.harmandeep@gmail.com>
> Reviewed-by: Dario Faggioli <dario.faggioli@citrix.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

Thanks

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

* Re: [PATCH v3] libxc: fix leak of t_info in xc_tbuf_get_size()
  2016-02-12 12:34 ` Wei Liu
@ 2016-02-18 11:58   ` Ian Campbell
  0 siblings, 0 replies; 3+ messages in thread
From: Ian Campbell @ 2016-02-18 11:58 UTC (permalink / raw)
  To: Wei Liu, Harmandeep Kaur
  Cc: xen-devel, dario.faggioli, ian.jackson, stefano.stabellini

On Fri, 2016-02-12 at 12:34 +0000, Wei Liu wrote:
> On Fri, Feb 12, 2016 at 04:38:32PM +0530, Harmandeep Kaur wrote:
> > Avoid leaking the memory mapping of the trace buffer
> > 
> > Coverity ID 1351228
> > 
> > Signed-off-by: Harmandeep Kaur <write.harmandeep@gmail.com>
> > Reviewed-by: Dario Faggioli <dario.faggioli@citrix.com>
> 
> Acked-by: Wei Liu <wei.liu2@citrix.com>

Applied, thanks.

Ian.

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

end of thread, other threads:[~2016-02-18 12:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-12 11:08 [PATCH v3] libxc: fix leak of t_info in xc_tbuf_get_size() Harmandeep Kaur
2016-02-12 12:34 ` Wei Liu
2016-02-18 11:58   ` Ian Campbell

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.