Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3691054ybv; Mon, 10 Feb 2020 04:47:26 -0800 (PST) X-Google-Smtp-Source: APXvYqytOdqrbWjVlo1nxZZ4lBazDC6uGWNPFZ1u8T546EjW5DNvWm/ZfK4/fYiy4dsmMbOaD1H7 X-Received: by 2002:aca:e084:: with SMTP id x126mr675458oig.97.1581338846205; Mon, 10 Feb 2020 04:47:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581338846; cv=none; d=google.com; s=arc-20160816; b=KpRSuqckVZoIUecO70Vh3B4Df8nscOq6VU3/Fre4PCREztF/jTYfRC+bHkKJx+jWMo /LzsUwYnwAMDmP4lnEt5EAG9+TZ4q/MP3xgXzVp/NlFlwoCmw3Bwa2Fqg2uwlipWTNWn xVX100ADEUuEOQsdEghi1/lyrWZWWIsf2G/mBQP4J/JbEktbwWu2htbujKdQ7M5PuYcU 3mXsq6nA15X5dANfzeNxgHKVTPqPXS6fQ9gXndbx1BZJWVFSVRAbI9HkdJ/1bTXckM5Q C6Uir3xl68J8RBmvAWC27GKjP3/IOMwe+8KrH8S3afEwbV4efQ1sIa7ORlu227zVLLG9 l6PQ== 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:dkim-signature; bh=BrqSB2ueL9ryQuHzisr2ReYPKH6TwoYjHEIPhz9iOnM=; b=GHD/z2vXKzwD0WPMKS7drabZBqcX29fjJM7gCojtQ1dnOADid++cn5BiAQlkovhD28 dvRZh/fJjwUTbTc3lmQW12UCbiaumyy/28DRSMcw4MzqjzYdEOPnN8RxhlkWH/lHxUw1 YdcAOEK5u9Mb/2SyuuJOPcte8LCBBaPiEehyAyZ7NiQMPHkVL62NbQzcNYPQec+jpEnh aLQB7bU8alhc5WZ4yGHvxaijvN8g0ezIgUjpRDx5Q9KY/3zKTyGAT81KREooTRHTlsB3 DV6WLxj/PvitG1SmaGWZMaFwTQikRM+WAKp1GTlVYG+q+plH3sC1D6fi6eo6N2VfpPVP Yegw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BVBZuZEO; 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 d20si118949oti.311.2020.02.10.04.47.14; Mon, 10 Feb 2020 04:47:26 -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; dkim=pass header.i=@kernel.org header.s=default header.b=BVBZuZEO; 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 S1728130AbgBJMrL (ORCPT + 99 others); Mon, 10 Feb 2020 07:47:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:45550 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730130AbgBJMmB (ORCPT ); Mon, 10 Feb 2020 07:42:01 -0500 Received: from localhost (unknown [209.37.97.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 519D220838; Mon, 10 Feb 2020 12:42:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338521; bh=5gg7xp34r4GTw4ZoPXvRD8qjjJSE+u94enWT0OdkQXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BVBZuZEOVlmdqsrMEsYSrXqJ+ZE/ptkSyCkRobktkzcIxzP1kZfO03ui5++XJxbRP uA9ywF2XiGv+kO0ytmZ5t/htMBLSoFZt3OHMVGWmsduuxF1eBUvLCUQbQGbEVSofzG aB1UxO2CAceVGNYvbwn4eO597PrnAaANtFgnjQMc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yishai Hadas , Artemy Kovalyov , Jason Gunthorpe , Leon Romanovsky Subject: [PATCH 5.5 295/367] IB/core: Fix ODP get user pages flow Date: Mon, 10 Feb 2020 04:33:28 -0800 Message-Id: <20200210122450.940348123@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122423.695146547@linuxfoundation.org> References: <20200210122423.695146547@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Yishai Hadas commit d07de8bd1709a80a282963ad7b2535148678a9e4 upstream. The nr_pages argument of get_user_pages_remote() should always be in terms of the system page size, not the MR page size. Use PAGE_SIZE instead of umem_odp->page_shift. Fixes: 403cd12e2cf7 ("IB/umem: Add contiguous ODP support") Link: https://lore.kernel.org/r/20191222124649.52300-3-leon@kernel.org Signed-off-by: Yishai Hadas Reviewed-by: Artemy Kovalyov Reviewed-by: Jason Gunthorpe Signed-off-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/core/umem_odp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/infiniband/core/umem_odp.c +++ b/drivers/infiniband/core/umem_odp.c @@ -440,7 +440,7 @@ int ib_umem_odp_map_dma_pages(struct ib_ while (bcnt > 0) { const size_t gup_num_pages = min_t(size_t, - (bcnt + BIT(page_shift) - 1) >> page_shift, + ALIGN(bcnt, PAGE_SIZE) / PAGE_SIZE, PAGE_SIZE / sizeof(struct page *)); down_read(&owning_mm->mmap_sem);