qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/2] Set xbzrle buffers to NULL after freeing them to avoid double free errors
@ 2014-01-07 15:50 Orit Wasserman
  2014-01-07 15:50 ` [Qemu-devel] [PATCH 2/2] Add check for cache size smaller than page size Orit Wasserman
  2014-01-14 15:25 ` [Qemu-devel] [PATCH 1/2] Set xbzrle buffers to NULL after freeing them to avoid double free errors Juan Quintela
  0 siblings, 2 replies; 4+ messages in thread
From: Orit Wasserman @ 2014-01-07 15:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Orit Wasserman, quintela

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
---
 arch_init.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch_init.c b/arch_init.c
index e0acbc5..5c55c68 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -587,6 +587,9 @@ static void migration_end(void)
         g_free(XBZRLE.current_buf);
         g_free(XBZRLE.decoded_buf);
         XBZRLE.cache = NULL;
+        XBZRLE.encoded_buf = NULL;
+        XBZRLE.current_buf = NULL;
+        XBZRLE.decoded_buf = NULL;
     }
 }
 
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 2/2] Add check for cache size smaller than page size
  2014-01-07 15:50 [Qemu-devel] [PATCH 1/2] Set xbzrle buffers to NULL after freeing them to avoid double free errors Orit Wasserman
@ 2014-01-07 15:50 ` Orit Wasserman
  2014-01-14 15:25   ` Juan Quintela
  2014-01-14 15:25 ` [Qemu-devel] [PATCH 1/2] Set xbzrle buffers to NULL after freeing them to avoid double free errors Juan Quintela
  1 sibling, 1 reply; 4+ messages in thread
From: Orit Wasserman @ 2014-01-07 15:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Orit Wasserman, quintela

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
---
 arch_init.c |  4 ++++
 migration.c | 10 +++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/arch_init.c b/arch_init.c
index 5c55c68..e52c9ba 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -176,6 +176,10 @@ static struct {
 
 int64_t xbzrle_cache_resize(int64_t new_size)
 {
+    if (new_size < TARGET_PAGE_SIZE) {
+        return -1;
+    }
+
     if (XBZRLE.cache != NULL) {
         return cache_resize(XBZRLE.cache, new_size / TARGET_PAGE_SIZE) *
             TARGET_PAGE_SIZE;
diff --git a/migration.c b/migration.c
index 2b1ab20..f28aa1d 100644
--- a/migration.c
+++ b/migration.c
@@ -455,6 +455,7 @@ void qmp_migrate_cancel(Error **errp)
 void qmp_migrate_set_cache_size(int64_t value, Error **errp)
 {
     MigrationState *s = migrate_get_current();
+    int64_t new_size; 
 
     /* Check for truncation */
     if (value != (size_t)value) {
@@ -463,8 +464,14 @@ void qmp_migrate_set_cache_size(int64_t value, Error **errp)
         return;
     }
 
-    s->xbzrle_cache_size = xbzrle_cache_resize(value);
+    new_size = xbzrle_cache_resize(value);
+    if (new_size < 0) {
+        error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cache size",
+                  "is smaller than page size");
+        return;
+    }
+
+    s->xbzrle_cache_size = new_size;
 }
 
 int64_t qmp_query_migrate_cache_size(Error **errp)
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PATCH 1/2] Set xbzrle buffers to NULL after freeing them to avoid double free errors
  2014-01-07 15:50 [Qemu-devel] [PATCH 1/2] Set xbzrle buffers to NULL after freeing them to avoid double free errors Orit Wasserman
  2014-01-07 15:50 ` [Qemu-devel] [PATCH 2/2] Add check for cache size smaller than page size Orit Wasserman
@ 2014-01-14 15:25 ` Juan Quintela
  1 sibling, 0 replies; 4+ messages in thread
From: Juan Quintela @ 2014-01-14 15:25 UTC (permalink / raw)
  To: Orit Wasserman; +Cc: pbonzini, qemu-devel

Orit Wasserman <owasserm@redhat.com> wrote:
> Signed-off-by: Orit Wasserman <owasserm@redhat.com>

Reviewed-by: Juan Quintela <quintela@redhat.com>

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

* Re: [Qemu-devel] [PATCH 2/2] Add check for cache size smaller than page size
  2014-01-07 15:50 ` [Qemu-devel] [PATCH 2/2] Add check for cache size smaller than page size Orit Wasserman
@ 2014-01-14 15:25   ` Juan Quintela
  0 siblings, 0 replies; 4+ messages in thread
From: Juan Quintela @ 2014-01-14 15:25 UTC (permalink / raw)
  To: Orit Wasserman; +Cc: pbonzini, qemu-devel

Orit Wasserman <owasserm@redhat.com> wrote:
> Signed-off-by: Orit Wasserman <owasserm@redhat.com>

Reviewed-by: Juan Quintela <quintela@redhat.com>

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

end of thread, other threads:[~2014-01-14 15:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-07 15:50 [Qemu-devel] [PATCH 1/2] Set xbzrle buffers to NULL after freeing them to avoid double free errors Orit Wasserman
2014-01-07 15:50 ` [Qemu-devel] [PATCH 2/2] Add check for cache size smaller than page size Orit Wasserman
2014-01-14 15:25   ` Juan Quintela
2014-01-14 15:25 ` [Qemu-devel] [PATCH 1/2] Set xbzrle buffers to NULL after freeing them to avoid double free errors Juan Quintela

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).