summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMarcel Apfelbaum <marcel.apfelbaum@gmail.com>2018-04-30 23:02:23 +0300
committerMarcel Apfelbaum <marcel.apfelbaum@gmail.com>2018-05-03 20:52:29 +0300
commitd18a530d8589257cd81960284df8730ef869cabe (patch)
tree1d9f1965b514dd29df1d8e370de2f8e60b068f4d
parent6c080b9ea6efbc277cfa7afc7d4f9d8cc3a9020b (diff)
downloadfocaccia-qemu-d18a530d8589257cd81960284df8730ef869cabe.tar.gz
focaccia-qemu-d18a530d8589257cd81960284df8730ef869cabe.zip
hw/rdma: Fix possible out of bounds access to port GID index
Make sure the backend GID index is less then port's
gid table length.

Signed-off-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
Message-Id: <20180430200223.4119-8-marcel.apfelbaum@gmail.com>
-rw-r--r--hw/rdma/rdma_backend.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/rdma/rdma_backend.c b/hw/rdma/rdma_backend.c
index 5c7b3d8949..e9ced6f9ef 100644
--- a/hw/rdma/rdma_backend.c
+++ b/hw/rdma/rdma_backend.c
@@ -774,7 +774,7 @@ int rdma_backend_init(RdmaBackendDev *backend_dev,
         goto out_destroy_comm_channel;
     }
 
-    if (backend_dev->backend_gid_idx > port_attr.gid_tbl_len) {
+    if (backend_dev->backend_gid_idx >= port_attr.gid_tbl_len) {
         error_setg(errp, "Invalid backend_gid_idx, should be less than %d",
                    port_attr.gid_tbl_len);
         goto out_destroy_comm_channel;