qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] Fix fd leak in vvfat.c and strncmp() issue in vnc.c
@ 2012-01-06 16:57 Stefan Hajnoczi
  2012-01-06 16:57 ` [Qemu-devel] [PATCH 1/2] vvfat: avoid leaking file descriptor in commit_one_file() Stefan Hajnoczi
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2012-01-06 16:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Stefan Hajnoczi

Two unrelated bugs that David Gilbert had kicking around that are easy to fix.
Let's take care of them.

Stefan Hajnoczi (2):
  vvfat: avoid leaking file descriptor in commit_one_file()
  vnc: fix no-lock-key-sync strncmp() length

 block/vvfat.c |    3 +++
 ui/vnc.c      |    2 +-
 2 files changed, 4 insertions(+), 1 deletions(-)

-- 
1.7.7.3

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

* [Qemu-devel] [PATCH 1/2] vvfat: avoid leaking file descriptor in commit_one_file()
  2012-01-06 16:57 [Qemu-devel] [PATCH 0/2] Fix fd leak in vvfat.c and strncmp() issue in vnc.c Stefan Hajnoczi
@ 2012-01-06 16:57 ` Stefan Hajnoczi
  2012-01-06 16:57 ` [Qemu-devel] [PATCH 2/2] vnc: fix no-lock-key-sync strncmp() length Stefan Hajnoczi
  2012-01-12 13:18 ` [Qemu-devel] [Qemu-trivial] [PATCH 0/2] Fix fd leak in vvfat.c and strncmp() issue in vnc.c Stefan Hajnoczi
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2012-01-06 16:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Stefan Hajnoczi

Reported-by: Dr David Alan Gilbert <davidagilbert@uk.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 block/vvfat.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/block/vvfat.c b/block/vvfat.c
index eeffc4a..9ef21dd 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -2218,6 +2218,7 @@ static int commit_one_file(BDRVVVFATState* s,
     }
     if (offset > 0) {
         if (lseek(fd, offset, SEEK_SET) != offset) {
+            close(fd);
             g_free(cluster);
             return -3;
         }
@@ -2238,11 +2239,13 @@ static int commit_one_file(BDRVVVFATState* s,
 	    (uint8_t*)cluster, (rest_size + 0x1ff) / 0x200);
 
         if (ret < 0) {
+            close(fd);
             g_free(cluster);
             return ret;
         }
 
         if (write(fd, cluster, rest_size) < 0) {
+            close(fd);
             g_free(cluster);
             return -2;
         }
-- 
1.7.7.3

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

* [Qemu-devel] [PATCH 2/2] vnc: fix no-lock-key-sync strncmp() length
  2012-01-06 16:57 [Qemu-devel] [PATCH 0/2] Fix fd leak in vvfat.c and strncmp() issue in vnc.c Stefan Hajnoczi
  2012-01-06 16:57 ` [Qemu-devel] [PATCH 1/2] vvfat: avoid leaking file descriptor in commit_one_file() Stefan Hajnoczi
@ 2012-01-06 16:57 ` Stefan Hajnoczi
  2012-01-12 13:18 ` [Qemu-devel] [Qemu-trivial] [PATCH 0/2] Fix fd leak in vvfat.c and strncmp() issue in vnc.c Stefan Hajnoczi
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2012-01-06 16:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Stefan Hajnoczi

The no-lock-key-sync option is being parsed incorrectly because of an
outdated strcmp() length value.  Use the correct length so that invalid
option names do not match.

Reported-by: Dr David Alan Gilbert <davidagilbert@uk.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 ui/vnc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ui/vnc.c b/ui/vnc.c
index 6767ada..1869a7a 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -2763,7 +2763,7 @@ int vnc_display_open(DisplayState *ds, const char *display)
             password = 1; /* Require password auth */
         } else if (strncmp(options, "reverse", 7) == 0) {
             reverse = 1;
-        } else if (strncmp(options, "no-lock-key-sync", 9) == 0) {
+        } else if (strncmp(options, "no-lock-key-sync", 16) == 0) {
             lock_key_sync = 0;
 #ifdef CONFIG_VNC_SASL
         } else if (strncmp(options, "sasl", 4) == 0) {
-- 
1.7.7.3

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

* Re: [Qemu-devel] [Qemu-trivial] [PATCH 0/2] Fix fd leak in vvfat.c and strncmp() issue in vnc.c
  2012-01-06 16:57 [Qemu-devel] [PATCH 0/2] Fix fd leak in vvfat.c and strncmp() issue in vnc.c Stefan Hajnoczi
  2012-01-06 16:57 ` [Qemu-devel] [PATCH 1/2] vvfat: avoid leaking file descriptor in commit_one_file() Stefan Hajnoczi
  2012-01-06 16:57 ` [Qemu-devel] [PATCH 2/2] vnc: fix no-lock-key-sync strncmp() length Stefan Hajnoczi
@ 2012-01-12 13:18 ` Stefan Hajnoczi
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2012-01-12 13:18 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-trivial, qemu-devel

On Fri, Jan 06, 2012 at 04:57:43PM +0000, Stefan Hajnoczi wrote:
> Two unrelated bugs that David Gilbert had kicking around that are easy to fix.
> Let's take care of them.
> 
> Stefan Hajnoczi (2):
>   vvfat: avoid leaking file descriptor in commit_one_file()
>   vnc: fix no-lock-key-sync strncmp() length
> 
>  block/vvfat.c |    3 +++
>  ui/vnc.c      |    2 +-
>  2 files changed, 4 insertions(+), 1 deletions(-)

Applied to the trivial patches tree.

Stefan

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

end of thread, other threads:[~2012-01-12 13:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-06 16:57 [Qemu-devel] [PATCH 0/2] Fix fd leak in vvfat.c and strncmp() issue in vnc.c Stefan Hajnoczi
2012-01-06 16:57 ` [Qemu-devel] [PATCH 1/2] vvfat: avoid leaking file descriptor in commit_one_file() Stefan Hajnoczi
2012-01-06 16:57 ` [Qemu-devel] [PATCH 2/2] vnc: fix no-lock-key-sync strncmp() length Stefan Hajnoczi
2012-01-12 13:18 ` [Qemu-devel] [Qemu-trivial] [PATCH 0/2] Fix fd leak in vvfat.c and strncmp() issue in vnc.c Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).