[Spice-devel] [PATCH spice-server 5/7] smartcard.c: avoid marshalling migration data with reference to a memory that might be released before send has completed

Yonit Halperin yhalperi at redhat.com
Wed Nov 21 11:42:04 PST 2012


The current solution just copy the buffer. Currently data that is read
from the guest is always copied before sending it to the client. When we
will have ref count for these buffers, we can also use it for marshalling
the migration data.
---
 server/smartcard.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/smartcard.c b/server/smartcard.c
index a7e81d5..f1e6244 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -508,7 +508,7 @@ static void smartcard_channel_send_migrate_data(RedChannelClient *rcc,
         spice_marshaller_add_uint8(m, state->reader_added);
         spice_marshaller_add_uint32(m, state->buf_used);
         m2 = spice_marshaller_get_ptr_submarshaller(m, 0);
-        spice_marshaller_add_ref(m2, state->buf, state->buf_used);
+        spice_marshaller_add(m2, state->buf, state->buf_used);
         spice_debug("reader added %d partial read size %u", state->reader_added, state->buf_used);
     }
 }
-- 
1.7.11.7



More information about the Spice-devel mailing list