Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp725324imm; Thu, 13 Sep 2018 06:53:11 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdaei6B6euTyNpDjLD1F1sVSvEIJQkpZYUuBg3ksIP6H+YwmWaqzSg3CRXnE6GsCKLtXhGyV X-Received: by 2002:a17:902:9693:: with SMTP id n19-v6mr7489394plp.282.1536846790963; Thu, 13 Sep 2018 06:53:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536846790; cv=none; d=google.com; s=arc-20160816; b=h2LHmR1IYlG4DhJ7DwEXGBZEyiCIlK3XLj1ySNdIz8zMiUpQbdIxj9DJmMlfseaxnf RxPPOXvLXaHeEHKMdOVWFOXv68aARvXdAALYrUDfpbt6SsCeev2mSo/1wRIcHRUoGl5q PgCPcb5LXhUJYQUT4jiYzgLZMmpFzJ/RTRtUHV3lkX0DvEH9QFRrAW53dojnI6mPfYnM fNcuM6ErFG5RA4e83q1Du/N95nTY3faf1Jgu1lc879+0XEELSq4cufyk53endrWKPxYL HSjaVMzfp4lk4Pn3PRhYg4ieWuWnDdn4q1asN5HvArtcKID5OHRVCybUwz7aoTQCpHF3 U7ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=/b1kETgDONfO7nP21Cri6QSIxsI9pN3vhv/yTg3Wq5o=; b=Cj4YMPvTtJl8oMzyjh55UZz60z9anNCQnD9sg6Xcq2H94pnihTUs5q8U/okxBMjWoZ araEIuUxPu4y3Ty7jNw6SEg4a8riX2B3hl9TVIhSkYUCmPTEJZXsJOXg9ONdCNLcTHAL 0eb88iv0wtGgpMqFSmg79nmamb0bUhsfCyyCuWjEmZaPXAPVada2Oll2jHG8v0qxFBgX lElv91807E92F0+SEq1zuDXLalATDQKBTI9SzHwKlFggLflj16cWiwgjSmy/+k8ZjO2d zRb2ciVnOoKEHOPd5cxX+CBBxkyYHzIleesWxsXfPRJXyXqCCQsURZhpLaQsZizzB9f5 KS6g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 14-v6si4400033plb.230.2018.09.13.06.52.55; Thu, 13 Sep 2018 06:53:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731024AbeIMTCV (ORCPT + 99 others); Thu, 13 Sep 2018 15:02:21 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33554 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730327AbeIMTCU (ORCPT ); Thu, 13 Sep 2018 15:02:20 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D059CD19; Thu, 13 Sep 2018 13:52:44 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Xu , Jason Wang , "Michael S. Tsirkin" , "David S. Miller" Subject: [PATCH 4.18 035/197] vhost: correctly check the iova range when waking virtqueue Date: Thu, 13 Sep 2018 15:29:44 +0200 Message-Id: <20180913131842.959653536@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131841.568116777@linuxfoundation.org> References: <20180913131841.568116777@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jason Wang [ Upstream commit 2d66f997f0545c8f7fc5cf0b49af1decb35170e7 ] We don't wakeup the virtqueue if the first byte of pending iova range is the last byte of the range we just got updated. This will lead a virtqueue to wait for IOTLB updating forever. Fixing by correct the check and wake up the virtqueue in this case. Fixes: 6b1e6cc7855b ("vhost: new device IOTLB API") Reported-by: Peter Xu Signed-off-by: Jason Wang Reviewed-by: Peter Xu Tested-by: Peter Xu Acked-by: Michael S. Tsirkin Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/vhost/vhost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -951,7 +951,7 @@ static void vhost_iotlb_notify_vq(struct list_for_each_entry_safe(node, n, &d->pending_list, node) { struct vhost_iotlb_msg *vq_msg = &node->msg.iotlb; if (msg->iova <= vq_msg->iova && - msg->iova + msg->size - 1 > vq_msg->iova && + msg->iova + msg->size - 1 >= vq_msg->iova && vq_msg->type == VHOST_IOTLB_MISS) { vhost_poll_queue(&node->vq->poll); list_del(&node->node);