From: Matthew Daley Date: Wed, 30 Oct 2013 07:51:40 +0000 (+1300) Subject: libxc: don't ignore fd read failures when restoring a domain X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~6108 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f46fa80ec47cae30f91d51ec34450b3577d529b9;p=xen.git libxc: don't ignore fd read failures when restoring a domain Coverity-ID: 1055042 Coverity-ID: 1055043 Signed-off-by: Matthew Daley Reviewed-by: Andrew Cooper Acked-by: Ian Campbell --- diff --git a/tools/libxc/xc_domain_restore.c b/tools/libxc/xc_domain_restore.c index ecaf25deb4..80769a7f3b 100644 --- a/tools/libxc/xc_domain_restore.c +++ b/tools/libxc/xc_domain_restore.c @@ -327,7 +327,11 @@ static xen_pfn_t *load_p2m_frame_list( else if ( !strncmp(chunk_sig, "xcnt", 4) ) { *vcpuextstate = 1; - RDEXACT(io_fd, vcpuextstate_size, sizeof(*vcpuextstate_size)); + if ( RDEXACT(io_fd, vcpuextstate_size, sizeof(*vcpuextstate_size)) ) + { + PERROR("read extended vcpu state size failed"); + return NULL; + } tot_bytes -= chunk_bytes; chunk_bytes = 0; } @@ -928,14 +932,22 @@ static int pagebuf_get_one(xc_interface *xch, struct restore_ctx *ctx, case XC_SAVE_ID_TOOLSTACK: { - RDEXACT(fd, &buf->tdata.len, sizeof(buf->tdata.len)); + if ( RDEXACT(fd, &buf->tdata.len, sizeof(buf->tdata.len)) ) + { + PERROR("error read toolstack id size"); + return -1; + } buf->tdata.data = (uint8_t*) realloc(buf->tdata.data, buf->tdata.len); if ( buf->tdata.data == NULL ) { PERROR("error memory allocation"); return -1; } - RDEXACT(fd, buf->tdata.data, buf->tdata.len); + if ( RDEXACT(fd, buf->tdata.data, buf->tdata.len) ) + { + PERROR("error read toolstack id"); + return -1; + } return pagebuf_get_one(xch, ctx, buf, fd, dom); }