From patchwork Wed Feb 28 09:35:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia He X-Patchwork-Id: 10247827 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 671CC60365 for ; Wed, 28 Feb 2018 14:52:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 58D0C28B99 for ; Wed, 28 Feb 2018 14:52:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4CBEA28BA1; Wed, 28 Feb 2018 14:52:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 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 mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9E01A28B99 for ; Wed, 28 Feb 2018 14:52:31 +0000 (UTC) Received: from localhost ([::1]:44762 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er35q-0004AO-Mw for patchwork-qemu-devel@patchwork.kernel.org; Wed, 28 Feb 2018 09:52:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50921) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqyA9-0001lU-9i for qemu-devel@nongnu.org; Wed, 28 Feb 2018 04:36:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqyA8-0000b8-Eo for qemu-devel@nongnu.org; Wed, 28 Feb 2018 04:36:37 -0500 Received: from mail-pl0-x241.google.com ([2607:f8b0:400e:c01::241]:46520) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eqyA8-0000aj-83 for qemu-devel@nongnu.org; Wed, 28 Feb 2018 04:36:36 -0500 Received: by mail-pl0-x241.google.com with SMTP id y8-v6so1166445pll.13 for ; Wed, 28 Feb 2018 01:36:36 -0800 (PST) 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=t/Gqv002wI6uqf93TQQsmHg0+851ZCB1r7kg8NEy/X0=; b=CVSbDtGuIL1I57uSfXu+GP0RwPSorfBMyzEtNqGSY6KhDmzzI7YnQbUaT92Z3Swlp5 US6foMZ7As6tevXqDpCKIAImhCFrhB+NVYBIK83DXiPbOb58RdlVJGpaoVSp/abPfRpT 9NCVCT4gmanLV+vGTSZd2Sox6O95uTAuA7oR8t/jnQ5FItzvjojzO3MExUUrooyemyNC kCHAstW3lcaEGRe+8IQ6dJcrAP9gz8Mrgyc1+2WYmuXTJfeJwwynzNXqLH2a4a6Yjo1q BAxB2BS0EHBHraX7RS4rVUuriHUXpoe2FDbFjdmM9Hfk4Ru3EiT2dhw+6UvHxI35y06A ASNw== 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=t/Gqv002wI6uqf93TQQsmHg0+851ZCB1r7kg8NEy/X0=; b=ZHbn25mCjH/aA/OHKbjJgVa+n/IVIAbokX3vqLkqO/J39zOmgIcN5Wp3iNoU6D3rCu v40v34pAtoFcXcOVIui753K0Tb1g8Lr379VPqYAyVu8thvmZXSsBrRMGKFplRSNmtZzR 9rBbV9tF2JA17VQt66Ozgi8LrfLpOGcxomAacZYmbIA0aZ0dVGRp74WfH3MP2ox6lU3V CTlxSY2MqqkZPYdc5bKEvs2MRIMfK66/u/uDc0OAE+SD0XKlufyF7XS8S+F1RoYN4Mlq gQMjNGrS0TB6WB5jYZ1d8v5r7tbBmI7Uuc8kfQzod33wYk7V4XuCMClxzHzu/N641fcx lgQQ== X-Gm-Message-State: APf1xPA3/5XkmLehh6F1a13BcTlwrQsc9N75Vjz6lrsI297dBm1/A4nC tKwm9qdZCj7Q1YmmjaViUYo= X-Google-Smtp-Source: AH8x224kxUwxVMarNuF0PPfPgYM7F8dxm6jJzKTd5sGnmaUD++RG/Vco6f3OHDJXJrCi44qfn11Diw== X-Received: by 2002:a17:902:8501:: with SMTP id bj1-v6mr17732629plb.110.1519810595427; Wed, 28 Feb 2018 01:36:35 -0800 (PST) Received: from localhost.localdomain ([38.106.11.25]) by smtp.gmail.com with ESMTPSA id e127sm2686177pfe.157.2018.02.28.01.36.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Feb 2018 01:36:34 -0800 (PST) From: Jia He To: "Michael S. Tsirkin" , qemu-devel@nongnu.org Date: Wed, 28 Feb 2018 01:35:29 -0800 Message-Id: <1519810529-4034-2-git-send-email-hejianet@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519810529-4034-1-git-send-email-hejianet@gmail.com> References: <1519810529-4034-1-git-send-email-hejianet@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::241 X-Mailman-Approved-At: Wed, 28 Feb 2018 09:50:03 -0500 Subject: [Qemu-devel] [PATCH 2/2] vhost: fix incorrect check in vhost_verify_ring_mappings 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: Jia He , Jia He , "Dr . David Alan Gilbert" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP In commit 0ca1fd2d6878 ("vhost: Simplify ring verification checks"), it checks the virtqueue desc mapping for 3 times. Fixed: commit 0ca1fd2d6878 ("vhost: Simplify ring verification checks") Signed-off-by: Jia He Reviewed-by: Dr. David Alan Gilbert --- hw/virtio/vhost.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 00f2512..bbf6c0c 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -359,7 +359,7 @@ static int vhost_verify_ring_mappings(struct vhost_dev *dev, j++; r = vhost_verify_ring_part_mapping( - vq->desc, vq->desc_phys, vq->desc_size, + vq->avail, vq->avail_phys, vq->avail_size, reg_hva, reg_gpa, reg_size); if (r) { break; @@ -367,7 +367,7 @@ static int vhost_verify_ring_mappings(struct vhost_dev *dev, j++; r = vhost_verify_ring_part_mapping( - vq->desc, vq->desc_phys, vq->desc_size, + vq->used, vq->used_phys, vq->used_size, reg_hva, reg_gpa, reg_size); if (r) { break;