Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp4808237ybh; Tue, 6 Aug 2019 18:40:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyF4YmANI40wtBmH6Rdnh+T2DnamUTIZnlZobv2jsgTXCm4FYMoRUhWulVWU5pwS8FF3627 X-Received: by 2002:a17:90a:2567:: with SMTP id j94mr6010906pje.121.1565142042110; Tue, 06 Aug 2019 18:40:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565142042; cv=none; d=google.com; s=arc-20160816; b=B03Oe876HQ9sY6YPSovl7GqLzLRXAOVNGLW52g1OzBuRLU+3s4UwUL/JEfgql6Wts4 cgMKg+NgFoL6xhg48tKjdtesb+6j5frKZn0Ktodq8B7XOKGwhID39DPCc0cHhw4wOa1F P6ggYSvP4I8VHk6w9d//G93N3DBGWTx++k/34142qNT3o7JautvV/lz+P73v9nF6FBEl ks0digGoloVbLrgwhiJE8lHvO4SX8a9qVnEPI1OloRDZtEHEBfE9noxsKYoyzLJKCi0S rmloDMZldvmK147znMCn7XmDB/0g77l8k/+R/V+PYitWV3VEPDjb/o3L+eJe4hLDo53I zkEA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=60C6UutqWDg70MnmR2wOYRHcozVv05mGJual4EWfkd0=; b=iyFuIIUEkOjPJnwxUx2J+VQRfZjaFoSANxbY1bRH2UQw9VjaLW/JHshiEp7x1YbsNh FfmJk23TaipBEhO/BhzsskcSN4FhEKyG/KuKre04VdAi72cJiFJkSiaR/8uyFd/o6Als 9TcH/ed3KCIrN0CIC/G/m+dQHpUq9lXt3khqKMfXt/27FVSReXdgKPP3UK7NjVZHb+lt DiPIdSDKHXR4XHPGofomr6vOdWFi1JkwPLmU2NjwFpT9lXKJ81XqesHPbBtOGYimqYtS dWyw9jsgW+pFTqHNandxDPiZazsDE0gqvm1P0IO5UpKF/mLD1BrceLa7NkOsn/PH1odu vz4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=a57ErTyt; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u38si48370490pgn.79.2019.08.06.18.40.28; Tue, 06 Aug 2019 18:40:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-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=@gmail.com header.s=20161025 header.b=a57ErTyt; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729125AbfHGBkN (ORCPT + 99 others); Tue, 6 Aug 2019 21:40:13 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:43248 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729144AbfHGBeJ (ORCPT ); Tue, 6 Aug 2019 21:34:09 -0400 Received: by mail-pf1-f193.google.com with SMTP id i189so42499259pfg.10; Tue, 06 Aug 2019 18:34:08 -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=60C6UutqWDg70MnmR2wOYRHcozVv05mGJual4EWfkd0=; b=a57ErTytVAxkauYkEPzZRHeGlc0u/A4U5ejAgWPi4ESjwpiFFk6hlPoBGFaPNr39C+ Kh0xSgXuJrsK4KZTKR2yEzoaLeUoioeGoUgaErqheNBeKc06PHRqwui84Q8EBbD2l+tL nX9d4d0RSUpPYxjPCjQnBkDN0+Zv6eOTSEhKauRBsgQJexRHp+YFYc3bVaLsL+EpeITh /oPeL3Ga9GujoFOOg6Eq3QUGMLurJ7MLYFEtSSTI2Z3ruqYxpiTRqopLyKlPWxV9WtYJ j/nNcaVxSU6fzyomhmIYzgCq04OEkW1OTZBrVWiS6qgJ9uqJ806PfvtCbg/QGSrKMhpY gQvw== 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=60C6UutqWDg70MnmR2wOYRHcozVv05mGJual4EWfkd0=; b=H+JehYMJzp2Qkflf6COAw+gFETGI+RpnOwpPq+huarvV0r2jet6wsZOW7KEQc30U1C eBAUmcqi5VuxWzEOxjGOzPTVj7IljkqMCPz5r/G6FQM7v+/zdpbHNz++2G7u6gUHcWYX cf2o3GUi6ymMptU/a6NtASbZbEkmI6pqVkl3feuwNYwnhlUoN4mnbZdD0Sig41cBEl2K T8KizDyvQpQ8WDTXXklsZP0BeHQD1oXS4x8AgY1z6fWu/EN8ZbXlrUKiJhiz1pvPqQ+1 6IOAKfuNBQy2UiOzPWXEcYJ+lM5hWxsj2IRbqA3Pbiah3HMIxqfnfe1corgQd6rlsCyG Waog== X-Gm-Message-State: APjAAAW/JQP9V2RHAcYyZ/ZJJMxRKQ9UOvmpgurfmy+h3+TEEAwNjp3v iFmYaqVrKYWKKtpwgc2CSug= X-Received: by 2002:a17:90a:ad41:: with SMTP id w1mr5931335pjv.52.1565141648506; Tue, 06 Aug 2019 18:34:08 -0700 (PDT) Received: from blueforge.nvidia.com (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id u69sm111740800pgu.77.2019.08.06.18.34.06 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 06 Aug 2019 18:34:08 -0700 (PDT) From: john.hubbard@gmail.com X-Google-Original-From: jhubbard@nvidia.com To: Andrew Morton Cc: Christoph Hellwig , Dan Williams , Dave Chinner , Dave Hansen , Ira Weiny , Jan Kara , Jason Gunthorpe , =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , LKML , amd-gfx@lists.freedesktop.org, ceph-devel@vger.kernel.org, devel@driverdev.osuosl.org, devel@lists.orangefs.org, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-block@vger.kernel.org, linux-crypto@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-media@vger.kernel.org, linux-mm@kvack.org, linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-xfs@vger.kernel.org, netdev@vger.kernel.org, rds-devel@oss.oracle.com, sparclinux@vger.kernel.org, x86@kernel.org, xen-devel@lists.xenproject.org, John Hubbard , Matt Porter , Alexandre Bounine , Al Viro , Logan Gunthorpe , Christophe JAILLET , Ioan Nicu , Kees Cook , Tvrtko Ursulin Subject: [PATCH v3 15/41] rapidio: convert put_page() to put_user_page*() Date: Tue, 6 Aug 2019 18:33:14 -0700 Message-Id: <20190807013340.9706-16-jhubbard@nvidia.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190807013340.9706-1-jhubbard@nvidia.com> References: <20190807013340.9706-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public Content-Transfer-Encoding: 8bit Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: John Hubbard For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages(). This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions"). Cc: Matt Porter Cc: Alexandre Bounine Cc: Al Viro Cc: Logan Gunthorpe Cc: Christophe JAILLET Cc: Ioan Nicu Cc: Kees Cook Cc: Tvrtko Ursulin Signed-off-by: John Hubbard --- drivers/rapidio/devices/rio_mport_cdev.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/rapidio/devices/rio_mport_cdev.c b/drivers/rapidio/devices/rio_mport_cdev.c index 8155f59ece38..0e8ea0e5a89e 100644 --- a/drivers/rapidio/devices/rio_mport_cdev.c +++ b/drivers/rapidio/devices/rio_mport_cdev.c @@ -572,14 +572,12 @@ static void dma_req_free(struct kref *ref) struct mport_dma_req *req = container_of(ref, struct mport_dma_req, refcount); struct mport_cdev_priv *priv = req->priv; - unsigned int i; dma_unmap_sg(req->dmach->device->dev, req->sgt.sgl, req->sgt.nents, req->dir); sg_free_table(&req->sgt); if (req->page_list) { - for (i = 0; i < req->nr_pages; i++) - put_page(req->page_list[i]); + put_user_pages(req->page_list, req->nr_pages); kfree(req->page_list); } @@ -815,7 +813,7 @@ rio_dma_transfer(struct file *filp, u32 transfer_mode, struct mport_dma_req *req; struct mport_dev *md = priv->md; struct dma_chan *chan; - int i, ret; + int ret; int nents; if (xfer->length == 0) @@ -946,8 +944,7 @@ rio_dma_transfer(struct file *filp, u32 transfer_mode, err_pg: if (!req->page_list) { - for (i = 0; i < nr_pages; i++) - put_page(page_list[i]); + put_user_pages(page_list, nr_pages); kfree(page_list); } err_req: -- 2.22.0