libxl: Do not generate short block in libxl__datacopier_prefixdata
PATCH RESEND 1/1 libxl: Do not generate short block in libxl__datacopier_prefixdata
Quoted 1 line · Chunyan Liu
Tried the patch. It worked. Thanks.
Thanks.
IMO this patch should be considered for backporting, too.
Ian.
Quoted 1 line
From
70f4755fba5e6a39e4f8ad55aff2d21f6aa8ff21Mon Sep 17 00:00:00 2001
From: Ian Jackson <[email protected]>
Date: Tue, 3 Sep 2013 13:41:46 +0100
Subject: [PATCH] libxl: Do not generate short block in
libxl__datacopier_prefixdata
libxl__datacopier_prefixdata would prepend a deliberately short block (not just a half-full one, but one with a short buffer) to the dc->bufs queue. However, this is wrong because datacopier_readable will find it and try to continue to fill it up.
Instead, allocate a full-sized buffer.
--- tools/libxl/libxl_aoutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxl/libxl_aoutils.c +1 -1
@@ -89,7 +89,7 @@ void libxl__datacopier_prefixdata(libxl__egc *egc, libxl__datacopier_state *dc,assert (len < dc->maxsz - dc->used); - buf =libxl__zalloc (NOGC ,sizeof (*buf) -sizeof (buf->buf) + len); + buf =libxl__zalloc (NOGC ,sizeof (*buf)); buf->used = len;memcpy (buf->buf, data, len);
Signature · 1 line
1.7.10.4
Quoted 20 lines · Ian Jackson
Quoted 1 line · Chunyan Liu
Tried the patch. It worked. Thanks.
Thanks.
IMO this patch should be considered for backporting, too.
Ian.
From
70f4755fba5e6a39e4f8ad55aff2d21f6aa8ff21Mon Sep 17 00:00:00 2001
From: Ian Jackson <[email protected]>
Date: Tue, 3 Sep 2013 13:41:46 +0100
Subject: [PATCH] libxl: Do not generate short block in
libxl__datacopier_prefixdata
libxl__datacopier_prefixdatawould prepend a deliberately short block (not just a half-full one, but one with a short buffer) to thedc->bufsqueue. However, this is wrong becausedatacopier_readablewill find it and try to continue to fill it up.
Quoted 4 lines
Instead, allocate a full-sized buffer.
Signed-off-by Ian Jackson <[email protected]>Tested-by Chunyan Liu <[email protected]>
Quoted 17 lines
--- tools/libxl/libxl_aoutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/libxl/libxl_aoutils.c +1
-1@@ -89,7 +89,7 @@ void libxl__datacopier_prefixdata(libxl__egc *egc, libxl__datacopier_state *dc,assert (len < dc->maxsz - dc->used); - buf =libxl__zalloc (NOGC ,sizeof (*buf) -sizeof (buf->buf) + len); + buf =libxl__zalloc (NOGC ,sizeof (*buf)); buf->used = len;memcpy (buf->buf, data, len);
Ian Campbell writes ("Re: [PATCH RESEND] libxl: Do not generate short block in libxl__datacopier_prefixdata"):
Quoted 12 lines · Ian Jackson
Quoted 11 lines
From
70f4755fba5e6a39e4f8ad55aff2d21f6aa8ff21Mon Sep 17 00:00:00 2001
From: Ian Jackson <[email protected]>
Date: Tue, 3 Sep 2013 13:41:46 +0100
Subject: [PATCH] libxl: Do not generate short block in
libxl__datacopier_prefixdata
libxl__datacopier_prefixdatawould prepend a deliberately short block (not just a half-full one, but one with a short buffer) to thedc->bufsqueue. However, this is wrong becausedatacopier_readablewill find it and try to continue to fill it up.
Quoted 6 lines
Quoted 4 lines
Instead, allocate a full-sized buffer.
Signed-off-by Ian Jackson <[email protected]>Tested-by Chunyan Liu <[email protected]>Acked-by Ian Campbell <[email protected]>
Thanks,
I have put it on my backport list too.
Ian.
Ian Jackson writes ("Re: [PATCH RESEND] libxl: Do not generate short block in libxl__datacopier_prefixdata"):
Quoted 3 lines
Committed-by Ian Jackson <[email protected]>I have put it on my backport list too.
Now applied to 4.3, 4.2. Was not applicable to 4.1.
Ian.