[Spice-devel] [PATCH] spicevmc: Drop unsent data on client disconnection

Victor Toso lists at victortoso.com
Wed Jan 13 03:05:17 PST 2016


Hi,

On Wed, Jan 13, 2016 at 11:55:56AM +0100, Christophe Fergeau wrote:
> For what it's worth, I'm fairly sure the smartcard code needs the same
> fix, but I'm not sure how to reproduce failures with it:

Yeah, I agree. In this case might be worth to have a debug message
before the buffer release so it can help in some unforeseen (not tested)
scenario.

Acked-by: Victor Toso <victortoso at redhat.com>

> commit 4ab65457d6c83da2c6e19f5b6fa51737085dcb51
> Author: Christophe Fergeau <cfergeau at redhat.com>
> Date:   Tue Sep 29 12:12:48 2015 +0200
>
>     smartcard: Drop unsent data on client disconnection
>
>     Similarly to the spicevmc patch, we need to drop partial channel data on
>     client disconnect, otherwise the smartcard channel may assert upon
>     reconnection.
> 
> diff --git a/server/smartcard.c b/server/smartcard.c
> index aad22aa..29d5f5f 100644
> --- a/server/smartcard.c
> +++ b/server/smartcard.c
> @@ -549,9 +549,14 @@ static void smartcard_channel_on_disconnect(RedChannelClient *rcc)
>  {
>      SmartCardChannelClient *scc = SPICE_CONTAINEROF(rcc, SmartCardChannelClient, base);
> 
> +
>      if (scc->smartcard_state) {
>          SmartCardDeviceState *st = scc->smartcard_state;
> 
> +        if (scc->write_buf) { /* msg hasn't been pushed to the guest */
> +            spice_char_device_write_buffer_release(st->chardev_st, scc->write_buf);
> +            scc->write_buf = NULL;
> +        }
>          smartcard_char_device_detach_client(scc);
>          smartcard_char_device_notify_reader_remove(st);
>      }
> 
> Christophe




More information about the Spice-devel mailing list