cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
0a122b
From 036dba4d4b9a82507dafba8a365bf6e6bbf5b6e8 Mon Sep 17 00:00:00 2001
0a122b
Message-Id: <036dba4d4b9a82507dafba8a365bf6e6bbf5b6e8.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:04 +0100
0a122b
Subject: [PATCH 28/46] rdma: validate RDMAControlHeader::len
0a122b
0a122b
RH-Author: Nigel Croxon <ncroxon@redhat.com>
0a122b
Message-id: <1384469598-13137-29-git-send-email-ncroxon@redhat.com>
0a122b
Patchwork-id: 55709
0a122b
O-Subject: [RHEL7.0 PATCH 28/42] rdma: validate RDMAControlHeader::len
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 6f1484edadba57f2800dc04ae3527ee4b6dac7ef
0a122b
Author: Isaku Yamahata <yamahata@private.email.ne.jp>
0a122b
Date:   Fri Aug 9 16:05:41 2013 -0400
0a122b
0a122b
    rdma: validate RDMAControlHeader::len
0a122b
0a122b
    RMDAControlHeader::len is provided from remote, so validate it.
0a122b
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-3-git-send-email-mrhines@linux.vnet.ibm.com
0a122b
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
0a122b
---
0a122b
 migration-rdma.c |    5 +++++
0a122b
 1 files changed, 5 insertions(+), 0 deletions(-)
0a122b
0a122b
Signed-off-by: Michal Novotny <minovotn@redhat.com>
0a122b
---
0a122b
 migration-rdma.c | 5 +++++
0a122b
 1 file changed, 5 insertions(+)
0a122b
0a122b
diff --git a/migration-rdma.c b/migration-rdma.c
0a122b
index 1412cde..140d930 100644
0a122b
--- a/migration-rdma.c
0a122b
+++ b/migration-rdma.c
0a122b
@@ -1424,6 +1424,7 @@ static int qemu_rdma_post_send_control(RDMAContext *rdma, uint8_t *buf,
0a122b
      * The copy makes the RDMAControlHeader simpler to manipulate
0a122b
      * for the time being.
0a122b
      */
0a122b
+    assert(head->len <= RDMA_CONTROL_MAX_BUFFER - sizeof(*head));
0a122b
     memcpy(wr->control, head, sizeof(RDMAControlHeader));
0a122b
     control_to_network((void *) wr->control);
0a122b
 
0a122b
@@ -1504,6 +1505,10 @@ static int qemu_rdma_exchange_get_response(RDMAContext *rdma,
0a122b
                 control_desc[head->type], head->type, head->len);
0a122b
         return -EIO;
0a122b
     }
0a122b
+    if (head->len > RDMA_CONTROL_MAX_BUFFER - sizeof(*head)) {
0a122b
+        fprintf(stderr, "too long length: %d\n", head->len);
0a122b
+        return -EINVAL;
0a122b
+    }
0a122b
 
0a122b
     return 0;
0a122b
 }
0a122b
-- 
0a122b
1.7.11.7
0a122b