clear-pkgs-linux-iot-lts2018/1128-drivers-hyper_dmabuf-f...

38 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Liu Xinyun <xinyun.liu@intel.com>
Date: Tue, 23 Jul 2019 14:09:19 +0800
Subject: [PATCH] drivers/hyper_dmabuf: fix potential invalid array index
count may keep increasing if new virtio request fired on
vCPU[0,...,max_vcpu-2], at last, count is larger than max_vcpu and out
of the array bounds.
Change-Id: I6dd564c4bf7ed16ed2a5d0625a573615e835508e
Tracked-On: OAM-84155
Signed-off-by: Liu Xinyun <xinyun.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
---
.../hyper_dmabuf/virtio/hyper_dmabuf_virtio_be_drv.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/dma-buf/hyper_dmabuf/virtio/hyper_dmabuf_virtio_be_drv.c b/drivers/dma-buf/hyper_dmabuf/virtio/hyper_dmabuf_virtio_be_drv.c
index 360ced127d12..67b9c51de6de 100644
--- a/drivers/dma-buf/hyper_dmabuf/virtio/hyper_dmabuf_virtio_be_drv.c
+++ b/drivers/dma-buf/hyper_dmabuf/virtio/hyper_dmabuf_virtio_be_drv.c
@@ -194,6 +194,12 @@ static int virtio_be_handle_kick(int client_id, unsigned long *ioreqs_map)
acrn_ioreq_complete_request(
fe_info->client_id, vcpu, req);
count++;
+ if (count >= fe_info->max_vcpu) {
+ dev_warn(hy_drv_priv->dev,
+ "client %d ignore req on high vCPUs\n",
+ client_id);
+ break;
+ }
}
}
--
https://clearlinux.org