All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xenforeignmemory: fix fd leakage in error path
@ 2018-08-28 14:19 Wei Liu
  2018-08-28 14:32 ` Andrew Cooper
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Liu @ 2018-08-28 14:19 UTC (permalink / raw)
  To: Xen-devel; +Cc: Ian Jackson, Paul Durrant, Wei Liu

b49ef5d3 (xenforeignmemory: work around bug in older privcmd) added an
error path but forgot to close fd there.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libs/foreignmemory/linux.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/libs/foreignmemory/linux.c b/tools/libs/foreignmemory/linux.c
index 0368aa09f4..132875df8a 100644
--- a/tools/libs/foreignmemory/linux.c
+++ b/tools/libs/foreignmemory/linux.c
@@ -62,6 +62,7 @@ int osdep_xenforeignmemory_open(xenforeignmemory_handle *fmem)
     {
         xtl_log(fmem->logger, XTL_ERROR, -1, "xenforeignmemory",
                 "privcmd ioctl should not be implemented");
+        close(fd);
         return -1;
     }
     else
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH] xenforeignmemory: fix fd leakage in error path
  2018-08-28 14:19 [PATCH] xenforeignmemory: fix fd leakage in error path Wei Liu
@ 2018-08-28 14:32 ` Andrew Cooper
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cooper @ 2018-08-28 14:32 UTC (permalink / raw)
  To: Wei Liu, Xen-devel; +Cc: Paul Durrant, Ian Jackson

On 28/08/18 15:19, Wei Liu wrote:
> b49ef5d3 (xenforeignmemory: work around bug in older privcmd) added an
> error path but forgot to close fd there.

Spotted by Coverity.

>
> Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

end of thread, other threads:[~2018-08-28 14:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-28 14:19 [PATCH] xenforeignmemory: fix fd leakage in error path Wei Liu
2018-08-28 14:32 ` Andrew Cooper

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.