[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/5] rdma: check that num_sge does not exceed MA
From: |
Yuval Shaia |
Subject: |
Re: [Qemu-devel] [PATCH 1/5] rdma: check that num_sge does not exceed MAX_SGE |
Date: |
Tue, 11 Dec 2018 16:51:54 +0200 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Tue, Dec 11, 2018 at 06:56:38PM +0530, P J P wrote:
> From: Prasad J Pandit <address@hidden>
>
> rdma back-end has scatter/gather array ibv_sge[MAX_SGE=4] set
> to have 4 elements. A guest could send a 'PvrdmaSqWqe' ring element
> with 'num_sge' set to > MAX_SGE, which may lead to OOB access issue.
> Add check to avoid it.
>
> Reported-by: Saar Amar <address@hidden>
> Signed-off-by: Prasad J Pandit <address@hidden>
> ---
> hw/rdma/rdma_backend.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/hw/rdma/rdma_backend.c b/hw/rdma/rdma_backend.c
> index d7a4bbd91f..0b3b98a94c 100644
> --- a/hw/rdma/rdma_backend.c
> +++ b/hw/rdma/rdma_backend.c
> @@ -311,8 +311,8 @@ void rdma_backend_post_send(RdmaBackendDev *backend_dev,
> }
>
> pr_dbg("num_sge=%d\n", num_sge);
> - if (!num_sge) {
> - pr_dbg("num_sge=0\n");
> + if (!num_sge || num_sge > MAX_SGE) {
> + pr_dbg("invalid num_sge=%d\n", num_sge);
> comp_handler(IBV_WC_GENERAL_ERR, VENDOR_ERR_NO_SGE, ctx);
Please use VENDOR_ERR_INV_NUM_SGE
> return;
> }
> @@ -390,8 +390,8 @@ void rdma_backend_post_recv(RdmaBackendDev *backend_dev,
> }
>
> pr_dbg("num_sge=%d\n", num_sge);
> - if (!num_sge) {
> - pr_dbg("num_sge=0\n");
> + if (!num_sge || num_sge > MAX_SGE) {
> + pr_dbg("invalid num_sge=%d\n", num_sge);
> comp_handler(IBV_WC_GENERAL_ERR, VENDOR_ERR_NO_SGE, ctx);
Ditto.
And since VENDOR_ERR_NO_SGE is no loger used it can be delete.
> return;
> }
> --
> 2.19.2
>
- [Qemu-devel] [PATCH 0/5] rdma: various issues in rdma/pvrdma backend, P J P, 2018/12/11
- [Qemu-devel] [PATCH 1/5] rdma: check that num_sge does not exceed MAX_SGE, P J P, 2018/12/11
- Re: [Qemu-devel] [PATCH 1/5] rdma: check that num_sge does not exceed MAX_SGE,
Yuval Shaia <=
- [Qemu-devel] [PATCH 2/5] pvrdma: add uar_read routine, P J P, 2018/12/11
- [Qemu-devel] [PATCH 4/5] pvrdma: release ring object in case of an error, P J P, 2018/12/11
- Re: [Qemu-devel] [PATCH 4/5] pvrdma: release ring object in case of an error, Yuval Shaia, 2018/12/11
- Re: [Qemu-devel] [PATCH 4/5] pvrdma: release ring object in case of an error, Yuval Shaia, 2018/12/11
- Re: [Qemu-devel] [PATCH 4/5] pvrdma: release ring object in case of an error, P J P, 2018/12/11
- Re: [Qemu-devel] [PATCH 4/5] pvrdma: release ring object in case of an error, P J P, 2018/12/12
- Re: [Qemu-devel] [PATCH 4/5] pvrdma: release ring object in case of an error, Yuval Shaia, 2018/12/12
- Re: [Qemu-devel] [PATCH 4/5] pvrdma: release ring object in case of an error, Yuval Shaia, 2018/12/12