Received: by 10.223.185.116 with SMTP id b49csp8918537wrg; Fri, 2 Mar 2018 10:07:42 -0800 (PST) X-Google-Smtp-Source: AG47ELv8jxxIgmQTpucjCc4iMb0zw0RkP0GESpnJ7RYqtSjW992YJM0oVqhgOdnfI5w8dmM6xU+s X-Received: by 10.99.51.74 with SMTP id z71mr5104337pgz.272.1520014062368; Fri, 02 Mar 2018 10:07:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520014062; cv=none; d=google.com; s=arc-20160816; b=kIhtNJ0TZYbY00n4eCAj6xfvb3s7vQKWMkGGoQ7whG/NaYVzk8loR/rke/xCbIFKhT wALLMD1fds3jqlPMsegw6kzgENTeRBEZq+zu4B+XRUim9Q6nILohNkPgunujYvQat3HA 7atY0NOSEQlZfVB1E3yO5CptgTKbTH99VpUt7XDyr/fQlWlqoUVjB9aMQQpKb7R6fR7q aT/76ctqV2N+UCVq2iJqQ7a/cdJ9GFGX5/vIxqbBZTVbDhqdQ+IawuNoikSjv0WLsilK zp1isbmCM+LgwQk+ltgzsDBkB4cdwqZKPg2o5SYUDF5AfibCmYlC+H4HKhUIlmeWEMCG OoBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=XSrNnHqRM9xh0L+iolGLKGwdc1di6TP8Rc2w68lhiPo=; b=Jr8pnzhJExDeiW++I3PKMEC6LklkU6IGRCXlRKGsaklcZQyN0zKyR7hQuBFIuQ00NF tiUw8tmPQeJW9Z7uFcutyHckjaWBmXcaKTvoAM0QgHAB/BcZ+V3A1nHsVBEZJU45QCy8 ev7ysmLX2UmxF4oYoehvIuJZeqNNQjEPi82G6yvM9XLA254RpwjmztlQcKllqwguGTG9 Fki1IXAAtBKr92Iuw3RDuMl801Ryk/w7o11KY9o9IDCIP4ULUuOfkcN9iUs7Y7HvkkQJ XsJn4GqDQb8HErR4NqzQlF3wgKeO3HmIn/lkowiuxdqRT/bDS2g86JZiuItrl1kNb8Aj aXCA== 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 x77si4333395pgx.159.2018.03.02.10.07.27; Fri, 02 Mar 2018 10:07:42 -0800 (PST) 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 S1426870AbeCBLCn (ORCPT + 99 others); Fri, 2 Mar 2018 06:02:43 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:50872 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423716AbeCBIzn (ORCPT ); Fri, 2 Mar 2018 03:55:43 -0500 Received: from localhost (clnet-b04-243.ikbnet.co.at [83.175.124.243]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C9E561249; Fri, 2 Mar 2018 08:55:42 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ross Lagerwall , Boris Ostrovsky , Sasha Levin Subject: [PATCH 4.4 30/34] xen/gntdev: Fix off-by-one error when unmapping with holes Date: Fri, 2 Mar 2018 09:51:26 +0100 Message-Id: <20180302084437.935522961@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180302084435.842679610@linuxfoundation.org> References: <20180302084435.842679610@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ross Lagerwall [ Upstream commit 951a010233625b77cde3430b4b8785a9a22968d1 ] If the requested range has a hole, the calculation of the number of pages to unmap is off by one. Fix it. Signed-off-by: Ross Lagerwall Reviewed-by: Boris Ostrovsky Signed-off-by: Boris Ostrovsky Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/xen/gntdev.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c @@ -378,10 +378,8 @@ static int unmap_grant_pages(struct gran } range = 0; while (range < pages) { - if (map->unmap_ops[offset+range].handle == -1) { - range--; + if (map->unmap_ops[offset+range].handle == -1) break; - } range++; } err = __unmap_grant_pages(map, offset, range);