Re: [spice] server: Correctly handle and trace stream report errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey,

On Fri, Apr 15, 2016 at 04:50:42PM +0200, Francois Gouget wrote:
> We may get stream reports after the stream has been closed, and even, in
> extreme cases, after a new stream has started reusing the same stream
> id. Neither case should cause the server to crash.
> So restore dcc_handle_stream_report() to how it was before being moved
> to dcc.c.
>
> Signed-off-by: Francois Gouget <fgouget@xxxxxxxxxxxxxxx>

Looks good to me. I'll be pushing later today.
Acked-by: Victor Toso <victortoso@xxxxxxxxxx>

> ---
> 
> For the history records: the spice_return_val_if_fail() calls have been 
> introduced in 1549f751 with a partial revert in 1b6af477.
> 
>  server/dcc.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/server/dcc.c b/server/dcc.c
> index c952042..43055a1 100644
> --- a/server/dcc.c
> +++ b/server/dcc.c
> @@ -1380,15 +1380,25 @@ static int dcc_handle_stream_report(DisplayChannelClient *dcc,
>      StreamAgent *agent;
>  
>      if (report->stream_id >= NUM_STREAMS) {
> +        spice_warning("stream_report: invalid stream id %u",
> +                      report->stream_id);
>          return FALSE;
>      }
>  
>      agent = &dcc->stream_agents[report->stream_id];
>      if (!agent->mjpeg_encoder) {
> +        spice_info("stream_report: no encoder for stream id %u. "
> +                   "The stream has probably been destroyed",
> +                   report->stream_id);
>          return TRUE;
>      }
>  
> -    spice_return_val_if_fail(report->unique_id == agent->report_id, TRUE);
> +    if (report->unique_id != agent->report_id) {
> +        spice_warning("stream_report: unique id mismatch: local (%u) != msg (%u) "
> +                      "The old stream was probably replaced by a new one",
> +                      agent->report_id, report->unique_id);
> +        return TRUE;
> +    }
>  
>      mjpeg_encoder_client_stream_report(agent->mjpeg_encoder,
>                                         report->num_frames,
> -- 
> 2.8.0.rc3
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]