From patchwork Thu May 3 18:21:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcel Apfelbaum X-Patchwork-Id: 908150 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=208.118.235.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="rHmUAmGS"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40cNmF4lyZz9s02 for ; Fri, 4 May 2018 04:22:37 +1000 (AEST) Received: from localhost ([::1]:58172 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEIsF-000373-HU for incoming@patchwork.ozlabs.org; Thu, 03 May 2018 14:22:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53238) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEIqX-00023e-3B for qemu-devel@nongnu.org; Thu, 03 May 2018 14:20:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fEIqU-0008GU-JF for qemu-devel@nongnu.org; Thu, 03 May 2018 14:20:49 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:34972) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fEIqU-0008GC-CT for qemu-devel@nongnu.org; Thu, 03 May 2018 14:20:46 -0400 Received: by mail-wm0-x241.google.com with SMTP id o78-v6so511859wmg.0 for ; Thu, 03 May 2018 11:20:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3wARq2JHuhrPn5F8+/vs2t7XR95j87CYGPhla7MpRMs=; b=rHmUAmGS2xAcS/BGgf1QyXnB6nmn1HTN2lBn/RHwBRs0GFnBV2QCuhJhidALRHYgaZ S191LcWHCP53FbgfZGQXDI+WuoQvR82PrVIMl7C+Ybo7GF82PWq317X5cC2npyTc3c4u jT/OOOKFavLavLxFIfiu77bZL87SVQLq/75/Vf+HCuw/fOuNogsIMXueGEl4FTbGsiVT YStpE9ugR/W0JY84K2FdeKjBeiu7U2CanW1Q4tizbmCX9xy0qWDTKboofU4TgLAGV3jQ Cc28BjRQtYZ04n1SZeRtMW5OJ2umGkZ6nbzg/zIZbquc3O8ZNKHaPww8GH8lp412zN8a SKXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3wARq2JHuhrPn5F8+/vs2t7XR95j87CYGPhla7MpRMs=; b=DfZBTBxjfintfY/nX3zHFXpbNOWRBLdmDItRWZdIvjKtP6ZZrPBFZoxkY4Pv43wMhr L1gm9lOMO0PoDz0eEPysL6X35PPkhynFfcp4AZSLca7QpW+HhmMbfkaARkNm43myFawt noJewKgQmwDog7kNML9Z7M29VKcQuQQJpU5mIiQRfc7Cbug7GRljaX6j6XBB5QpWWQrq fRYLB8dtlD5Nv1GwlLEqLwYzUlEhvFpuQY10aqJSrpNty8WtyLcLVRF5T7PEorz/SpGp D6eu9GDSMGbZLkbH2Rdlwy0V+vvYdQDqvR8pzfhUaUY38kcZAaGzuF9l3r8Nc6oL6A7l leWw== X-Gm-Message-State: ALQs6tAYx41m1fWFt+KL7yuTkDQ1eFZeFSjnw+N/igp9NnD85HoCGawU xrzM1QMwdw4PsgLZ5S3EwYPuLg== X-Google-Smtp-Source: AB8JxZq0t9NwNsZbsaAJyU7EoIV8hfaJ1noCFZKWv9L1sAzDD4snhV6GGdGHJ4I240Yzjje4LwYpoQ== X-Received: by 10.28.212.210 with SMTP id l201mr14674933wmg.98.1525371645105; Thu, 03 May 2018 11:20:45 -0700 (PDT) Received: from localhost.localdomain ([176.228.154.53]) by smtp.gmail.com with ESMTPSA id w40-v6sm24388801wrc.69.2018.05.03.11.20.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 May 2018 11:20:44 -0700 (PDT) From: Marcel Apfelbaum To: qemu-devel@nongnu.org Date: Thu, 3 May 2018 21:21:18 +0300 Message-Id: <20180503182125.20310-2-marcel.apfelbaum@gmail.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180503182125.20310-1-marcel.apfelbaum@gmail.com> References: <20180503182125.20310-1-marcel.apfelbaum@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 1/8] hw/rdma: Fix possible munmap call on a NULL pointer X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, yuval.shaia@oracle.com, f4bug@amsat.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Coverity CID 1390620: we call munmap() on a NULL pointer. Reported-by: Peter Maydell Signed-off-by: Marcel Apfelbaum Reviewed-by: Yuval Shaia Message-Id: <20180430200223.4119-2-marcel.apfelbaum@gmail.com> --- hw/rdma/vmw/pvrdma_cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/rdma/vmw/pvrdma_cmd.c b/hw/rdma/vmw/pvrdma_cmd.c index 99019d8741..f9dd78cb27 100644 --- a/hw/rdma/vmw/pvrdma_cmd.c +++ b/hw/rdma/vmw/pvrdma_cmd.c @@ -232,7 +232,7 @@ static int create_mr(PVRDMADev *dev, union pvrdma_cmd_req *req, cmd->start, cmd->length, host_virt, cmd->access_flags, &resp->mr_handle, &resp->lkey, &resp->rkey); - if (!resp->hdr.err) { + if (host_virt && !resp->hdr.err) { munmap(host_virt, cmd->length); } From patchwork Thu May 3 18:21:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Marcel Apfelbaum X-Patchwork-Id: 908154 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=208.118.235.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ff/npLlA"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40cNqQ6z4Vz9rvt for ; Fri, 4 May 2018 04:25:22 +1000 (AEST) Received: from localhost ([::1]:58185 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEIuu-0005fG-M6 for incoming@patchwork.ozlabs.org; Thu, 03 May 2018 14:25:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53241) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEIqX-00023h-3w for qemu-devel@nongnu.org; Thu, 03 May 2018 14:20:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fEIqW-0008H3-2o for qemu-devel@nongnu.org; Thu, 03 May 2018 14:20:49 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:54103) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fEIqV-0008Go-S2 for qemu-devel@nongnu.org; Thu, 03 May 2018 14:20:48 -0400 Received: by mail-wm0-x241.google.com with SMTP id a67so440357wmf.3 for ; Thu, 03 May 2018 11:20:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=63TX3fZ7/Vg6SpCpbqc13PYWeelerkpZ2VhP7YDRphM=; b=ff/npLlAJzO/YAqQxZU3kZmjdEHE8cCyI9doIgisXKl6H+AqY7qGnwXewdL5+3ArPu ZuSmAbS4x7a0KIV0YlZnksgY4YyHD7YzOw5aH8l5NyNJUev0ovnJ8e3XsPpOnKx4piqX DwGV6I1VkjpoRE7sYSKcAD5zhQRN5MHNnPoPRzIlndeEpj2dowPTG9hzOxFK2wX9G1uU t+ToSNsCnV2Cr6kyW3IIndYzzE48XKDy33RPEBHFQUw1+HQe8Dx+nZyre2XJDpMmYYHE /B2mcB1Tj0vGbg/ZqPm/TLZZEL1YcmMu7KtMxkqqLobYx7ZpBX9NLxiJduScmzN9GtsY kRIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=63TX3fZ7/Vg6SpCpbqc13PYWeelerkpZ2VhP7YDRphM=; b=KhGLlWJCuHmy7euwiqqMACDYotX5LHR37j52BsALO5OABYzJqQrIA9McnGUiFdAIFt sEzcrsVHbhbgWx8KvgGSTcD8wN9yC1+AF+QoVHolqU5XK3eREcTxETfGVPM2+VSHaRrZ DogLw0G87CNWrF6NpYgXERZoxI/90sMXSk0VJTS87NiiUSH7u5JIAq1fufdfJ9m5JsLy eYzOIIcos6RCp4tVG+/iIlxSAMEdGs8hvs4gZgPdr5hNWmiv1xypdoD0FXDb4uZqaE/4 hSbL+4tzEl9KEWqzBX5tlk4ht/7ekZNUK2m9sR5uHNhQm0ZHjW+e69O4l1g1EUKmKsoC Rggw== X-Gm-Message-State: ALQs6tBu/KxhCG+/8csLMOyQs4rlA8p3aCN2iuiDxHutyVrtRmNxPtSh Vc4qiigyitR8474Wv1MzBQV7ng== X-Google-Smtp-Source: AB8JxZrdL0jhd1A0xhHKG71mkh8+PO2QVahnw4FL0f70ijsNkpisp0Vl+YhSuMOYQjOCX2YxlKCPDw== X-Received: by 10.28.118.9 with SMTP id r9mr17540193wmc.111.1525371646600; Thu, 03 May 2018 11:20:46 -0700 (PDT) Received: from localhost.localdomain ([176.228.154.53]) by smtp.gmail.com with ESMTPSA id w40-v6sm24388801wrc.69.2018.05.03.11.20.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 May 2018 11:20:46 -0700 (PDT) From: Marcel Apfelbaum To: qemu-devel@nongnu.org Date: Thu, 3 May 2018 21:21:19 +0300 Message-Id: <20180503182125.20310-3-marcel.apfelbaum@gmail.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180503182125.20310-1-marcel.apfelbaum@gmail.com> References: <20180503182125.20310-1-marcel.apfelbaum@gmail.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 2/8] hw/rdma: Fix possible usage of a NULL pointer X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, yuval.shaia@oracle.com, f4bug@amsat.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Coverity CID 1390586; The cq handle is provided by the guest and cannot be trusted to be previuosly allocated. Fix it by exiting the completion flow. Reported-by: Peter Maydell Signed-off-by: Marcel Apfelbaum Reviewed-by: Yuval Shaia Message-Id: <20180430200223.4119-3-marcel.apfelbaum@gmail.com> Reviewed-by: Philippe Mathieu-Daudé --- hw/rdma/vmw/pvrdma_qp_ops.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/rdma/vmw/pvrdma_qp_ops.c b/hw/rdma/vmw/pvrdma_qp_ops.c index 750ade6c31..99bb51111e 100644 --- a/hw/rdma/vmw/pvrdma_qp_ops.c +++ b/hw/rdma/vmw/pvrdma_qp_ops.c @@ -216,6 +216,7 @@ void pvrdma_cq_poll(RdmaDeviceResources *dev_res, uint32_t cq_handle) cq = rdma_rm_get_cq(dev_res, cq_handle); if (!cq) { pr_dbg("Invalid CQ# %d\n", cq_handle); + return; } rdma_backend_poll_cq(dev_res, &cq->backend_cq); From patchwork Thu May 3 18:21:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcel Apfelbaum X-Patchwork-Id: 908156 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=208.118.235.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="k2BIosRZ"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40cNtD3WRXz9s02 for ; Fri, 4 May 2018 04:27:48 +1000 (AEST) Received: from localhost ([::1]:58208 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEIxG-0008Op-6Y for incoming@patchwork.ozlabs.org; Thu, 03 May 2018 14:27:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53263) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEIqY-00024k-Ad for qemu-devel@nongnu.org; Thu, 03 May 2018 14:20:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fEIqX-0008I1-IB for qemu-devel@nongnu.org; Thu, 03 May 2018 14:20:50 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:37978) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fEIqX-0008HN-AL for qemu-devel@nongnu.org; Thu, 03 May 2018 14:20:49 -0400 Received: by mail-wm0-x241.google.com with SMTP id i3-v6so480003wmf.3 for ; Thu, 03 May 2018 11:20:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Fx6ht28VSOW1ci8efiZ0T7GyjEoNDlAEZ+SDrJX4+Ik=; b=k2BIosRZtGDnfIo4PmsJKshkfayodEblfI7RMmgSgaz+WzbvHVaazdwHZ3Yu8MewF+ Z0gm2S/oOxRslF+xHG31LBqSBN6CjXQHrb9yZwcql842Rd2vaOMY1X7foXnvHZ+E9lRQ J0izPzk9QkuJEBNEe52ewL73tTacnFo7c0EYZwDbQBlXY/Dv777TIKhUdZlXEyQJQhoK 1S9AWozlddH/o+57aZLy/AVVyRgquNHBTb6eOCvjD3RCj9wfccGwRld6NIgWBZQJMkpT E9zHbT7bCWtcypLrGjPps5J2YI2iSgT6ajBlYXi9GBxSQ5dT//xipp4uRZD7Td4DIsCb ycKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Fx6ht28VSOW1ci8efiZ0T7GyjEoNDlAEZ+SDrJX4+Ik=; b=tPUWCj1oEYdRK9gMo4cMhUd5FucQK+ec6SFGoQDWhEtJJSs672+i4+1gPsulILhzKb 7HWyCVGgpz1DK5LqcMZbGvqYuoy3lp9QLlz2mZzgvUKdui+t2c8gtoM3vT9DtIvBMjXv mG4N8ij+AbUEv4qDUQkZzpMrlkk9Ge41QcBB7LlWul95RRFR2sIzLMJs2ZhXKNjxfmzd P+MAZbjjy9C5jklf918Drm5MC+Z+GhuYQ2D+GzfzOyE00Wna7TFNnaRZmb/+St0xCYe0 9d0R/tItGomf2ZVCOzmbemjvmp9vuHT/X6RzQC2/DQTy6DlIX6XTyn9+JtpghCbYf2Sx T8fw== X-Gm-Message-State: ALQs6tCDEfsdF+Nqn0ZLhNfeR40TSy4EtvvfFC3M+UI4yMLJCK7atL6j J8KBzHc7IDHrXxmPF4PBQFQbCg== X-Google-Smtp-Source: AB8JxZqn0tRL2N5k8NuBUAs7vZ0nEd/AVhirDchl4tCOQO8fcxqipJFJ3m255XjoZ4cA/OP4pR0kQQ== X-Received: by 10.28.139.136 with SMTP id n130mr15099639wmd.8.1525371648099; Thu, 03 May 2018 11:20:48 -0700 (PDT) Received: from localhost.localdomain ([176.228.154.53]) by smtp.gmail.com with ESMTPSA id w40-v6sm24388801wrc.69.2018.05.03.11.20.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 May 2018 11:20:47 -0700 (PDT) From: Marcel Apfelbaum To: qemu-devel@nongnu.org Date: Thu, 3 May 2018 21:21:20 +0300 Message-Id: <20180503182125.20310-4-marcel.apfelbaum@gmail.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180503182125.20310-1-marcel.apfelbaum@gmail.com> References: <20180503182125.20310-1-marcel.apfelbaum@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 3/8] hw/rdma: Delete port's pkey table X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, yuval.shaia@oracle.com, f4bug@amsat.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Yuval Shaia Support for PKEY is not yet implemented. Removing the unneeded table until a support will be added. Signed-off-by: Yuval Shaia Reviewed-by: Marcel Apfelbaum Message-Id: <20180430200223.4119-4-marcel.apfelbaum@gmail.com> --- hw/rdma/rdma_rm_defs.h | 3 +-- hw/rdma/vmw/pvrdma_main.c | 15 --------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/hw/rdma/rdma_rm_defs.h b/hw/rdma/rdma_rm_defs.h index fc646da61f..45503f14e0 100644 --- a/hw/rdma/rdma_rm_defs.h +++ b/hw/rdma/rdma_rm_defs.h @@ -21,7 +21,7 @@ #define MAX_PORTS 1 #define MAX_PORT_GIDS 1 #define MAX_PORT_PKEYS 1 -#define MAX_PKEYS 1 +#define MAX_PKEYS MAX_PORT_PKEYS #define MAX_GIDS 2048 #define MAX_UCS 512 #define MAX_MR_SIZE (1UL << 27) @@ -87,7 +87,6 @@ typedef struct RdmaRmQP { typedef struct RdmaRmPort { union ibv_gid gid_tbl[MAX_PORT_GIDS]; enum ibv_port_state state; - int *pkey_tbl; /* TODO: Not yet supported */ } RdmaRmPort; typedef struct RdmaDeviceResources { diff --git a/hw/rdma/vmw/pvrdma_main.c b/hw/rdma/vmw/pvrdma_main.c index c552248c90..994220b58e 100644 --- a/hw/rdma/vmw/pvrdma_main.c +++ b/hw/rdma/vmw/pvrdma_main.c @@ -275,15 +275,6 @@ static void init_dsr_dev_caps(PVRDMADev *dev) pr_dbg("Initialized\n"); } -static void free_ports(PVRDMADev *dev) -{ - int i; - - for (i = 0; i < MAX_PORTS; i++) { - g_free(dev->rdma_dev_res.ports[i].gid_tbl); - } -} - static void init_ports(PVRDMADev *dev, Error **errp) { int i; @@ -292,10 +283,6 @@ static void init_ports(PVRDMADev *dev, Error **errp) for (i = 0; i < MAX_PORTS; i++) { dev->rdma_dev_res.ports[i].state = IBV_PORT_DOWN; - - dev->rdma_dev_res.ports[i].pkey_tbl = - g_malloc0(sizeof(*dev->rdma_dev_res.ports[i].pkey_tbl) * - MAX_PORT_PKEYS); } } @@ -622,8 +609,6 @@ static void pvrdma_exit(PCIDevice *pdev) pvrdma_qp_ops_fini(); - free_ports(dev); - rdma_rm_fini(&dev->rdma_dev_res); rdma_backend_fini(&dev->backend_dev); From patchwork Thu May 3 18:21:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcel Apfelbaum X-Patchwork-Id: 908151 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=208.118.235.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="QZHU3RHT"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40cNnJ0BBTz9rvt for ; Fri, 4 May 2018 04:23:32 +1000 (AEST) Received: from localhost ([::1]:58176 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEIt7-0003r9-SX for incoming@patchwork.ozlabs.org; Thu, 03 May 2018 14:23:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53276) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEIqa-00026b-Co for qemu-devel@nongnu.org; Thu, 03 May 2018 14:20:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fEIqZ-0008Ik-GR for qemu-devel@nongnu.org; Thu, 03 May 2018 14:20:52 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:50515) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fEIqZ-0008IR-8r for qemu-devel@nongnu.org; Thu, 03 May 2018 14:20:51 -0400 Received: by mail-wm0-x244.google.com with SMTP id t11so472516wmt.0 for ; Thu, 03 May 2018 11:20:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Hyhu6citdCNPRYB6GhDOJAKdS0hxTnhYsC9qUIqAThI=; b=QZHU3RHTG0HlFnAK0MF3rgYJFKrq0u/Bg+07N+a0bowRRGYZRFIhLqLW9pgCKB7Rc6 /kFYGzdGfYPAALZUW0SyfrqDyjycOL62nymPjizC2ytkKYcGo1ygVkdcL+w3DXQGE7U+ wTsGc/yiCa2atDw7dyftfB1F6QF88vww5R8/uMmnfdQdl/JUY8MxX1vPFpQoMLsDqNUQ UMwVPNJ3qGCKN2vlaq12mXkBemZFeELxuoSfgaduLoQbJZxcIyvmiY5W0TUOuf7UHzz3 8aMBCFuRM+p46cf0buW1ldQ2XLdvbnx3BBRwIzlTyphKcGovW+5PJA91TppjfeZxYsF3 6ReA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Hyhu6citdCNPRYB6GhDOJAKdS0hxTnhYsC9qUIqAThI=; b=qAptOubPHB+f/7mxTxW7D0ezme6XaFJ9tC9qVjOeAIAsbfVaB2SILL68EbEdkhqrM3 BVWz7sWFmDO7c1/gvMvDzCdQ1YrvqptLQau0t2HD2P+NjDAvcFIcxWD9HjPThAaLasRQ A36SqZ02qRqmnWmIsrVHZllzrmUAewc55PxSN/7o3LzDhNrofhJAzPYnMVKbVOj1AgEz dPnn/vNXZbB3an599hSdnTiSXZH+vm+eUG+PKMI/ImMqCVPqGtNHeTp/tD0nFEJh6NY7 yEOQhj6GFy2/1QrRWRk9pxTYVy00FCOv7Lzb5l4dSPFX6ByHVGgrGIxpbizOmYD0gZ8X 6dLg== X-Gm-Message-State: ALQs6tAs2ZZrLn6/PUK6lpq8Y8MSAGE729nB143KsQSiaTLhrTiIfjIs Gjb53+yQquCu0DBvAokEEk4IBw== X-Google-Smtp-Source: AB8JxZpXMUVo/s2hNQE4O7jX6SAJjKbWCyVHJXxqSdfEhvJCsfFGqSU5RPeZM95EoDwNoiUcRZD0mA== X-Received: by 10.28.1.1 with SMTP id 1mr15943934wmb.28.1525371649846; Thu, 03 May 2018 11:20:49 -0700 (PDT) Received: from localhost.localdomain ([176.228.154.53]) by smtp.gmail.com with ESMTPSA id w40-v6sm24388801wrc.69.2018.05.03.11.20.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 May 2018 11:20:48 -0700 (PDT) From: Marcel Apfelbaum To: qemu-devel@nongnu.org Date: Thu, 3 May 2018 21:21:21 +0300 Message-Id: <20180503182125.20310-5-marcel.apfelbaum@gmail.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180503182125.20310-1-marcel.apfelbaum@gmail.com> References: <20180503182125.20310-1-marcel.apfelbaum@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 4/8] hw/rdma: Fix possible out of bounds access to GID table X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, yuval.shaia@oracle.com, f4bug@amsat.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Yuval Shaia Array size is MAX_PORT_GIDS, let's make sure the given index is in range. While there limit device table size to 1. Reported-by: Peter Maydell Signed-off-by: Yuval Shaia Reviewed-by: Marcel Apfelbaum Message-Id: <20180430200223.4119-5-marcel.apfelbaum@gmail.com> --- hw/rdma/rdma_rm_defs.h | 2 +- hw/rdma/vmw/pvrdma_cmd.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/rdma/rdma_rm_defs.h b/hw/rdma/rdma_rm_defs.h index 45503f14e0..4d22a20e4c 100644 --- a/hw/rdma/rdma_rm_defs.h +++ b/hw/rdma/rdma_rm_defs.h @@ -20,9 +20,9 @@ #define MAX_PORTS 1 #define MAX_PORT_GIDS 1 +#define MAX_GIDS MAX_PORT_GIDS #define MAX_PORT_PKEYS 1 #define MAX_PKEYS MAX_PORT_PKEYS -#define MAX_GIDS 2048 #define MAX_UCS 512 #define MAX_MR_SIZE (1UL << 27) #define MAX_QP 1024 diff --git a/hw/rdma/vmw/pvrdma_cmd.c b/hw/rdma/vmw/pvrdma_cmd.c index f9dd78cb27..14255d609f 100644 --- a/hw/rdma/vmw/pvrdma_cmd.c +++ b/hw/rdma/vmw/pvrdma_cmd.c @@ -576,7 +576,7 @@ static int create_bind(PVRDMADev *dev, union pvrdma_cmd_req *req, pr_dbg("index=%d\n", cmd->index); - if (cmd->index > MAX_PORT_GIDS) { + if (cmd->index >= MAX_PORT_GIDS) { return -EINVAL; } @@ -603,7 +603,11 @@ static int destroy_bind(PVRDMADev *dev, union pvrdma_cmd_req *req, { struct pvrdma_cmd_destroy_bind *cmd = &req->destroy_bind; - pr_dbg("clear index %d\n", cmd->index); + pr_dbg("index=%d\n", cmd->index); + + if (cmd->index >= MAX_PORT_GIDS) { + return -EINVAL; + } memset(dev->rdma_dev_res.ports[0].gid_tbl[cmd->index].raw, 0, sizeof(dev->rdma_dev_res.ports[0].gid_tbl[cmd->index].raw)); From patchwork Thu May 3 18:21:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcel Apfelbaum X-Patchwork-Id: 908149 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=208.118.235.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="f969otJ3"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40cNlK4RGMz9rvt for ; Fri, 4 May 2018 04:21:49 +1000 (AEST) Received: from localhost ([::1]:58168 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEIrT-0002Aq-DC for incoming@patchwork.ozlabs.org; Thu, 03 May 2018 14:21:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEIqb-00028D-PV for qemu-devel@nongnu.org; Thu, 03 May 2018 14:20:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fEIqa-0008JJ-Pb for qemu-devel@nongnu.org; Thu, 03 May 2018 14:20:53 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:55292) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fEIqa-0008Iu-Iz for qemu-devel@nongnu.org; Thu, 03 May 2018 14:20:52 -0400 Received: by mail-wm0-x243.google.com with SMTP id f6so431202wmc.4 for ; Thu, 03 May 2018 11:20:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nl42Fpgf0JP+jqqL0RsIBabn/rZBnrruv2uDA+OsVIw=; b=f969otJ39OTjl7RRfwkeEE8FVMZ4y6ppzIxlH71l+Z/XNy7iFAW0CVRPvUnopjf7YF N/uYQYRJtVTn633jpVjmIFAxsjtK+DwdbXQK3/69nqCQmsH7/8CpnQy5tIwGmI2EyGQ3 j+O8Dr1+ZNLlwlGp/2jGMhkqJFR+A0CR3v80nx3+7xSfyZ4141tbNMdVRmd4mHBU/ZwM kXhLWFifk99DS6oEUb9Fate7acsNZvXmEaobbTw7mepTmwXYhddB0e/AbqhXfhCfLkRx cqSf7k2aXTWDZTpjC9dthGbCQjUzzS9SrzE95SXxcr75a0a/6T14Wc4ZLCQgN9b76QbZ XreQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nl42Fpgf0JP+jqqL0RsIBabn/rZBnrruv2uDA+OsVIw=; b=C4g7Poy9WkE9pKypxN+CG4fqj5tRim7r/OrqwgoC+qkAUA05nO2BauL4A4w12Xp40X tKwrrFAUUvKQWtKJd+88tvfHAKwJl4Op3QIBpciHx0y8k6qtUCk+YP4dGe+oR73ZJJmh a/QTFCnQ7wynk2wlBvy/St4jOxl3c6mr4a7miE4KrtPITth1lr9a0gry3iAd0RiQDON7 TQZX5JpeYEvzXnISNWJHubpBxfB4oZcVnXIws9p5zBFcGBEGtDmgSfBmnMcAtOVEWCoX Fx0W/FftICsAC2vUzZOEoYSkkEI17IHxthyksW/BV40+BUhMlmO9PPG1ncdXjRmJL2jU HvlA== X-Gm-Message-State: ALQs6tDpqhwo/X2cBdJ/qDNYERr35uo9m/dAHtVMnkZ4OfDj9/QN7h0G Dt9ZjdO6p9H3n8zom5A0gWMB9w== X-Google-Smtp-Source: AB8JxZrrl1sgOAEWcWJWaASshn7ycrwfH2m1UnilI6P0kdAreA2D2L9zgckdYkdnFr8Hq9SyKhUS4g== X-Received: by 10.28.132.68 with SMTP id g65mr17760474wmd.114.1525371651343; Thu, 03 May 2018 11:20:51 -0700 (PDT) Received: from localhost.localdomain ([176.228.154.53]) by smtp.gmail.com with ESMTPSA id w40-v6sm24388801wrc.69.2018.05.03.11.20.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 May 2018 11:20:50 -0700 (PDT) From: Marcel Apfelbaum To: qemu-devel@nongnu.org Date: Thu, 3 May 2018 21:21:22 +0300 Message-Id: <20180503182125.20310-6-marcel.apfelbaum@gmail.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180503182125.20310-1-marcel.apfelbaum@gmail.com> References: <20180503182125.20310-1-marcel.apfelbaum@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PULL 5/8] hw/rdma: Fix possible out of bounds access to regs array X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, yuval.shaia@oracle.com, f4bug@amsat.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Yuval Shaia Coverity (CID1390589, CID1390608). Array size is RDMA_BAR1_REGS_SIZE, let's make sure the given address is in range. While there also: 1. Adjust the size of this bar to reasonable size 2. Report the size of the array with sizeof(array) Reported-by: Peter Maydell Signed-off-by: Yuval Shaia Reviewed-by: Marcel Apfelbaum Message-Id: <20180430200223.4119-6-marcel.apfelbaum@gmail.com> --- hw/rdma/vmw/pvrdma.h | 6 +++--- hw/rdma/vmw/pvrdma_main.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/rdma/vmw/pvrdma.h b/hw/rdma/vmw/pvrdma.h index 8c173cb824..0b46dc5a9b 100644 --- a/hw/rdma/vmw/pvrdma.h +++ b/hw/rdma/vmw/pvrdma.h @@ -31,7 +31,7 @@ #define RDMA_REG_BAR_IDX 1 #define RDMA_UAR_BAR_IDX 2 #define RDMA_BAR0_MSIX_SIZE (16 * 1024) -#define RDMA_BAR1_REGS_SIZE 256 +#define RDMA_BAR1_REGS_SIZE 64 #define RDMA_BAR2_UAR_SIZE (0x1000 * MAX_UCS) /* each uc gets page */ /* MSIX */ @@ -86,7 +86,7 @@ static inline int get_reg_val(PVRDMADev *dev, hwaddr addr, uint32_t *val) { int idx = addr >> 2; - if (idx > RDMA_BAR1_REGS_SIZE) { + if (idx >= RDMA_BAR1_REGS_SIZE) { return -EINVAL; } @@ -99,7 +99,7 @@ static inline int set_reg_val(PVRDMADev *dev, hwaddr addr, uint32_t val) { int idx = addr >> 2; - if (idx > RDMA_BAR1_REGS_SIZE) { + if (idx >= RDMA_BAR1_REGS_SIZE) { return -EINVAL; } diff --git a/hw/rdma/vmw/pvrdma_main.c b/hw/rdma/vmw/pvrdma_main.c index 994220b58e..3ed7409763 100644 --- a/hw/rdma/vmw/pvrdma_main.c +++ b/hw/rdma/vmw/pvrdma_main.c @@ -449,14 +449,14 @@ static void init_bars(PCIDevice *pdev) /* BAR 1 - Registers */ memset(&dev->regs_data, 0, sizeof(dev->regs_data)); memory_region_init_io(&dev->regs, OBJECT(dev), ®s_ops, dev, - "pvrdma-regs", RDMA_BAR1_REGS_SIZE); + "pvrdma-regs", sizeof(dev->regs_data)); pci_register_bar(pdev, RDMA_REG_BAR_IDX, PCI_BASE_ADDRESS_SPACE_MEMORY, &dev->regs); /* BAR 2 - UAR */ memset(&dev->uar_data, 0, sizeof(dev->uar_data)); memory_region_init_io(&dev->uar, OBJECT(dev), &uar_ops, dev, "rdma-uar", - RDMA_BAR2_UAR_SIZE); + sizeof(dev->uar_data)); pci_register_bar(pdev, RDMA_UAR_BAR_IDX, PCI_BASE_ADDRESS_SPACE_MEMORY, &dev->uar); } From patchwork Thu May 3 18:21:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcel Apfelbaum X-Patchwork-Id: 908155 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=208.118.235.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="TYDT0z9S"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40cNrM6ZFMz9rvt for ; Fri, 4 May 2018 04:26:11 +1000 (AEST) Received: from localhost ([::1]:58195 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEIvh-0006si-Ln for incoming@patchwork.ozlabs.org; Thu, 03 May 2018 14:26:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53308) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEIqd-00029P-1J for qemu-devel@nongnu.org; Thu, 03 May 2018 14:20:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fEIqc-0008K2-2H for qemu-devel@nongnu.org; Thu, 03 May 2018 14:20:55 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:39811) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fEIqb-0008JV-Rp for qemu-devel@nongnu.org; Thu, 03 May 2018 14:20:53 -0400 Received: by mail-wm0-x244.google.com with SMTP id f8-v6so469694wmc.4 for ; Thu, 03 May 2018 11:20:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sCFF3rFPBrRd4RDgTTRV2ADNLvWEp2hUd2JKxDg/m8o=; b=TYDT0z9SXJFEu1Tyl3Oq6VpycGLKojxSjcnmVLTiAAzr/xOtW6651zGJJ41Il52UqN 3L5ndh0/Cx2wbVnyJ1tl5KwzfWInBukzSvOZ2nLOPvgH697lPg+WUWj7jj0TORmtqQcH 6bDBnw9UIIUPHVxN2JvnmBPrdbyFlfWd/N5Mn63k5LZ1rlfFJcu07wzdtS3+1cNGZlG1 HDuVRmXZY5mAmMsyMQPdfHCtm3/ca2AyR6hO7kZx0NiH0h3TibpbRk02qNZfgeBnKanj Xlw9dbBZ8nGdzYc9lSMYVT5/C82avvkr4uUHtW5O0nBqIdAL5p5ks0W1zA8GauCo62Kv /Jdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sCFF3rFPBrRd4RDgTTRV2ADNLvWEp2hUd2JKxDg/m8o=; b=d88K5dt26XMJp9+t+JXkpi/2Qmhz5FjvZGRhsecpveNyq6cEjDwFoZxxbIxd6qaTng fvRLviXLpARwMX/AiutfrfN9C52Z8YCKY+iM5b8FaZ4m+KbPfwowkVi7inVr4+YzUT2G ZKV/fE+Q0pyt4VLGwiB1ppV9jHU2PFABUUfj11cgoKNQpO9155rSZSOnKlq0O1TtXWp4 NdPWAUI186dQo4t1LCPB4fWtFsywW5VYaUwsP5zbZuMvnL7oNiU6Z2xvmOuvF65LpcHc LVLK51EVNwJJuscLw2adHWjmBMAuj7CqCTQnN/VrvlUHcnY9sJJSvSywjSwfMBJCqSU0 MLOA== X-Gm-Message-State: ALQs6tARCdPnZuGJGdFDZY/GjsLXi2oEo4rm+2wdLrkmpcxsM4grccmN sucX71FauUqUdFU1RJmqfoly7A== X-Google-Smtp-Source: AB8JxZoFSMO+dJZ3k41rnnfzg6DmqD8yFnRA9LXAEwJap7bNO8XVC+Vc32ijCQpeSMH6/YTdZ0u4Cw== X-Received: by 10.28.113.220 with SMTP id d89mr15286364wmi.26.1525371652658; Thu, 03 May 2018 11:20:52 -0700 (PDT) Received: from localhost.localdomain ([176.228.154.53]) by smtp.gmail.com with ESMTPSA id w40-v6sm24388801wrc.69.2018.05.03.11.20.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 May 2018 11:20:52 -0700 (PDT) From: Marcel Apfelbaum To: qemu-devel@nongnu.org Date: Thu, 3 May 2018 21:21:23 +0300 Message-Id: <20180503182125.20310-7-marcel.apfelbaum@gmail.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180503182125.20310-1-marcel.apfelbaum@gmail.com> References: <20180503182125.20310-1-marcel.apfelbaum@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 6/8] hw/rdma: Delete duplicate definition of MAX_RM_TBL_NAME X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, yuval.shaia@oracle.com, f4bug@amsat.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Yuval Shaia By a mistake this constant was defined twice - remove the duplication. Signed-off-by: Yuval Shaia Reviewed-by: Marcel Apfelbaum Message-Id: <20180430200223.4119-7-marcel.apfelbaum@gmail.com> --- hw/rdma/rdma_rm.c | 2 -- hw/rdma/rdma_rm_defs.h | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/rdma/rdma_rm.c b/hw/rdma/rdma_rm.c index 51a47d7292..415da15efe 100644 --- a/hw/rdma/rdma_rm.c +++ b/hw/rdma/rdma_rm.c @@ -21,8 +21,6 @@ #include "rdma_backend.h" #include "rdma_rm.h" -#define MAX_RM_TBL_NAME 16 - /* Page directory and page tables */ #define PG_DIR_SZ { TARGET_PAGE_SIZE / sizeof(__u64) } #define PG_TBL_SZ { TARGET_PAGE_SIZE / sizeof(__u64) } diff --git a/hw/rdma/rdma_rm_defs.h b/hw/rdma/rdma_rm_defs.h index 4d22a20e4c..226011176d 100644 --- a/hw/rdma/rdma_rm_defs.h +++ b/hw/rdma/rdma_rm_defs.h @@ -34,9 +34,9 @@ #define MAX_QP_INIT_RD_ATOM 16 #define MAX_AH 64 -#define MAX_RMRESTBL_NAME_SZ 16 +#define MAX_RM_TBL_NAME 16 typedef struct RdmaRmResTbl { - char name[MAX_RMRESTBL_NAME_SZ]; + char name[MAX_RM_TBL_NAME]; QemuMutex lock; unsigned long *bitmap; size_t tbl_sz; From patchwork Thu May 3 18:21:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcel Apfelbaum X-Patchwork-Id: 908152 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=208.118.235.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="SnULPjzq"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40cNpT1Lhdz9rvt for ; Fri, 4 May 2018 04:24:33 +1000 (AEST) Received: from localhost ([::1]:58180 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEIu6-0004j3-VO for incoming@patchwork.ozlabs.org; Thu, 03 May 2018 14:24:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53342) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEIqg-0002Cd-Ay for qemu-devel@nongnu.org; Thu, 03 May 2018 14:20:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fEIqd-0008KW-Dw for qemu-devel@nongnu.org; Thu, 03 May 2018 14:20:58 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:33076) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fEIqd-0008KD-6Q for qemu-devel@nongnu.org; Thu, 03 May 2018 14:20:55 -0400 Received: by mail-wm0-x243.google.com with SMTP id x12-v6so4002739wmc.0 for ; Thu, 03 May 2018 11:20:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Ojgag965UT8BmFHQ/Il9VOxooSgGEKX3C/EHZjxN2jY=; b=SnULPjzqGzIogHLyGGuHhU6DCW8WGXVRY2tE8BfRsuGRExEeUjT7LJiMn5dEJTcJL1 9p9Gj7aBXK/pqoQq3UOAdKmW1Whi3TmIKpmS3PMkqgPLaya36VJ48e0y3R2MVdyzP1Ws Dm2wyD2fvG3rOsaCjwkuCcgtJpDN0MPfC1J/HyssLHnTKnPy6nSy63oj0cHAGiU2uAny TRyN4BiQmA8HTs3gDc6ehaR9pi3RoxVZCSqWwU2RMEGCVwewXMCRyvuTSwiSG+5B+UfD 5hcwTX/4Zyw3Ss/TRR8m+nqNie6raGGfQiYjfOicWMvxFcCjXaFrfjGB4JUwck61kYkI ak9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Ojgag965UT8BmFHQ/Il9VOxooSgGEKX3C/EHZjxN2jY=; b=j54gmOoQxAZPJre4+/6k3MurQtpFHIoF5INa2O1/Dr8M5dI/bZA6Nf35O8I+acCl+P PJQKiLZ9csT+lAZWS9K3Sj4W/ag3+TBv24rNsrk61UvNOfWJMFnR36dMUwSUmpPDzp/K u2Zr2bmKNu96cA1tjRQMMuUwOCBa4Y6GAdBFMkaJWzm445QyUipMcj+zZu/ZHYHvrYtG Jb+5niER3kb0pA3Lsw3ZIbKlE+BxQosaWWmLKIdVjJFptojYZwAsJOjaxYyCyAgHABbe GRbKRH9WqgfTsEQSwA+501V3s4BRq9sVzQ9oDQUbTZ0tOwa9yzOgRQnfoErq0RZB4mIV +JXQ== X-Gm-Message-State: ALQs6tBocMQjg5p6vQGXNDTZJD2AT/w1ZmoowIO7qkv393oh1tb6VI8X j0gWVmrKDi2MHCxr5eGUQN/3aQ== X-Google-Smtp-Source: AB8JxZpkfm7cTzwE1t38lurZ7YhXMW0dUAxOnN2CWXfLY86DDFbp2B7m8QBENjci6isGAu1Q5k8DzA== X-Received: by 10.28.113.81 with SMTP id m78mr15924242wmc.150.1525371653998; Thu, 03 May 2018 11:20:53 -0700 (PDT) Received: from localhost.localdomain ([176.228.154.53]) by smtp.gmail.com with ESMTPSA id w40-v6sm24388801wrc.69.2018.05.03.11.20.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 May 2018 11:20:53 -0700 (PDT) From: Marcel Apfelbaum To: qemu-devel@nongnu.org Date: Thu, 3 May 2018 21:21:24 +0300 Message-Id: <20180503182125.20310-8-marcel.apfelbaum@gmail.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180503182125.20310-1-marcel.apfelbaum@gmail.com> References: <20180503182125.20310-1-marcel.apfelbaum@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PULL 7/8] hw/rdma: Fix possible out of bounds access to port GID index X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, yuval.shaia@oracle.com, f4bug@amsat.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Make sure the backend GID index is less then port's gid table length. Signed-off-by: Marcel Apfelbaum Reviewed-by: Yuval Shaia Message-Id: <20180430200223.4119-8-marcel.apfelbaum@gmail.com> --- hw/rdma/rdma_backend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; From patchwork Thu May 3 18:21:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcel Apfelbaum X-Patchwork-Id: 908153 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=208.118.235.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Tp4Vp5X0"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40cNpb0MwRz9rvt for ; Fri, 4 May 2018 04:24:39 +1000 (AEST) Received: from localhost ([::1]:58182 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEIuC-0004or-Uf for incoming@patchwork.ozlabs.org; Thu, 03 May 2018 14:24:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53343) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEIqg-0002Ce-B6 for qemu-devel@nongnu.org; Thu, 03 May 2018 14:20:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fEIqf-0008LH-2v for qemu-devel@nongnu.org; Thu, 03 May 2018 14:20:58 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:39810) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fEIqe-0008L0-Rb for qemu-devel@nongnu.org; Thu, 03 May 2018 14:20:56 -0400 Received: by mail-wm0-x242.google.com with SMTP id f8-v6so469927wmc.4 for ; Thu, 03 May 2018 11:20:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ESyY6A86ITabfK9exdjzvA0vOIeagH3H8U+WF7uzAy0=; b=Tp4Vp5X0xqbTZNxdE6bvhEDgg0R6vlgv5eqxT3/4YzgM2clWsaemzdPy4vtOKSq2Zp bxDQeKnHxL3Ioy1U8JCTqGQPYfr2CvNR6vEagq2dnxsoiR83+WcSOc1chegIIDb6Zquf zCRQ7/lyN9jTqFrTQkw/Xnw52ORQfMSagm44tqTFXgg/IyAbi6mc5vZnUd7JyECCBwI/ KXEDfPGOPMTmtVBs6nBCG9uHnzm35fiNj1rXrxKCBTQ0QUpU+W44busO6491Ztlb8xjP DkrsYHb+rlokJieC6hmw7ZjFkO0JeAeVLGBCNxEqqj2If3vL7sKrKJ6I3VRoBRbD5/1o hcxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ESyY6A86ITabfK9exdjzvA0vOIeagH3H8U+WF7uzAy0=; b=hVvpKuYpqhFC8lB5eQkMDo8SgO1Sxo8fczmbUS1ZRB+kvgncpV2dxZljh+Y7A574bf lUEFYQnbf6DuzSHNkV/sbjrx+WnOhA5nVHK4qxEy3YWIeDQfWXLj074Y5eG2KmTzEIay uPSWOX5vc3OVVp3HKZf8BFS7Ir4yKAeJX8GibZDCDTPoEgC72oP472Aqw3rwzgmC5RYE 03rGZ7TD2LYrsXza8VrLrR3Jij7s3ujrLxeHi2ZOMBghy08EHwQlQsviEbhnY4tKsxj3 cudTSDctDwLBfLdydDJ7w5/kBqI9fmgn6bGSq+e0SJ97el3Gxcecq6oQlS3oJxkPA4ms jhiQ== X-Gm-Message-State: ALQs6tCEZt0leugr0kz9wg46+8mlFEXRTIQy4s7CuwIQGhY/TVoSzyQ9 MRQTp1/v519FKQHPZ0KIlX9mWg== X-Google-Smtp-Source: AB8JxZoEY8H2/N5iWNZL2+sFY9ZIpwMJsuHJ7k6bds4dRZESDlEy00ComsbVVWAFQW+4x2MFmWY8sQ== X-Received: by 10.28.218.19 with SMTP id r19mr16930540wmg.2.1525371655566; Thu, 03 May 2018 11:20:55 -0700 (PDT) Received: from localhost.localdomain ([176.228.154.53]) by smtp.gmail.com with ESMTPSA id w40-v6sm24388801wrc.69.2018.05.03.11.20.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 May 2018 11:20:54 -0700 (PDT) From: Marcel Apfelbaum To: qemu-devel@nongnu.org Date: Thu, 3 May 2018 21:21:25 +0300 Message-Id: <20180503182125.20310-9-marcel.apfelbaum@gmail.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180503182125.20310-1-marcel.apfelbaum@gmail.com> References: <20180503182125.20310-1-marcel.apfelbaum@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 8/8] MAINTAINERS: update Marcel Apfelbaum email X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, yuval.shaia@oracle.com, f4bug@amsat.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marcel Apfelbaum Use my gmail account for maintainer tasks. Signed-off-by: Marcel Apfelbaum Message-Id: <20180426084523.10565-1-marcel@redhat.com> Reviewed-by: Yuval Shaia --- MAINTAINERS | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 24b70169bc..459e3594e1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -909,7 +909,7 @@ X86 Machines ------------ PC M: Michael S. Tsirkin -M: Marcel Apfelbaum +M: Marcel Apfelbaum S: Supported F: include/hw/i386/ F: hw/i386/ @@ -959,7 +959,7 @@ F: include/hw/timer/mc146818rtc* Machine core M: Eduardo Habkost -M: Marcel Apfelbaum +M: Marcel Apfelbaum S: Supported F: hw/core/machine.c F: hw/core/null-machine.c @@ -1033,7 +1033,7 @@ F: hw/ipack/ PCI M: Michael S. Tsirkin -M: Marcel Apfelbaum +M: Marcel Apfelbaum S: Supported F: include/hw/pci/* F: hw/misc/pci-testdev.c @@ -2075,7 +2075,7 @@ F: docs/block-replication.txt PVRDMA M: Yuval Shaia -M: Marcel Apfelbaum +M: Marcel Apfelbaum S: Maintained F: hw/rdma/* F: hw/rdma/vmw/*