All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack-IBi9RG/b67k@public.gmane.org>
To: linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org
Cc: Jan Kara <jack-AlSwsSmVLrQ@public.gmane.org>,
	Roland Dreier <roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 5/7] IB/mthca: Convert mthca_map_user_db() to use get_user_pages_fast()
Date: Tue,  6 Oct 2015 11:24:28 +0200	[thread overview]
Message-ID: <1444123470-4932-6-git-send-email-jack@suse.com> (raw)
In-Reply-To: <1444123470-4932-1-git-send-email-jack-IBi9RG/b67k@public.gmane.org>

From: Jan Kara <jack-AlSwsSmVLrQ@public.gmane.org>

Function mthca_map_user_db() appears to call get_user_pages() without
holding mmap_sem. Fix the bug by using get_user_pages_fast() instead
which also takes care of the locking.

CC: Roland Dreier <roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
CC: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Jan Kara <jack-AlSwsSmVLrQ@public.gmane.org>
---
 drivers/infiniband/hw/mthca/mthca_memfree.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.c b/drivers/infiniband/hw/mthca/mthca_memfree.c
index 7d2e42dd6926..c3543b27a2a7 100644
--- a/drivers/infiniband/hw/mthca/mthca_memfree.c
+++ b/drivers/infiniband/hw/mthca/mthca_memfree.c
@@ -472,8 +472,7 @@ int mthca_map_user_db(struct mthca_dev *dev, struct mthca_uar *uar,
 		goto out;
 	}
 
-	ret = get_user_pages(current, current->mm, uaddr & PAGE_MASK, 1, 1, 0,
-			     pages, NULL);
+	ret = get_user_pages_fast(uaddr & PAGE_MASK, 1, 1, pages);
 	if (ret < 0)
 		goto out;
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Jan Kara <jack@suse.com>
To: linux-mm@kvack.org
Cc: Jan Kara <jack@suse.cz>, Roland Dreier <roland@kernel.org>,
	linux-rdma@vger.kernel.org
Subject: [PATCH 5/7] IB/mthca: Convert mthca_map_user_db() to use get_user_pages_fast()
Date: Tue,  6 Oct 2015 11:24:28 +0200	[thread overview]
Message-ID: <1444123470-4932-6-git-send-email-jack@suse.com> (raw)
In-Reply-To: <1444123470-4932-1-git-send-email-jack@suse.com>

From: Jan Kara <jack@suse.cz>

Function mthca_map_user_db() appears to call get_user_pages() without
holding mmap_sem. Fix the bug by using get_user_pages_fast() instead
which also takes care of the locking.

CC: Roland Dreier <roland@kernel.org>
CC: linux-rdma@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
---
 drivers/infiniband/hw/mthca/mthca_memfree.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.c b/drivers/infiniband/hw/mthca/mthca_memfree.c
index 7d2e42dd6926..c3543b27a2a7 100644
--- a/drivers/infiniband/hw/mthca/mthca_memfree.c
+++ b/drivers/infiniband/hw/mthca/mthca_memfree.c
@@ -472,8 +472,7 @@ int mthca_map_user_db(struct mthca_dev *dev, struct mthca_uar *uar,
 		goto out;
 	}
 
-	ret = get_user_pages(current, current->mm, uaddr & PAGE_MASK, 1, 1, 0,
-			     pages, NULL);
+	ret = get_user_pages_fast(uaddr & PAGE_MASK, 1, 1, pages);
 	if (ret < 0)
 		goto out;
 
-- 
2.1.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2015-10-06  9:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-06  9:24 [PATCH 0/7] get_user_pages() cleanup Jan Kara
2015-10-06  9:24 ` Jan Kara
2015-10-06  9:24 ` Jan Kara
2015-10-06  9:24 ` [PATCH 1/7] cris: Convert cryptocop to use get_user_pages_fast() Jan Kara
2015-10-06  9:53   ` Mikael Starvik
2015-10-09 14:41   ` Jesper Nilsson
2015-10-06  9:24 ` [PATCH 2/7] ia64: Use get_user_pages_fast() in err_inject.c Jan Kara
2015-10-06  9:24   ` Jan Kara
2015-10-06  9:24 ` [PATCH 3/7] drm: Convert via driver to use get_user_pages_fast() Jan Kara
2015-10-06  9:24 ` [PATCH 4/7] fsl_hypervisor: Convert ioctl_memcpy() " Jan Kara
     [not found] ` <1444123470-4932-1-git-send-email-jack-IBi9RG/b67k@public.gmane.org>
2015-10-06  9:24   ` Jan Kara [this message]
2015-10-06  9:24     ` [PATCH 5/7] IB/mthca: Convert mthca_map_user_db() " Jan Kara
2015-10-06  9:24 ` [PATCH 6/7] drm/i915: Convert to use get_user_page_unlocked() Jan Kara
2015-10-06  9:24 ` [PATCH 7/7] [media] ivtv: Convert to get_user_pages_unlocked() Jan Kara
2015-10-06  9:24   ` Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1444123470-4932-6-git-send-email-jack@suse.com \
    --to=jack-ibi9rg/b67k@public.gmane.org \
    --cc=jack-AlSwsSmVLrQ@public.gmane.org \
    --cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.