[libvirt] [PATCH] virFDStreamThread: Make sure we won't exceed @length

Martin Kletzander mkletzan at redhat.com
Mon Jun 5 14:31:06 UTC 2017


On Mon, Jun 05, 2017 at 02:53:19PM +0200, Michal Privoznik wrote:
>There's a problem with current streams after I switched them from
>iohelper to thread implementation. Previously, iohelper made sure
>not to exceed specified @length resulting in the pipe EOF
>appearing at the exact right moment (the pipe was used to tunnel
>the data from the iohelper to the daemon). Anyway, when switching
>to thread I had to write the I/O code from scratch. Whilst doing
>that I took an inspiration from the iohelper code, but since the
>usage of pipe switched to slightly different meaning, there was
>no 1:1 relationship between the codes.
>
>Moreover, after introducing VIR_FDSTREAM_MSG_TYPE_HOLE, the
>condition that should made sure we won't exceed @length was
>completely wrong.
>
>The fix is to:
>
>a) account for holes for @length
>b) cap not just data sections but holes too (if @length would be
>exceeded)
>
>For this purpose, the condition needs to be brought closer to the
>code that handles holes and data sections.
>
>Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>---
> src/util/virfdstream.c | 18 +++++++++++-------
> 1 file changed, 11 insertions(+), 7 deletions(-)
>

ACK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170605/6487fde9/attachment-0001.sig>


More information about the libvir-list mailing list