yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-rdma-use-resp.len-after-validation-in-qemu_rdma_regi.patch

0a122b
From a2aad899158f118fd8ab16531385b9fc2b48ba14 Mon Sep 17 00:00:00 2001
0a122b
Message-Id: <a2aad899158f118fd8ab16531385b9fc2b48ba14.1387382496.git.minovotn@redhat.com>
0a122b
In-Reply-To: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
0a122b
References: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
0a122b
From: Nigel Croxon <ncroxon@redhat.com>
0a122b
Date: Thu, 14 Nov 2013 22:53:03 +0100
0a122b
Subject: [PATCH 27/46] rdma: use resp.len after validation in
0a122b
 qemu_rdma_registration_stop
0a122b
0a122b
RH-Author: Nigel Croxon <ncroxon@redhat.com>
0a122b
Message-id: <1384469598-13137-28-git-send-email-ncroxon@redhat.com>
0a122b
Patchwork-id: 55716
0a122b
O-Subject: [RHEL7.0 PATCH 27/42] rdma: use resp.len after validation in qemu_rdma_registration_stop
0a122b
Bugzilla: 1011720
0a122b
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
0a122b
RH-Acked-by: Amit Shah <amit.shah@redhat.com>
0a122b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
0a122b
Bugzilla: 1011720
0a122b
https://bugzilla.redhat.com/show_bug.cgi?id=1011720
0a122b
0a122b
>From commit ID:
0a122b
commit 885e8f984ea846e79a39ddc4f066f4dd3d04b264
0a122b
Author: Isaku Yamahata <yamahata@private.email.ne.jp>
0a122b
Date:   Fri Aug 9 16:05:40 2013 -0400
0a122b
0a122b
    rdma: use resp.len after validation in qemu_rdma_registration_stop
0a122b
0a122b
    resp.len is given from remote host. So should be validated before use.
0a122b
    Otherwise memcpy can access beyond the buffer.
0a122b
0a122b
    Cc: Michael R. Hines <mrhines@us.ibm.com>
0a122b
    Reviewed-by: Orit Wasserman <owasserm@redhat.com>
0a122b
    Reviewed-by: Michael R. Hines <mrhines@us.ibm.com>
0a122b
    Signed-off-by: Isaku Yamahata <yamahata@private.email.ne.jp>
0a122b
    Signed-off-by: Michael R. Hines <mrhines@us.ibm.com>
0a122b
    Message-id: 1376078746-24948-2-git-send-email-mrhines@linux.vnet.ibm.com
0a122b
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
0a122b
---
0a122b
 migration-rdma.c |    7 +++----
0a122b
 1 files changed, 3 insertions(+), 4 deletions(-)
0a122b
0a122b
Signed-off-by: Michal Novotny <minovotn@redhat.com>
0a122b
---
0a122b
 migration-rdma.c | 7 +++----
0a122b
 1 file changed, 3 insertions(+), 4 deletions(-)
0a122b
0a122b
diff --git a/migration-rdma.c b/migration-rdma.c
0a122b
index ff0a823..1412cde 100644
0a122b
--- a/migration-rdma.c
0a122b
+++ b/migration-rdma.c
0a122b
@@ -3045,10 +3045,6 @@ static int qemu_rdma_registration_stop(QEMUFile *f, void *opaque,
0a122b
             return ret;
0a122b
         }
0a122b
 
0a122b
-        qemu_rdma_move_header(rdma, reg_result_idx, &resp);
0a122b
-        memcpy(rdma->block,
0a122b
-            rdma->wr_data[reg_result_idx].control_curr, resp.len);
0a122b
-
0a122b
         nb_remote_blocks = resp.len / sizeof(RDMARemoteBlock);
0a122b
 
0a122b
         /*
0a122b
@@ -3070,6 +3066,9 @@ static int qemu_rdma_registration_stop(QEMUFile *f, void *opaque,
0a122b
             return -EINVAL;
0a122b
         }
0a122b
 
0a122b
+        qemu_rdma_move_header(rdma, reg_result_idx, &resp);
0a122b
+        memcpy(rdma->block,
0a122b
+            rdma->wr_data[reg_result_idx].control_curr, resp.len);
0a122b
         for (i = 0; i < nb_remote_blocks; i++) {
0a122b
             network_to_remote_block(&rdma->block[i]);
0a122b
 
0a122b
-- 
0a122b
1.7.11.7
0a122b