[Spice-devel] [PATCH spice-server v3 02/12] red-stream: Avoid infinite loop on sasl_encode/decode failure
Christophe Fergeau
cfergeau at redhat.com
Thu Jan 4 14:16:10 UTC 2018
On Fri, Dec 22, 2017 at 10:07:03AM +0000, Frediano Ziglio wrote:
> These functions do not set errno so is possible that errno is EAGAIN.
I would be a little bit more explicit: "errno is EAGAIN" -> "errno has a
stale value which happens to be EAGAIN"
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
> This would cause an infinite loop in functions like
> red_stream_write_all (or potentially using the event loop).
>
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
> server/red-stream.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/server/red-stream.c b/server/red-stream.c
> index f4637808c..3dbdfca82 100644
> --- a/server/red-stream.c
> +++ b/server/red-stream.c
> @@ -596,6 +596,7 @@ static ssize_t red_stream_sasl_write(RedStream *s, const void *buf, size_t nbyte
> &s->priv->sasl.encodedLength);
> if (err != SASL_OK) {
> spice_warning("sasl_encode error: %d", err);
> + errno = EIO;
> return -1;
> }
>
> @@ -657,6 +658,7 @@ static ssize_t red_stream_sasl_read(RedStream *s, uint8_t *buf, size_t nbyte)
> &decoded, &decodedlen);
> if (err != SASL_OK) {
> spice_warning("sasl_decode error: %d", err);
> + errno = EIO;
> return -1;
> }
>
> --
> 2.14.3
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20180104/fd5ef171/attachment.sig>
More information about the Spice-devel
mailing list