summaryrefslogtreecommitdiffstats
path: root/server/spicevmc.c
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2012-08-14 15:42:36 +0300
committerYonit Halperin <yhalperi@redhat.com>2012-08-27 09:13:08 +0300
commit9c6a49c364699ea20d3603572fa5b829612d8914 (patch)
treee45fe05e5f7d82f84fed916af12d94efe1b756bc /server/spicevmc.c
parenta180fc5e0b1efdecc3101fbe04d9478e18a940ec (diff)
downloadspice-9c6a49c364699ea20d3603572fa5b829612d8914.tar.gz
spice-9c6a49c364699ea20d3603572fa5b829612d8914.tar.xz
spice-9c6a49c364699ea20d3603572fa5b829612d8914.zip
char_device: don't connect a migrated client if the state of the device might have changed since it was created
If reading/writing from the device have occured before migration data has arrived, the migration data might no longer be relvant, and we disconnect the client.
Diffstat (limited to 'server/spicevmc.c')
-rw-r--r--server/spicevmc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/server/spicevmc.c b/server/spicevmc.c
index 1ce3169d..b6eaa08a 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -384,8 +384,12 @@ static void spicevmc_connect(RedChannel *channel, RedClient *client,
state->rcc = rcc;
red_channel_client_ack_zero_messages_window(rcc);
- spice_char_device_client_add(state->chardev_st, client, FALSE, 0, ~0, ~0,
- red_channel_client_waits_for_migrate_data(rcc));
+ if (!spice_char_device_client_add(state->chardev_st, client, FALSE, 0, ~0, ~0,
+ red_channel_client_waits_for_migrate_data(rcc))) {
+ spice_warning("failed to add client to spicevmc");
+ red_channel_client_disconnect(rcc);
+ return;
+ }
if (sif->state) {
sif->state(sin, 1);